summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-01-12 15:42:11 +0100
committerTamara Dahlgren <dahlgren1@llnl.gov>2021-02-17 17:07:43 -0800
commit488a08b4642db9d7519b35d915c3959e44fbb7b7 (patch)
tree243568e29971e4a48acee98b2ff5755557db97b2 /lib
parent7162e155314ce93f6a1ed28b0ea5cb06b53d1442 (diff)
downloadspack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.gz
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.bz2
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.xz
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.zip
concretizer: require at least a dependency type to say the dependency holds
fixes #20784 Similarly to the previous bug, here we were deducing conditions to be imposed on nodes that were not part of the DAG.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/concretize.lp3
-rw-r--r--lib/spack/spack/test/concretize.py8
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 938f4ece89..d0174ca2e0 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -88,6 +88,9 @@ dependency_conditions_hold(ID, Parent, Dependency) :-
attr(Name, Arg1, Arg2) : required_dependency_condition(ID, Name, Arg1, Arg2);
attr(Name, Arg1, Arg2, Arg3) : required_dependency_condition(ID, Name, Arg1, Arg2, Arg3);
dependency_condition(ID, Parent, Dependency);
+ % There must be at least a dependency type declared,
+ % otherwise the dependency doesn't hold
+ dependency_type(ID, _);
node(Parent);
not external(Parent).
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 3eab265d8c..dae162a12f 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -1089,3 +1089,11 @@ class TestConcretize(object):
).concretized()
assert root.dag_hash() == new_root.dag_hash()
+
+ @pytest.mark.regression('20784')
+ def test_concretization_of_test_dependencies(self):
+ # With clingo we emit dependency_conditions regardless of the type
+ # of the dependency. We need to ensure that there's at least one
+ # dependency type declared to infer that the dependency holds.
+ s = Spec('test-dep-with-imposed-conditions').concretized()
+ assert 'c' not in s