summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-10-27 07:39:08 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit8b055ac8d8a1d88ed6db7610f6a425db9ed46653 (patch)
treed416167beff326f1a1142f5b60da6a686053c4aa /lib
parentc0474959819e26227f0ebbc8e30bea33dbbbf9b7 (diff)
downloadspack-8b055ac8d8a1d88ed6db7610f6a425db9ed46653.tar.gz
spack-8b055ac8d8a1d88ed6db7610f6a425db9ed46653.tar.bz2
spack-8b055ac8d8a1d88ed6db7610f6a425db9ed46653.tar.xz
spack-8b055ac8d8a1d88ed6db7610f6a425db9ed46653.zip
Fixed failing unit tests
- The test on concretization of anonymous dependencies has been fixed by raising the expected exception. - The test on compiler bootstrap has been fixed by updating the version of GCC used in the test. Since gcc@2.0 does not support targets later than x86_64, the new concretizer was looking for a non-existing spec, i.e. it was correctly trying to retrieve 'gcc target=x86_64' instead of 'gcc target=core2'. - The test on gitlab CI needed an update of the target
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py11
-rw-r--r--lib/spack/spack/test/cmd/ci.py2
-rw-r--r--lib/spack/spack/test/cmd/install.py14
-rw-r--r--lib/spack/spack/test/concretize.py12
-rw-r--r--lib/spack/spack/test/spec_semantics.py2
-rw-r--r--lib/spack/spack/test/spec_syntax.py6
6 files changed, 27 insertions, 20 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 935c5da9cd..5689bf4861 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -199,8 +199,15 @@ def check_packages_exist(specs):
repo = spack.repo.path
for spec in specs:
for s in spec.traverse():
- if not (repo.exists(s.name) or repo.is_virtual(s.name)):
- raise spack.repo.UnknownPackageError(s.name)
+ try:
+ check_passed = repo.exists(s.name) or repo.is_virtual(s.name)
+ except Exception as e:
+ msg = 'Cannot find package: {0}'.format(str(e))
+ check_passed = False
+ tty.debug(msg)
+
+ if not check_passed:
+ raise spack.error.SpecError(str(s.name))
class Result(object):
diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py
index 82734c922a..4d8468c66c 100644
--- a/lib/spack/spack/test/cmd/ci.py
+++ b/lib/spack/spack/test/cmd/ci.py
@@ -135,7 +135,7 @@ spack:
compiler-agnostic: true
mappings:
- match:
- - arch=test-debian6-x86_64
+ - arch=test-debian6-core2
runner-attributes:
tags:
- donotcare
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py
index 0ba8e6a7c6..93b1bc2eae 100644
--- a/lib/spack/spack/test/cmd/install.py
+++ b/lib/spack/spack/test/cmd/install.py
@@ -754,18 +754,20 @@ def test_compiler_bootstrap_from_binary_mirror(
mirror_url = 'file://{0}'.format(mirror_dir.strpath)
# Install a compiler, because we want to put it in a buildcache
- install('gcc@2.0')
+ install('gcc@10.2.0')
# Put installed compiler in the buildcache
- buildcache('create', '-u', '-a', '-f', '-d', mirror_dir.strpath, 'gcc@2.0')
+ buildcache(
+ 'create', '-u', '-a', '-f', '-d', mirror_dir.strpath, 'gcc@10.2.0'
+ )
# Now uninstall the compiler
- uninstall('-y', 'gcc@2.0')
+ uninstall('-y', 'gcc@10.2.0')
monkeypatch.setattr(spack.concretize.Concretizer,
'check_for_compiler_existence', False)
spack.config.set('config:install_missing_compilers', True)
- assert CompilerSpec('gcc@2.0') not in compilers.all_compiler_specs()
+ assert CompilerSpec('gcc@10.2.0') not in compilers.all_compiler_specs()
# Configure the mirror where we put that buildcache w/ the compiler
mirror('add', 'test-mirror', mirror_url)
@@ -774,8 +776,8 @@ def test_compiler_bootstrap_from_binary_mirror(
# it also gets configured as a compiler. Test succeeds if it does not
# raise an error
install('--no-check-signature', '--cache-only', '--only',
- 'dependencies', 'b%gcc@2.0')
- install('--no-cache', '--only', 'package', 'b%gcc@2.0')
+ 'dependencies', 'b%gcc@10.2.0')
+ install('--no-cache', '--only', 'package', 'b%gcc@10.2.0')
@pytest.mark.regression('16221')
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index dccc9a8056..d2866697f5 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -643,7 +643,6 @@ class TestConcretize(object):
with pytest.raises(spack.concretize.UnavailableCompilerVersionError):
s = Spec('mpileaks %gcc@4.5')
s.concretize()
- pass
# An abstract compiler with a version list could resolve to 4.5.0
s = Spec('mpileaks %gcc@4.5:')
@@ -655,11 +654,10 @@ class TestConcretize(object):
s = Spec('+variant')
s.concretize()
- def test_concretize_anonymous_dep(self):
- with pytest.raises(spack.error.SpecError):
- s = Spec('mpileaks ^%gcc')
- s.concretize()
-
+ @pytest.mark.parametrize('spec_str', [
+ 'mpileaks ^%gcc', 'mpileaks ^cflags=-g'
+ ])
+ def test_concretize_anonymous_dep(self, spec_str):
with pytest.raises(spack.error.SpecError):
- s = Spec('mpileaks ^cflags=-g')
+ s = Spec(spec_str)
s.concretize()
diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py
index 330a1d7a0a..b2161d4a0e 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -965,7 +965,7 @@ class TestSpecSematics(object):
with pytest.raises(SpecError):
spec.prefix
- def test_forwarding_of_architecture_attributes(self, mock_targets):
+ def test_forwarding_of_architecture_attributes(self):
spec = Spec('libelf target=x86_64').concretized()
# Check that we can still access each member through
diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py
index b0de1b3e69..edfe73f3e5 100644
--- a/lib/spack/spack/test/spec_syntax.py
+++ b/lib/spack/spack/test/spec_syntax.py
@@ -243,7 +243,7 @@ class TestSpecSyntax(object):
self.check_parse(
"x arch=test-redhat6-None"
- " ^y arch=test-None-x86_64"
+ " ^y arch=test-None-core2"
" ^z arch=linux-None-None",
"x os=fe "
@@ -251,8 +251,8 @@ class TestSpecSyntax(object):
"^z platform=linux")
self.check_parse(
- "x arch=test-debian6-x86_64"
- " ^y arch=test-debian6-x86_64",
+ "x arch=test-debian6-core2"
+ " ^y arch=test-debian6-core2",
"x os=default_os target=default_target"
" ^y os=default_os target=default_target")