summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/solver/asp.py24
-rw-r--r--lib/spack/spack/test/concretize.py11
2 files changed, 33 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index c1c3cb33a9..4ad05cd9bf 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -366,6 +366,19 @@ class Result(object):
string_list.extend(self.format_core(core))
return string_list
+ def format_cores(self):
+ """List of facts for each core
+
+ Separate cores are separated by an empty line
+ Cores are not minimized
+ """
+ string_list = []
+ for core in self.cores:
+ if string_list:
+ string_list.append('\n')
+ string_list.extend(self.format_core(core))
+ return string_list
+
def raise_if_unsat(self):
"""
Raise an appropriate error if the result is unsatisfiable.
@@ -379,7 +392,9 @@ class Result(object):
constraints = self.abstract_specs
if len(constraints) == 1:
constraints = constraints[0]
- conflicts = self.format_minimal_cores()
+
+ debug = spack.config.get('config:debug', False)
+ conflicts = self.format_cores() if debug else self.format_minimal_cores()
raise spack.error.UnsatisfiableSpecError(constraints, conflicts=conflicts)
@@ -496,7 +511,12 @@ class PyclingoDriver(object):
self.out.write("%s.\n" % str(symbol))
atom = self.backend.add_atom(symbol)
- choice = self.cores and assumption
+
+ # in debug mode, make all facts choices/assumptions
+ # otherwise, only if we're generating cores and assumption=True
+ debug = spack.config.get('config:debug', False)
+ choice = debug or (self.cores and assumption)
+
self.backend.add_rule([atom], [], choice=choice)
if choice:
self.assumptions.append(atom)
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 54d886a55b..5e9188b888 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -557,6 +557,17 @@ class TestConcretize(object):
with pytest.raises(spack.error.SpackError):
s.concretize()
+ def test_conflicts_new_concretizer_debug(self, conflict_spec, mutable_config):
+ if spack.config.get('config:concretizer') == 'original':
+ pytest.skip('Testing debug statements specific to new concretizer')
+
+ spack.config.set('config:debug', True)
+ s = Spec(conflict_spec)
+ with pytest.raises(spack.error.SpackError) as e:
+ s.concretize()
+
+ assert "conflict_trigger(" in e.value.message
+
def test_conflict_in_all_directives_true(self):
s = Spec('when-directives-true')
with pytest.raises(spack.error.SpackError):