Added test that works on every type of combination the user could possibly enter for arch spec

This commit is contained in:
Mario Melara 2016-04-08 11:17:56 -07:00
parent 0d1a1b7526
commit 277efc1dfb

View file

@ -65,8 +65,6 @@ def test_user_front_end_input(self):
""" """
frontend_os = self.platform.operating_system("frontend") frontend_os = self.platform.operating_system("frontend")
frontend_target = self.platform.target("frontend") frontend_target = self.platform.target("frontend")
print frontend_os
print frontend_target
frontend_spec = Spec("zlib=frontend") frontend_spec = Spec("zlib=frontend")
frontend_spec.concretize() frontend_spec.concretize()
self.assertEqual(frontend_os, frontend_spec.architecture.platform_os) self.assertEqual(frontend_os, frontend_spec.architecture.platform_os)
@ -78,8 +76,6 @@ def test_user_back_end_input(self):
""" """
backend_os = self.platform.operating_system("backend") backend_os = self.platform.operating_system("backend")
backend_target = self.platform.target("backend") backend_target = self.platform.target("backend")
print backend_os
print backend_target
backend_spec = Spec("zlib=backend") backend_spec = Spec("zlib=backend")
backend_spec.concretize() backend_spec.concretize()
self.assertEqual(backend_os, backend_spec.architecture.platform_os) self.assertEqual(backend_os, backend_spec.architecture.platform_os)
@ -94,5 +90,24 @@ def test_user_defaults(self):
self.assertEqual(default_os, default_spec.architecture.platform_os) self.assertEqual(default_os, default_spec.architecture.platform_os)
self.assertEqual(default_target, default_spec.architecture.target) self.assertEqual(default_target, default_spec.architecture.target)
def test_user_combination(self): def test_user_input_combination(self):
os_list = self.platform.operating_sys.keys()
target_list = self.platform.targets.keys()
additional = ["fe", "be", "frontend", "backend"]
os_list.extend(additional)
target_list.extend(additional)
combinations = itertools.product(os_list, target_list)
results = []
for arch in combinations:
o,t = arch
arch_spec = "-".join(arch)
spec = Spec("zlib=%s" % arch_spec)
spec.concretize()
results.append(spec.architecture.platform_os == self.platform.operating_system(o))
results.append(spec.architecture.target == self.platform.target(t))
res = all(results)
print res
self.assertTrue(res)