diff options
-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 |