diff options
author | Gregory Becker <becker33@llnl.gov> | 2016-05-25 12:22:16 -0700 |
---|---|---|
committer | Gregory Becker <becker33@llnl.gov> | 2016-05-25 12:22:16 -0700 |
commit | 3a68dd2011488acdff4e3c8cb4690718e87623e6 (patch) | |
tree | c95e639ffa231241a277f4a8da6f61bf51d89466 /lib | |
parent | 513aae5ef8d610644e8f2d2c855e92a080573f5b (diff) | |
download | spack-3a68dd2011488acdff4e3c8cb4690718e87623e6.tar.gz spack-3a68dd2011488acdff4e3c8cb4690718e87623e6.tar.bz2 spack-3a68dd2011488acdff4e3c8cb4690718e87623e6.tar.xz spack-3a68dd2011488acdff4e3c8cb4690718e87623e6.zip |
(hopefully) final fixes of the merge
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/architecture.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 9 | ||||
-rw-r--r-- | lib/spack/spack/test/modules.py | 19 | ||||
-rw-r--r-- | lib/spack/spack/test/spec_dag.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/test/spec_semantics.py | 17 |
5 files changed, 38 insertions, 24 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 05dc969ebe..e9dd489e54 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -233,8 +233,17 @@ class Platform(object): 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): diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index d15598405f..5d82af4af6 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -1649,9 +1649,18 @@ class Spec(object): # 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 diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py index c73badf8f2..582e067860 100644 --- a/lib/spack/spack/test/modules.py +++ b/lib/spack/spack/test/modules.py @@ -73,7 +73,7 @@ configuration_alter_environment = { '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 @@ class TclTests(MockPackagesTest): 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 @@ class TclTests(MockPackagesTest): 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 @@ class TclTests(MockPackagesTest): 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 @@ class TclTests(MockPackagesTest): 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) diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py index 99a986a528..712f07ac4d 100644 --- a/lib/spack/spack/test/spec_dag.py +++ b/lib/spack/spack/test/spec_dag.py @@ -244,8 +244,8 @@ class SpecDagTest(MockPackagesTest): 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) diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index 45c89100d4..aa99ad71ed 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -141,10 +141,9 @@ class SpecSematicsTest(MockPackagesTest): 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 @@ class SpecSematicsTest(MockPackagesTest): 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') |