ASP-based solver: assign OS correctly with inheritance from parent (#22896)

fixes #22871

When in presence of multiple choices for the operating system
we were lacking a rule to derive the node OS if it was
inherited.
This commit is contained in:
Massimiliano Culpo 2021-04-11 09:01:09 +02:00 committed by Todd Gamblin
parent 5546b22c70
commit 2655e21bd0
3 changed files with 28 additions and 0 deletions

View file

@ -472,6 +472,8 @@ node_os_inherit(Dependency, OS)
not node_os_set(Dependency). not node_os_set(Dependency).
node_os_inherit(Package) :- node_os_inherit(Package, _). node_os_inherit(Package) :- node_os_inherit(Package, _).
node_os(Package, OS) :- node_os_inherit(Package, OS).
% fall back to default if not set or inherited % fall back to default if not set or inherited
node_os(Package, OS) node_os(Package, OS)
:- node(Package), :- node(Package),

View file

@ -1155,3 +1155,19 @@ def test_external_with_non_default_variant_as_dependency(self):
assert '~foo' in s['external-non-default-variant'] assert '~foo' in s['external-non-default-variant']
assert '~bar' in s['external-non-default-variant'] assert '~bar' in s['external-non-default-variant']
assert s['external-non-default-variant'].external assert s['external-non-default-variant'].external
@pytest.mark.regression('22871')
@pytest.mark.parametrize('spec_str,expected_os', [
('mpileaks', 'os=debian6'),
# To trigger the bug in 22871 we need to have the same compiler
# spec available on both operating systems
('mpileaks%gcc@4.5.0 platform=test os=debian6', 'os=debian6'),
('mpileaks%gcc@4.5.0 platform=test os=redhat6', 'os=redhat6')
])
def test_os_selection_when_multiple_choices_are_possible(
self, spec_str, expected_os
):
s = Spec(spec_str).concretized()
for node in s.traverse():
assert node.satisfies(expected_os)

View file

@ -19,6 +19,16 @@ compilers:
fc: None fc: None
modules: 'None' modules: 'None'
target: x86_64 target: x86_64
- compiler:
spec: gcc@4.5.0
operating_system: redhat6
paths:
cc: /path/to/gcc
cxx: /path/to/g++
f77: None
fc: None
modules: 'None'
target: x86_64
- compiler: - compiler:
spec: clang@3.3 spec: clang@3.3
operating_system: CNL operating_system: CNL