summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMario Melara <maamelara@gmail.com>2016-02-24 12:16:09 -0800
committerMario Melara <maamelara@gmail.com>2016-02-24 12:16:09 -0800
commit339f4bfd23b097d009009b6dabd524f8bc831449 (patch)
treef456e89a10e9c5a530696788114f03f02972b31e /lib
parent5d5d3c5858a8882b615fb97fb07e335dc6c17f14 (diff)
downloadspack-339f4bfd23b097d009009b6dabd524f8bc831449.tar.gz
spack-339f4bfd23b097d009009b6dabd524f8bc831449.tar.bz2
spack-339f4bfd23b097d009009b6dabd524f8bc831449.tar.xz
spack-339f4bfd23b097d009009b6dabd524f8bc831449.zip
Added unit testing for to_dict method
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/architecture.py43
1 files changed, 41 insertions, 2 deletions
diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py
index cf7938f5d6..5bc78d1b65 100644
--- a/lib/spack/spack/test/architecture.py
+++ b/lib/spack/spack/test/architecture.py
@@ -6,19 +6,58 @@ import os
import platform
import spack
from spack.architecture import *
+import spack.spec
from spack.platforms.cray_xc import CrayXc
from spack.platforms.linux import Linux
from spack.platforms.bgq import Bgq
from spack.platforms.darwin import Darwin
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):
+ d = spack.architecture.to_dict(self.architecture)
+ self.assertEquals(d, {'architecture':
+ {'platform' : {'name': 'crayxc'},
+ '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 = spack.architecture.to_dict(self.architecture)
+ # self.assertEquals(d['platform_os'], {'name': self.platform_os.name,
+ # 'version': self.platform_os.version,
+ # 'compiler_strategy': self.platform_os.compiler_strategy})
+
+ def test_architecture_from_dict(self):
+ pass
def test_platform_class_and_compiler_strategies(self):
a = CrayXc()
- t = a.target('default')
+ t = a.operating_system('default_os')
self.assertEquals(t.compiler_strategy, 'MODULES')
b = Linux()
- s = b.target('default')
+ s = b.operating_system('default_os')
self.assertEquals(s.compiler_strategy, 'PATH')
def test_sys_type(self):