summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-03-07 13:58:33 +0100
committerGitHub <noreply@github.com>2020-03-07 13:58:33 +0100
commitb444fd25bbcde92949d88b5f912393bfa0c821a5 (patch)
tree617da997aa52860b8208b51da062cbb1c49b9996 /lib
parent697719c1811c2f47b8e032f6106f9e2faee34abd (diff)
downloadspack-b444fd25bbcde92949d88b5f912393bfa0c821a5.tar.gz
spack-b444fd25bbcde92949d88b5f912393bfa0c821a5.tar.bz2
spack-b444fd25bbcde92949d88b5f912393bfa0c821a5.tar.xz
spack-b444fd25bbcde92949d88b5f912393bfa0c821a5.zip
ArchSpec: fix semantics of satisfies when not concrete and strict is true (#15319)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py4
-rw-r--r--lib/spack/spack/test/architecture.py13
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 1493f0c973..718b5ef14d 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -369,6 +369,10 @@ class ArchSpec(object):
if not need_to_check:
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(','):
t_min, sep, t_max = target_range.partition(':')
diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py
index 1f5ff28900..552bc324bf 100644
--- a/lib/spack/spack/test/architecture.py
+++ b/lib/spack/spack/test/architecture.py
@@ -214,3 +214,16 @@ def test_optimization_flags_with_custom_versions(
)
opt_flags = target.optimization_flags(compiler)
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)