summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Becker <becker33@llnl.gov>2021-01-05 12:27:13 -0800
committerGitHub <noreply@github.com>2021-01-05 12:27:13 -0800
commit61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a (patch)
treeafc50f3584e1b6e693d50c9a07e240f5686495db /lib
parent18110346c809e43e4a5438b6ff64778cb1683abc (diff)
downloadspack-61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a.tar.gz
spack-61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a.tar.bz2
spack-61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a.tar.xz
spack-61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a.zip
bugfix for target adjustments on target ranges (#20537)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/concretize.py19
-rw-r--r--lib/spack/spack/test/concretize.py11
-rw-r--r--lib/spack/spack/test/conftest.py5
3 files changed, 20 insertions, 15 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 83a9853b3c..f5c33e5974 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -578,10 +578,14 @@ class Concretizer(object):
True if spec was modified, False otherwise
"""
# To minimize the impact on performance this function will attempt
- # to adjust the target only at the very first call. It will just
- # return False on subsequent calls. The way this is achieved is by
- # initializing a generator and making this function return the next
- # answer.
+ # to adjust the target only at the very first call once necessary
+ # information is set. It will just return False on subsequent calls.
+ # The way this is achieved is by initializing a generator and making
+ # this function return the next answer.
+ if not (spec.architecture and spec.architecture.concrete):
+ # Not ready, but keep going because we have work to do later
+ return True
+
def _make_only_one_call(spec):
yield self._adjust_target(spec)
while True:
@@ -619,9 +623,10 @@ class Concretizer(object):
if PackagePrefs.has_preferred_targets(spec.name):
default_target = self.target_from_package_preferences(spec)
- if current_target != default_target or \
- (self.abstract_spec.architecture is not None and
- self.abstract_spec.architecture.target is not None):
+ if current_target != default_target or (
+ self.abstract_spec and
+ self.abstract_spec.architecture and
+ self.abstract_spec.architecture.concrete):
return False
try:
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 705019ac6e..91fb4e2f53 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -688,13 +688,14 @@ class TestConcretize(object):
with pytest.raises(spack.error.SpackError):
Spec(spec).concretized()
+ # Include targets to prevent regression on 20537
@pytest.mark.parametrize('spec, best_achievable', [
- ('mpileaks%gcc@4.4.7', 'core2'),
- ('mpileaks%gcc@4.8', 'haswell'),
- ('mpileaks%gcc@5.3.0', 'broadwell'),
- ('mpileaks%apple-clang@5.1.0', 'x86_64')
+ ('mpileaks%gcc@4.4.7 target=x86_64:', 'core2'),
+ ('mpileaks%gcc@4.8 target=x86_64:', 'haswell'),
+ ('mpileaks%gcc@5.3.0 target=x86_64:', 'broadwell'),
+ ('mpileaks%apple-clang@5.1.0 target=x86_64:', 'x86_64')
])
- @pytest.mark.regression('13361')
+ @pytest.mark.regression('13361', '20537')
def test_adjusting_default_target_based_on_compiler(
self, spec, best_achievable, current_host, mock_targets
):
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index c1ac1f61c7..938dd402b7 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -469,9 +469,8 @@ def mock_uarch_configuration(mock_uarch_json):
with open(mock_uarch_json) as f:
return json.load(f)
- targets_json = archspec.cpu.schema.LazyDictionary(load_json)
- targets = archspec.cpu.microarchitecture.LazyDictionary(
- archspec.cpu.microarchitecture._known_microarchitectures)
+ targets_json = load_json()
+ targets = archspec.cpu.microarchitecture._known_microarchitectures()
yield targets_json, targets