Added 'better' tests
This commit is contained in:
parent
e46bac19fa
commit
975cba295b
1 changed files with 23 additions and 35 deletions
|
@ -14,43 +14,31 @@
|
||||||
|
|
||||||
class ArchitectureTest(unittest.TestCase):
|
class ArchitectureTest(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
zlib = spack.spec.Spec("zlib")
|
|
||||||
zlib.concretize()
|
|
||||||
self.architecture = zlib.architecture
|
|
||||||
self.platform = sys_type()
|
|
||||||
self.platform_os = self.platform.operating_system('default_os')
|
|
||||||
self.target = self.platform.target('default')
|
|
||||||
|
|
||||||
#def test_to_dict_function_with_target(self):
|
|
||||||
# d = spack.architecture.to_dict(self.architecture)
|
|
||||||
# print d['target']
|
|
||||||
# self.assertEquals(d['target'], {'name': self.target.name,
|
|
||||||
# 'module_name' : self.target.module_name,
|
|
||||||
# 'platform_name' : self.target.platform_name,
|
|
||||||
# 'compiler_strategy': 'MODULES'
|
|
||||||
# })
|
|
||||||
|
|
||||||
def test_to_dict_function_with_architecture(self):
|
def test_to_dict_function_with_architecture(self):
|
||||||
d = spack.architecture.to_dict(self.architecture)
|
arch = Arch()
|
||||||
self.assertEquals(d, {'architecture':
|
arch.platform_os = arch.platform.operating_system('default_os')
|
||||||
{'platform' : {'name': 'crayxc'},
|
arch.target = arch.platform.target('default')
|
||||||
'platform_os': {
|
|
||||||
'compiler_strategy': 'MODULES',
|
|
||||||
'name':'CNL',
|
|
||||||
'version':'10'},
|
|
||||||
'target' : {'platform_name' :'crayxc',
|
|
||||||
'module_name': 'craype-haswell',
|
|
||||||
'name':'haswell'}}})
|
|
||||||
|
|
||||||
#def test_to_dict_function_with_operating_system(self):
|
d = arch.to_dict()
|
||||||
# d = spack.architecture.to_dict(self.architecture)
|
self.assertEqual(d, {'platform' : 'crayxc',
|
||||||
# self.assertEquals(d['platform_os'], {'name': self.platform_os.name,
|
'platform_os' : {'name': 'CNL',
|
||||||
# 'version': self.platform_os.version,
|
'compiler_strategy' : 'MODULES',
|
||||||
# 'compiler_strategy': self.platform_os.compiler_strategy})
|
'version':'10'},
|
||||||
|
'target' : {'name': 'haswell',
|
||||||
|
'module_name': 'craype-haswell'}})
|
||||||
|
|
||||||
|
def test_from_dict_function_with_architecture(self):
|
||||||
|
d = {'platform':'crayxc',
|
||||||
|
'platform_os' : {'name' : 'CNL', 'compiler_strategy': 'MODULES',
|
||||||
|
'version': '10'},
|
||||||
|
'target' : {'name':'haswell', 'module_name': 'craype-haswell'}}
|
||||||
|
|
||||||
|
arch = spack.architecture.arch_from_dict(d)
|
||||||
|
self.assertIsInstance(arch, Arch)
|
||||||
|
self.assertIsInstance(arch.platform, Platform)
|
||||||
|
self.assertIsInstance(arch.platform_os, OperatingSystem)
|
||||||
|
self.assertIsInstance(arch.target, Target)
|
||||||
|
|
||||||
def test_architecture_from_dict(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_platform_class_and_compiler_strategies(self):
|
def test_platform_class_and_compiler_strategies(self):
|
||||||
a = CrayXc()
|
a = CrayXc()
|
||||||
|
|
Loading…
Reference in a new issue