(hopefully) final fixes of the merge

This commit is contained in:
Gregory Becker 2016-05-25 12:22:16 -07:00
parent 513aae5ef8
commit 3a68dd2011
5 changed files with 38 additions and 24 deletions

View file

@ -233,8 +233,17 @@ def __str__(self):
return self.name
def _cmp_key(self):
return (self.name, (_cmp_key(t) for t in self.targets.values()),
(_cmp_key(o) for o in self.operating_sys.values()))
t_keys = ''.join(str(t._cmp_key()) for t in sorted(self.targets.values()))
o_keys = ''.join(str(o._cmp_key()) for o in sorted(self.operating_sys.values()))
return (self.name,
self.default,
self.front_end,
self.back_end,
self.default_os,
self.front_os,
self.back_os,
t_keys,
o_keys)
@key_ordering
class OperatingSystem(object):

View file

@ -1649,9 +1649,18 @@ def satisfies(self, other, deps=True, strict=False):
# TODO: Need to make sure that comparisons can be made via classes
if self.architecture and other.architecture:
print self.architecture, other.architecture
if ((self.architecture.platform and other.architecture.platform and self.architecture.platform != other.architecture.platform) or
(self.architecture.platform_os and other.architecture.platform_os and self.architecture.platform_os != other.architecture.platform_os) or
(self.architecture.target and other.architecture.target and self.architecture.target != other.architecture.target)):
d1 = self.architecture.platform.to_dict()
d2 = other.architecture.platform.to_dict()
print d1
print d2
print d1==d2
print self.architecture.platform == other.architecture.platform
print self.architecture.platform._cmp_key()
print other.architecture.platform._cmp_key()
return False
elif strict and ((other.architecture and not self.architecture) or
(other.architecture.platform and not self.architecture.platform) or

View file

@ -73,7 +73,7 @@ def mock_open(filename, mode):
'all': {
'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}
},
'arch=x86-linux': {
'platform=test target=x86_64': {
'environment': {'set': {'FOO': 'foo'},
'unset': ['BAR']}
}
@ -116,6 +116,7 @@ def tearDown(self):
def get_modulefile_content(self, spec):
spec.concretize()
print spec, '&&&&&'
generator = spack.modules.TclModule(spec)
generator.write()
content = FILE_REGISTRY[generator.file_name].split('\n')
@ -123,27 +124,28 @@ def get_modulefile_content(self, spec):
def test_simple_case(self):
spack.modules.CONFIGURATION = configuration_autoload_direct
spec = spack.spec.Spec('mpich@3.0.4 arch=x86-linux')
spec = spack.spec.Spec('mpich@3.0.4')
content = self.get_modulefile_content(spec)
self.assertTrue('module-whatis "mpich @3.0.4"' in content)
def test_autoload(self):
spack.modules.CONFIGURATION = configuration_autoload_direct
spec = spack.spec.Spec('mpileaks arch=x86-linux')
spec = spack.spec.Spec('mpileaks')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2)
self.assertEqual(len([x for x in content if 'module load ' in x]), 2)
spack.modules.CONFIGURATION = configuration_autoload_all
spec = spack.spec.Spec('mpileaks arch=x86-linux')
spec = spack.spec.Spec('mpileaks')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5)
self.assertEqual(len([x for x in content if 'module load ' in x]), 5)
def test_alter_environment(self):
spack.modules.CONFIGURATION = configuration_alter_environment
spec = spack.spec.Spec('mpileaks arch=x86-linux')
spec = spack.spec.Spec('mpileaks platform=test target=x86_64')
content = self.get_modulefile_content(spec)
print content
self.assertEqual(
len([x
for x in content
@ -152,8 +154,9 @@ def test_alter_environment(self):
len([x for x in content if 'setenv FOO "foo"' in x]), 1)
self.assertEqual(len([x for x in content if 'unsetenv BAR' in x]), 1)
spec = spack.spec.Spec('libdwarf arch=x64-linux')
spec = spack.spec.Spec('libdwarf %clang platform=test target=x86_32')
content = self.get_modulefile_content(spec)
print content
self.assertEqual(
len([x
for x in content
@ -164,14 +167,14 @@ def test_alter_environment(self):
def test_blacklist(self):
spack.modules.CONFIGURATION = configuration_blacklist
spec = spack.spec.Spec('mpileaks arch=x86-linux')
spec = spack.spec.Spec('mpileaks')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1)
self.assertEqual(len([x for x in content if 'module load ' in x]), 1)
def test_conflicts(self):
spack.modules.CONFIGURATION = configuration_conflicts
spec = spack.spec.Spec('mpileaks arch=x86-linux')
spec = spack.spec.Spec('mpileaks')
content = self.get_modulefile_content(spec)
self.assertEqual(
len([x for x in content if x.startswith('conflict')]), 2)

View file

@ -244,8 +244,8 @@ def test_unsatisfiable_compiler_version(self):
def test_unsatisfiable_architecture(self):
platform = spack.architecture.sys_type()
self.set_pkg_dep('mpileaks', 'mpich target=%s' % platform.target('default_target'))
spec = Spec('mpileaks ^mpich target=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf')
self.set_pkg_dep('mpileaks', 'mpich platform=test target=be')
spec = Spec('mpileaks ^mpich platform=test target=fe ^callpath ^dyninst ^libelf ^libdwarf')
self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, spec.normalize)

View file

@ -141,10 +141,9 @@ def test_satisfies_compiler_version(self):
def test_satisfies_architecture(self):
platform = spack.architecture.sys_type()
if platform.name == 'crayxc':
self.check_satisfies('foo target=frontend os=frontend', 'target=frontend os=frontend')
self.check_satisfies('foo target=backend os=backend', 'target=backend', 'os=backend')
self.check_satisfies('foo target=default_target os=default_os','target=default_target os=default_os')
self.check_satisfies('foo platform=test target=frontend os=frontend', 'platform=test target=frontend os=frontend')
self.check_satisfies('foo platform=test target=backend os=backend', 'platform=test target=backend', 'platform=test os=backend')
self.check_satisfies('foo platform=test target=default_target os=default_os','platform=test target=default_target os=default_os')
#ifdef NEW
@ -391,14 +390,8 @@ def test_invalid_constraint(self):
self.check_invalid_constraint('libelf debug=2', 'libelf debug=1')
self.check_invalid_constraint('libelf cppflags="-O3"', 'libelf cppflags="-O2"')
platform = spack.architecture.sys_type()
if len(platform.operating_sys.keys()) > 1 or len(platform.targets.keys()) > 1:
os1 = platform.operating_sys.keys()[0]
os2 = platform.operating_sys.keys()[-1]
target1 = platform.targets.keys()[0]
target2 = platform.targets.keys()[-1]
self.check_invalid_constraint('libelf target=%s os=%s' % (target1, os1),
'libelf target=%s os=%s' % (target2, os2))
self.check_invalid_constraint('libelf platform=test target=be os=be',
'libelf target=fe os=fe')
def test_constrain_changed(self):
self.check_constrain_changed('libelf', '@1.0')