summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-10-09 23:32:27 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-10 16:22:38 -0700
commit77444dff106524b0b33f664e5fe1f4512ec511d7 (patch)
tree6bd2880994aef513fbe9ee2eee3a6c5c0088e936 /lib
parent7af8c206ace3e6fd99bef11501e1def601bbdd78 (diff)
downloadspack-77444dff106524b0b33f664e5fe1f4512ec511d7.tar.gz
spack-77444dff106524b0b33f664e5fe1f4512ec511d7.tar.bz2
spack-77444dff106524b0b33f664e5fe1f4512ec511d7.tar.xz
spack-77444dff106524b0b33f664e5fe1f4512ec511d7.zip
ArchSpec: fix constraint satisfaction for targets
fixes #13111 Due to a missing case we were treating a single target that was not equal to the one we were comparing to as a range open on the right.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py4
-rw-r--r--lib/spack/spack/test/spec_semantics.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 99246ebb02..0cde672de2 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -395,6 +395,10 @@ class ArchSpec(object):
if not sep and self_target == t_min:
return True
+ if not sep and self_target != t_min:
+ return False
+
+ # Check against a range
min_ok = self_target.microarchitecture >= t_min if t_min else True
max_ok = self_target.microarchitecture <= t_max if t_max else True
diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py
index 0c52bd1c10..a183742e65 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -972,7 +972,12 @@ class TestSpecSematics(object):
('libelf target=haswell', 'target=:haswell', True),
('libelf target=haswell', 'target=icelake,:nocona', False),
('libelf target=haswell', 'target=haswell,:nocona', True),
+ # Check that a single target is not treated as the start
+ # or the end of an open range
+ ('libelf target=haswell', 'target=x86_64', False),
+ ('libelf target=x86_64', 'target=haswell', False),
])
+ @pytest.mark.regression('13111')
def test_target_constraints(self, spec, constraint, expected_result):
s = Spec(spec)
assert s.satisfies(constraint) is expected_result