summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Melara <maamelara@gmail.com>2016-06-18 10:51:38 -0700
committerMario Melara <maamelara@gmail.com>2016-06-18 10:51:38 -0700
commit15e6b88a8b5f1e7ae1d06b4b4edc1126b4d68420 (patch)
tree49f32685f222a60e612fb00398a8923850096265
parent36275f8e6eec5b7238e17743a3ec9a2aff371941 (diff)
downloadspack-15e6b88a8b5f1e7ae1d06b4b4edc1126b4d68420.tar.gz
spack-15e6b88a8b5f1e7ae1d06b4b4edc1126b4d68420.tar.bz2
spack-15e6b88a8b5f1e7ae1d06b4b4edc1126b4d68420.tar.xz
spack-15e6b88a8b5f1e7ae1d06b4b4edc1126b4d68420.zip
Adding new tests for compiler command for spack's test suite
-rw-r--r--lib/spack/spack/test/cmd/test_compiler_cmd.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/spack/spack/test/cmd/test_compiler_cmd.py b/lib/spack/spack/test/cmd/test_compiler_cmd.py
new file mode 100644
index 0000000000..81bc7aacf2
--- /dev/null
+++ b/lib/spack/spack/test/cmd/test_compiler_cmd.py
@@ -0,0 +1,34 @@
+import spack.spec
+import spack.cmd.compiler
+import spack.compilers
+from spack.test.mock_packages_test import *
+
+
+class MockArgs(object):
+ def __init__(self, add_paths=[], scope=None, compiler_spec=None, all=None):
+ self.add_paths = add_paths
+ self.scope = scope
+ self.compiler_spec = compiler_spec
+ self.all = all
+
+
+class CompilerCmdTest(MockPackagesTest):
+ """ Test compiler commands for add and remove """
+
+ def test_compiler_remove(self):
+ args = MockArgs(all=True, compiler_spec='gcc@4.5.0')
+ spack.cmd.compiler.compiler_remove(args)
+ compilers = spack.compilers.all_compilers()
+ self.assertTrue(spack.spec.CompilerSpec("gcc@4.5.0") not in compilers)
+
+ def test_compiler_add(self):
+ # Probably not a good a assumption but might try finding local
+ # compilers
+ # installed in /usr
+ compilers = spack.compilers.all_compilers()
+ s = set(compilers)
+ args = MockArgs(add_paths=["/usr"])
+ spack.cmd.compiler.compiler_find(args)
+ new_compilers = spack.compilers.all_compilers()
+ new_compiler = [x for x in new_compilers if x not in s]
+ self.assertTrue(new_compiler)