Fixed failing unit tests

- Tests based on TestArchitecture
- Tests on non-buildable external
This commit is contained in:
Massimiliano Culpo 2020-09-30 20:48:57 +02:00 committed by Todd Gamblin
parent 2ea8bd0b19
commit c065245f14
2 changed files with 11 additions and 10 deletions

View File

@ -14,9 +14,9 @@ class Test(Platform):
if platform.system().lower() == 'darwin':
binary_formats = ['macho']
front_end = 'x86_64'
back_end = 'broadwell'
default = 'broadwell'
front_end = 'x86_64'
back_end = 'core2'
default = 'core2'
front_os = 'redhat6'
back_os = 'debian6'

View File

@ -99,9 +99,10 @@ def current_host(request, monkeypatch):
# this function is memoized, so clear its state for testing
spack.architecture.get_platform.cache.clear()
monkeypatch.setattr(spack.platforms.test.Test, 'default', cpu)
monkeypatch.setattr(spack.platforms.test.Test, 'front_end', cpu)
if not is_preference:
monkeypatch.setattr(archspec.cpu, 'host', lambda: target)
monkeypatch.setattr(spack.platforms.test.Test, 'default', cpu)
yield target
else:
with spack.config.override('packages:all', {'target': [cpu]}):
@ -380,13 +381,12 @@ def test_external_package_module(self):
assert spec['externalmodule'].compiler.satisfies('gcc')
def test_nobuild_package(self):
got_error = False
"""Test that a non-buildable package raise an error if no specs
in packages.yaml are compatible with the request.
"""
spec = Spec('externaltool%clang')
try:
with pytest.raises(spack.error.SpecError):
spec.concretize()
except spack.concretize.NoBuildError:
got_error = True
assert got_error
def test_external_and_virtual(self):
spec = Spec('externaltest')
@ -634,7 +634,7 @@ def test_adjusting_default_target_based_on_compiler(
else current_host
with spack.concretize.disable_compiler_existence_check():
s = Spec(spec).concretized()
assert str(s.architecture.target) == str(expected)
assert str(s.architecture.target) == str(expected), str(best_achievable)
@pytest.mark.regression('8735,14730')
def test_compiler_version_matches_any_entry_in_compilers_yaml(self):
@ -643,6 +643,7 @@ 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:')