summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/concretize.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/test/concretize.py')
-rw-r--r--lib/spack/spack/test/concretize.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 9715568c06..fae852edf8 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -1357,3 +1357,21 @@ class TestConcretize(object):
s = spack.spec.Spec(spec_str).concretized(reuse=True)
assert s.package.installed is expect_installed
assert s.satisfies(spec_str, strict=True)
+
+ @pytest.mark.regression('26721,19736')
+ def test_sticky_variant_in_package(self):
+ if spack.config.get('config:concretizer') == 'original':
+ pytest.skip('Original concretizer cannot use sticky variants')
+
+ # Here we test that a sticky variant cannot be changed from its default value
+ # by the ASP solver if not set explicitly. The package used in the test needs
+ # to have +allow-gcc set to be concretized with %gcc and clingo is not allowed
+ # to change the default ~allow-gcc
+ with pytest.raises(spack.error.SpackError):
+ spack.spec.Spec('sticky-variant %gcc').concretized()
+
+ s = spack.spec.Spec('sticky-variant+allow-gcc %gcc').concretized()
+ assert s.satisfies('%gcc') and s.satisfies('+allow-gcc')
+
+ s = spack.spec.Spec('sticky-variant %clang').concretized()
+ assert s.satisfies('%clang') and s.satisfies('~allow-gcc')