aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-05 18:49:01 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-05 18:49:01 +0000
commitcd5cd814e831d307dc437a684734bfe66adc78d6 (patch)
treeaac10776d999d04f6d0155a2810950f32adbe784
parent388d0d72a962154ee9633f5b84ea4c1f87b0e744 (diff)
downloadpaludis-cd5cd814e831d307dc437a684734bfe66adc78d6.tar.gz
paludis-cd5cd814e831d307dc437a684734bfe66adc78d6.tar.xz
Fix InternalError when deciding errors
-rw-r--r--.gitignore1
-rw-r--r--paludis/resolver/Makefile.am17
-rw-r--r--paludis/resolver/decider.cc4
-rw-r--r--paludis/resolver/resolver_TEST_errors.cc104
-rwxr-xr-xpaludis/resolver/resolver_TEST_errors_cleanup.sh9
-rwxr-xr-xpaludis/resolver/resolver_TEST_errors_setup.sh40
6 files changed, 172 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 351e2a0..925c86d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -323,6 +323,7 @@ paludis-*.*.*.tar.bz2
/paludis/resolver/resolver_TEST_any
/paludis/resolver/resolver_TEST_blockers
/paludis/resolver/resolver_TEST_cycles
+/paludis/resolver/resolver_TEST_errors
/paludis/resolver/resolver_TEST_serialisation
/paludis/resolver/resolver_TEST_simple
/paludis/resolver/resolver_TEST_suggestions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index 549d480..7b097a0 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -97,6 +97,7 @@ TESTS = \
resolver_TEST_cycles \
resolver_TEST_suggestions \
resolver_TEST_any \
+ resolver_TEST_errors \
$(virtuals_tests)
endif
@@ -109,7 +110,8 @@ check_SCRIPTS = \
resolver_TEST_suggestions_setup.sh resolver_TEST_suggestions_cleanup.sh \
resolver_TEST_simple_setup.sh resolver_TEST_simple_cleanup.sh \
resolver_TEST_virtuals_setup.sh resolver_TEST_virtuals_cleanup.sh \
- resolver_TEST_any_setup.sh resolver_TEST_any_cleanup.sh
+ resolver_TEST_any_setup.sh resolver_TEST_any_cleanup.sh \
+ resolver_TEST_errors_setup.sh resolver_TEST_errors_cleanup.sh
check_LIBRARIES = libpaludisresolvertest.a
libpaludisresolvertest_a_SOURCES = \
@@ -207,6 +209,19 @@ resolver_TEST_any_LDADD = \
resolver_TEST_any_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+resolver_TEST_errors_SOURCES = resolver_TEST_errors.cc
+
+resolver_TEST_errors_LDADD = \
+ libpaludisresolvertest.a \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/test/libtest.a \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ libpaludisresolver.a \
+ $(DYNAMIC_LD_LIBS)
+
+resolver_TEST_errors_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
use_existing-se.hh : use_existing.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/use_existing.se > $@ ; then rm -f $@ ; exit 1 ; fi
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 72350c6..dd6b4f7 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -495,9 +495,9 @@ namespace
return constraint.nothing_is_fine_too();
}
- bool visit(const UnableToMakeDecision &) const PALUDIS_ATTRIBUTE((noreturn))
+ bool visit(const UnableToMakeDecision &) const
{
- throw InternalError(PALUDIS_HERE, "huh?");
+ return true;
}
bool visit(const RemoveDecision &) const
diff --git a/paludis/resolver/resolver_TEST_errors.cc b/paludis/resolver/resolver_TEST_errors.cc
new file mode 100644
index 0000000..0721be9
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_errors.cc
@@ -0,0 +1,104 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/resolver/resolver.hh>
+#include <paludis/resolver/resolver_functions.hh>
+#include <paludis/resolver/resolution.hh>
+#include <paludis/resolver/decision.hh>
+#include <paludis/resolver/resolutions.hh>
+#include <paludis/resolver/constraint.hh>
+#include <paludis/resolver/resolvent.hh>
+#include <paludis/resolver/suggest_restart.hh>
+#include <paludis/resolver/resolver_lists.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/package_database.hh>
+
+#include <paludis/resolver/resolver_test.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+
+#include <list>
+#include <tr1/functional>
+#include <algorithm>
+#include <map>
+
+using namespace paludis;
+using namespace paludis::resolver;
+using namespace paludis::resolver::resolver_test;
+using namespace test;
+
+namespace
+{
+ struct ResolverErrorsTestCase : ResolverTestCase
+ {
+ ResolverErrorsTestCase(const std::string & s) :
+ ResolverTestCase("errors", s, "exheres-0", "exheres")
+ {
+ }
+ };
+}
+
+namespace test_cases
+{
+ struct TestUnableToDecideThenMore : ResolverErrorsTestCase
+ {
+ TestUnableToDecideThenMore() : ResolverErrorsTestCase("unable to decide then more") { }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const ResolverLists> resolutions(get_resolutions("unable-to-decide-then-more/target"));
+
+ {
+ TestMessageSuffix s("taken errors");
+ check_resolution_list(resolutions->jobs(), resolutions->taken_error_job_ids(), ResolutionListChecks()
+ .kind("unable_to_make_decision", QualifiedPackageName("unable-to-decide-then-more/pkg-a"))
+ .finished()
+ );
+ }
+
+ {
+ TestMessageSuffix s("untaken errors");
+ check_resolution_list(resolutions->jobs(), resolutions->untaken_error_job_ids(), ResolutionListChecks()
+ .finished()
+ );
+ }
+
+
+ {
+ TestMessageSuffix s("ordered");
+ check_resolution_list(resolutions->jobs(), resolutions->taken_job_ids(), ResolutionListChecks()
+ .qpn(QualifiedPackageName("unable-to-decide-then-more/pkg-b"))
+ .qpn(QualifiedPackageName("unable-to-decide-then-more/target"))
+ .finished()
+ );
+ }
+ }
+ } test_unable_to_decide_then_more;
+}
+
diff --git a/paludis/resolver/resolver_TEST_errors_cleanup.sh b/paludis/resolver/resolver_TEST_errors_cleanup.sh
new file mode 100755
index 0000000..4464ba0
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_errors_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d resolver_TEST_errors_dir ] ; then
+ rm -fr resolver_TEST_errors_dir
+else
+ true
+fi
+
diff --git a/paludis/resolver/resolver_TEST_errors_setup.sh b/paludis/resolver/resolver_TEST_errors_setup.sh
new file mode 100755
index 0000000..f8167a3
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_errors_setup.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir resolver_TEST_errors_dir || exit 1
+cd resolver_TEST_errors_dir || exit 1
+
+mkdir -p build
+mkdir -p distdir
+mkdir -p installed
+
+mkdir -p repo/{profiles/profile,metadata}
+
+cd repo
+echo "repo" > profiles/repo_name
+: > metadata/categories.conf
+
+# unable-to-decide-then-more
+echo 'unable-to-decide-then-more' >> metadata/categories.conf
+
+mkdir -p 'packages/unable-to-decide-then-more/target'
+cat <<END > packages/unable-to-decide-then-more/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ unable-to-decide-then-more/pkg-a
+ unable-to-decide-then-more/pkg-b"
+END
+
+mkdir -p 'packages/unable-to-decide-then-more/pkg-b'
+cat <<END > packages/unable-to-decide-then-more/pkg-b/pkg-b-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ unable-to-decide-then-more/pkg-a"
+END
+
+cd ..
+