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
This commit is contained in:
Massimiliano Culpo 2020-10-27 07:39:08 +01:00 committed by Todd Gamblin
parent c047495981
commit 8b055ac8d8
6 changed files with 27 additions and 20 deletions

View File

@ -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):

View File

@ -135,7 +135,7 @@ def test_ci_generate_with_env(tmpdir, mutable_mock_env_path, env_deactivate,
compiler-agnostic: true
mappings:
- match:
- arch=test-debian6-x86_64
- arch=test-debian6-core2
runner-attributes:
tags:
- donotcare

View File

@ -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')

View File

@ -643,7 +643,6 @@ def test_compiler_version_matches_any_entry_in_compilers_yaml(self):
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 @@ def test_concretize_anonymous(self):
s = Spec('+variant')
s.concretize()
def test_concretize_anonymous_dep(self):
@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 ^%gcc')
s.concretize()
with pytest.raises(spack.error.SpecError):
s = Spec('mpileaks ^cflags=-g')
s = Spec(spec_str)
s.concretize()

View File

@ -965,7 +965,7 @@ def test_abstract_spec_prefix_error(self):
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

View File

@ -243,7 +243,7 @@ def test_canonicalize(self):
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 @@ def test_canonicalize(self):
"^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")