ArchSpec: fix semantics of satisfies when not concrete and strict is true (#15319)
This commit is contained in:
parent
697719c181
commit
b444fd25bb
2 changed files with 17 additions and 0 deletions
|
@ -369,6 +369,10 @@ def _satisfies_target(self, other_target, strict):
|
||||||
if not need_to_check:
|
if not need_to_check:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# self is not concrete, but other_target is there and strict=True
|
||||||
|
if self.target is None:
|
||||||
|
return False
|
||||||
|
|
||||||
for target_range in str(other_target).split(','):
|
for target_range in str(other_target).split(','):
|
||||||
t_min, sep, t_max = target_range.partition(':')
|
t_min, sep, t_max = target_range.partition(':')
|
||||||
|
|
||||||
|
|
|
@ -214,3 +214,16 @@ def test_optimization_flags_with_custom_versions(
|
||||||
)
|
)
|
||||||
opt_flags = target.optimization_flags(compiler)
|
opt_flags = target.optimization_flags(compiler)
|
||||||
assert opt_flags == expected_flags
|
assert opt_flags == expected_flags
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.regression('15306')
|
||||||
|
@pytest.mark.parametrize('architecture_tuple,constraint_tuple', [
|
||||||
|
(('linux', 'ubuntu18.04', None), ('linux', None, 'x86_64')),
|
||||||
|
(('linux', 'ubuntu18.04', None), ('linux', None, 'x86_64:')),
|
||||||
|
])
|
||||||
|
def test_satisfy_strict_constraint_when_not_concrete(
|
||||||
|
architecture_tuple, constraint_tuple
|
||||||
|
):
|
||||||
|
architecture = spack.spec.ArchSpec(architecture_tuple)
|
||||||
|
constraint = spack.spec.ArchSpec(constraint_tuple)
|
||||||
|
assert not architecture.satisfies(constraint, strict=True)
|
||||||
|
|
Loading…
Reference in a new issue