Fix InternalError when deciding errors
This commit is contained in:
parent
388d0d72a9
commit
cd5cd814e8
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
104
paludis/resolver/resolver_TEST_errors.cc
Normal file
104
paludis/resolver/resolver_TEST_errors.cc
Normal file
@ -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;
|
||||
}
|
||||
|
9
paludis/resolver/resolver_TEST_errors_cleanup.sh
Executable file
9
paludis/resolver/resolver_TEST_errors_cleanup.sh
Executable file
@ -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
|
||||
|
40
paludis/resolver/resolver_TEST_errors_setup.sh
Executable file
40
paludis/resolver/resolver_TEST_errors_setup.sh
Executable file
@ -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 ..
|
||||
|
Loading…
Reference in New Issue
Block a user