Skip to content

Commit b25ca92

Browse files
committed
Ensure conditional possible values play well with conditional variants
1 parent 15633cd commit b25ca92

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

lib/spack/spack/test/concretize.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,9 +1409,22 @@ def test_do_not_invent_new_concrete_versions_unless_necessary(self):
14091409
def test_conditional_values_in_variants(self, spec_str):
14101410
if spack.config.get('config:concretizer') == 'original':
14111411
pytest.skip(
1412-
"Original concretizer doesn't resolve concrete versions to known ones"
1412+
"Original concretizer doesn't resolve conditional values in variants"
14131413
)
14141414

14151415
s = Spec(spec_str)
14161416
with pytest.raises((RuntimeError, spack.error.UnsatisfiableSpecError)):
14171417
s.concretize()
1418+
1419+
def test_conditional_values_in_conditional_variant(self):
1420+
"""Test that conditional variants play well with conditional possible values"""
1421+
if spack.config.get('config:concretizer') == 'original':
1422+
pytest.skip(
1423+
"Original concretizer doesn't resolve conditional values in variants"
1424+
)
1425+
1426+
s = Spec('[email protected]').concretized()
1427+
assert 'cxxstd' not in s.variants
1428+
1429+
s = Spec('[email protected]').concretized()
1430+
assert 'cxxstd' in s.variants

var/spack/repos/builtin.mock/packages/conditional-values-in-variant/package.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#
44
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55
class ConditionalValuesInVariant(Package):
6-
"""Mimic the real netlib-lapack, that may be built on top of an
7-
optimized blas.
8-
"""
6+
"""Package with conditional possible values in a variant"""
97
homepage = "https://dev.null"
108

119
version('1.73.0')
1210
version('1.72.0')
1311
version('1.62.0')
12+
version('1.60.0')
13+
version('1.50.0')
1414

1515
variant(
1616
'cxxstd', default='98',
@@ -22,5 +22,6 @@ class ConditionalValuesInVariant(Package):
2222
Value('2a', when='@1.73.0:')
2323
),
2424
multi=False,
25-
description='Use the specified C++ standard when building.'
25+
description='Use the specified C++ standard when building.',
26+
when='@1.60.0:'
2627
)

0 commit comments

Comments
 (0)