diff options
author | Greg Becker <becker33@llnl.gov> | 2021-01-05 12:27:13 -0800 |
---|---|---|
committer | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2021-05-21 18:05:42 +0200 |
commit | 095ace90287e065c37daaca549d4de6f34b5674d (patch) | |
tree | af7bf37c0681bf08d6ba23410fec243891b9b4a1 /lib | |
parent | f30fc6cd33c8c201c80dd5d424d923d579f5e39b (diff) | |
download | spack-095ace90287e065c37daaca549d4de6f34b5674d.tar.gz spack-095ace90287e065c37daaca549d4de6f34b5674d.tar.bz2 spack-095ace90287e065c37daaca549d4de6f34b5674d.tar.xz spack-095ace90287e065c37daaca549d4de6f34b5674d.zip |
bugfix for target adjustments on target ranges (#20537)
(cherry picked from commit 61c1b71d38e62a5af81b3b7b8a8d12b954d99f0a)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/concretize.py | 19 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 11 | ||||
-rw-r--r-- | lib/spack/spack/test/conftest.py | 5 |
3 files changed, 20 insertions, 15 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index 3c3801bf5b..7e180eb91e 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 e5eaa7b7fb..2220ab9eb4 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 5b1e7b83e6..18a7924c9e 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -434,9 +434,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 |