bugfix for target adjustments on target ranges (#20537)
This commit is contained in:
parent
18110346c8
commit
61c1b71d38
@ -578,10 +578,14 @@ def adjust_target(self, spec):
|
|||||||
True if spec was modified, False otherwise
|
True if spec was modified, False otherwise
|
||||||
"""
|
"""
|
||||||
# To minimize the impact on performance this function will attempt
|
# To minimize the impact on performance this function will attempt
|
||||||
# to adjust the target only at the very first call. It will just
|
# to adjust the target only at the very first call once necessary
|
||||||
# return False on subsequent calls. The way this is achieved is by
|
# information is set. It will just return False on subsequent calls.
|
||||||
# initializing a generator and making this function return the next
|
# The way this is achieved is by initializing a generator and making
|
||||||
# answer.
|
# 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):
|
def _make_only_one_call(spec):
|
||||||
yield self._adjust_target(spec)
|
yield self._adjust_target(spec)
|
||||||
while True:
|
while True:
|
||||||
@ -619,9 +623,10 @@ def _adjust_target(self, spec):
|
|||||||
if PackagePrefs.has_preferred_targets(spec.name):
|
if PackagePrefs.has_preferred_targets(spec.name):
|
||||||
default_target = self.target_from_package_preferences(spec)
|
default_target = self.target_from_package_preferences(spec)
|
||||||
|
|
||||||
if current_target != default_target or \
|
if current_target != default_target or (
|
||||||
(self.abstract_spec.architecture is not None and
|
self.abstract_spec and
|
||||||
self.abstract_spec.architecture.target is not None):
|
self.abstract_spec.architecture and
|
||||||
|
self.abstract_spec.architecture.concrete):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -688,13 +688,14 @@ def test_noversion_pkg(self, spec):
|
|||||||
with pytest.raises(spack.error.SpackError):
|
with pytest.raises(spack.error.SpackError):
|
||||||
Spec(spec).concretized()
|
Spec(spec).concretized()
|
||||||
|
|
||||||
|
# Include targets to prevent regression on 20537
|
||||||
@pytest.mark.parametrize('spec, best_achievable', [
|
@pytest.mark.parametrize('spec, best_achievable', [
|
||||||
('mpileaks%gcc@4.4.7', 'core2'),
|
('mpileaks%gcc@4.4.7 target=x86_64:', 'core2'),
|
||||||
('mpileaks%gcc@4.8', 'haswell'),
|
('mpileaks%gcc@4.8 target=x86_64:', 'haswell'),
|
||||||
('mpileaks%gcc@5.3.0', 'broadwell'),
|
('mpileaks%gcc@5.3.0 target=x86_64:', 'broadwell'),
|
||||||
('mpileaks%apple-clang@5.1.0', 'x86_64')
|
('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(
|
def test_adjusting_default_target_based_on_compiler(
|
||||||
self, spec, best_achievable, current_host, mock_targets
|
self, spec, best_achievable, current_host, mock_targets
|
||||||
):
|
):
|
||||||
|
@ -469,9 +469,8 @@ def load_json():
|
|||||||
with open(mock_uarch_json) as f:
|
with open(mock_uarch_json) as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
targets_json = archspec.cpu.schema.LazyDictionary(load_json)
|
targets_json = load_json()
|
||||||
targets = archspec.cpu.microarchitecture.LazyDictionary(
|
targets = archspec.cpu.microarchitecture._known_microarchitectures()
|
||||||
archspec.cpu.microarchitecture._known_microarchitectures)
|
|
||||||
|
|
||||||
yield targets_json, targets
|
yield targets_json, targets
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user