Made architecture test robust for more architectures

This commit is contained in:
Gregory Becker 2016-03-29 11:23:36 -07:00
parent 57ced37229
commit 7e9baf9e25

View file

@ -14,30 +14,24 @@
class ArchitectureTest(unittest.TestCase): class ArchitectureTest(unittest.TestCase):
def test_to_dict_function_with_architecture(self): def test_dict_functions_for_architecture(self):
arch = Arch() arch = Arch()
arch.platform_os = arch.platform.operating_system('default_os') arch.platform_os = arch.platform.operating_system('default_os')
arch.target = arch.platform.target('default') arch.target = arch.platform.target('default')
d = arch.to_dict() d = arch.to_dict()
self.assertEqual(d, {'platform' : 'crayxc',
'platform_os' : {'name': 'CNL',
'compiler_strategy' : 'MODULES',
'version':'10'},
'target' : {'name': 'haswell',
'module_name': 'craype-haswell'}})
def test_from_dict_function_with_architecture(self): new_arch = spack.architecture.arch_from_dict(d)
d = {'platform':'crayxc', self.assertEqual(arch, new_arch)
'platform_os' : {'name' : 'CNL', 'compiler_strategy': 'MODULES',
'version': '10'},
'target' : {'name':'haswell', 'module_name': 'craype-haswell'}}
arch = spack.architecture.arch_from_dict(d)
self.assertTrue( isinstance(arch, Arch) ) self.assertTrue( isinstance(arch, Arch) )
self.assertTrue( isinstance(arch.platform, Platform) ) self.assertTrue( isinstance(arch.platform, Platform) )
self.assertTrue( isinstance(arch.platform_os, OperatingSystem) ) self.assertTrue( isinstance(arch.platform_os, OperatingSystem) )
self.assertTrue( isinstance(arch.target, Target) ) self.assertTrue( isinstance(arch.target, Target) )
self.assertTrue( isinstance(new_arch, Arch) )
self.assertTrue( isinstance(new_arch.platform, Platform) )
self.assertTrue( isinstance(new_arch.platform_os, OperatingSystem) )
self.assertTrue( isinstance(new_arch.target, Target) )
def test_platform_class_and_compiler_strategies(self): def test_platform_class_and_compiler_strategies(self):