aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-09-03 19:53:34 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-09-03 19:53:34 +0100
commit0b1d22f6aa8981ac079e3fabc2106010e4925589 (patch)
treec4dd6cb88b29ac8d0d3b0414a0c26f907df9a13c
parent572d4cdd84a8ac620f3f74a68fb669b8e4d61a35 (diff)
downloadpaludis-0b1d22f6aa8981ac079e3fabc2106010e4925589.tar.gz
paludis-0b1d22f6aa8981ac079e3fabc2106010e4925589.tar.xz
Get continue-on-failure for purges right
Fixes: ticket:1149
-rw-r--r--paludis/resolver/orderer.cc2
-rw-r--r--paludis/resolver/resolver_TEST_continue_on_failure.cc50
-rwxr-xr-xpaludis/resolver/resolver_TEST_continue_on_failure_setup.sh10
-rw-r--r--paludis/resolver/resolver_TEST_fetches.cc2
4 files changed, 58 insertions, 6 deletions
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 1f7381a..b4dd4ca 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -741,7 +741,7 @@ namespace
if (n != change_or_remove_job_numbers.end())
requirements->push_back(make_named_values<JobRequirement>(
n::job_number() = n->second,
- n::required_if() = basic_required_ifs + jri_require_for_satisfied
+ n::required_if() = basic_required_ifs + jri_require_for_satisfied + jri_require_for_independent
));
}
diff --git a/paludis/resolver/resolver_TEST_continue_on_failure.cc b/paludis/resolver/resolver_TEST_continue_on_failure.cc
index b5254cf..b99860a 100644
--- a/paludis/resolver/resolver_TEST_continue_on_failure.cc
+++ b/paludis/resolver/resolver_TEST_continue_on_failure.cc
@@ -144,7 +144,7 @@ namespace
EXPECT_EQ("4 satisfied independent always, 3 independent, 1 independent",
join(target_job->requirements()->begin(), target_job->requirements()->end(), ", ", stringify_req));
else
- EXPECT_EQ("4 satisfied independent always, 1 satisfied, 3 independent, 1 independent",
+ EXPECT_EQ("4 satisfied independent always, 1 satisfied independent, 3 independent, 1 independent",
join(target_job->requirements()->begin(), target_job->requirements()->end(), ", ", stringify_req));
}
};
@@ -201,14 +201,56 @@ TEST_F(ResolverContinueOnFailureTestCase, Uninstall)
const UninstallJob * const target_job(visitor_cast<const UninstallJob>(**resolved->job_lists()->execute_job_list()->fetch(1)));
ASSERT_TRUE(target_job);
- EXPECT_EQ("0 satisfied", join(target_job->requirements()->begin(), target_job->requirements()->end(), ", ", stringify_req));
+ EXPECT_EQ("0 satisfied independent", join(target_job->requirements()->begin(), target_job->requirements()->end(), ", ", stringify_req));
const UninstallJob * const dep_job(visitor_cast<const UninstallJob>(**resolved->job_lists()->execute_job_list()->fetch(2)));
ASSERT_TRUE(dep_job);
- EXPECT_EQ("1 satisfied", join(dep_job->requirements()->begin(), dep_job->requirements()->end(), ", ", stringify_req));
+ EXPECT_EQ("1 satisfied independent", join(dep_job->requirements()->begin(), dep_job->requirements()->end(), ", ", stringify_req));
const UninstallJob * const dep_of_dep_job(visitor_cast<const UninstallJob>(**resolved->job_lists()->execute_job_list()->fetch(3)));
ASSERT_TRUE(dep_of_dep_job);
- EXPECT_EQ("2 satisfied", join(dep_of_dep_job->requirements()->begin(), dep_of_dep_job->requirements()->end(), ", ", stringify_req));
+ EXPECT_EQ("2 satisfied independent", join(dep_of_dep_job->requirements()->begin(), dep_of_dep_job->requirements()->end(), ", ", stringify_req));
+}
+
+TEST_F(ResolverContinueOnFailureTestCase, Purge)
+{
+ data->install("continue-on-failure-purge", "target", "0")->build_dependencies_key()->set_from_string("continue-on-failure-purge/going");
+ data->install("continue-on-failure-purge", "going", "1");
+
+ data->get_constraints_for_purge_helper.add_purge_spec(parse_user_package_dep_spec("continue-on-failure-purge/going", &data->env, { }));
+ data->allowed_to_remove_helper.add_allowed_to_remove_spec(parse_user_package_dep_spec("continue-on-failure-purge/going", &data->env, { }));
+
+ std::shared_ptr<const Resolved> resolved(data->get_resolved("continue-on-failure-purge/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("continue-on-failure-purge/target"))
+ .remove(QualifiedPackageName("continue-on-failure-purge/going"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+
+ ASSERT_EQ(3, resolved->job_lists()->execute_job_list()->length());
+
+ const FetchJob * const fetch_target_job(visitor_cast<const FetchJob>(**resolved->job_lists()->execute_job_list()->fetch(0)));
+ ASSERT_TRUE(fetch_target_job);
+ EXPECT_EQ("", join(fetch_target_job->requirements()->begin(), fetch_target_job->requirements()->end(), ", ", stringify_req));
+
+ const InstallJob * const target_job(visitor_cast<const InstallJob>(**resolved->job_lists()->execute_job_list()->fetch(1)));
+ ASSERT_TRUE(target_job);
+ EXPECT_EQ("0 satisfied independent always", join(target_job->requirements()->begin(), target_job->requirements()->end(), ", ", stringify_req));
+
+ const UninstallJob * const going_job(visitor_cast<const UninstallJob>(**resolved->job_lists()->execute_job_list()->fetch(2)));
+ ASSERT_TRUE(going_job);
+ EXPECT_EQ("1 satisfied independent", join(going_job->requirements()->begin(), going_job->requirements()->end(), ", ", stringify_req));
}
diff --git a/paludis/resolver/resolver_TEST_continue_on_failure_setup.sh b/paludis/resolver/resolver_TEST_continue_on_failure_setup.sh
index ffa8f7c..75f39f8 100755
--- a/paludis/resolver/resolver_TEST_continue_on_failure_setup.sh
+++ b/paludis/resolver/resolver_TEST_continue_on_failure_setup.sh
@@ -52,5 +52,15 @@ PLATFORMS="test"
SLOT="0"
END
+# continue-on-failure-purge
+echo 'continue-on-failure-purge' >> metadata/categories.conf
+
+mkdir -p 'packages/continue-on-failure-purge/target'
+cat <<END > packages/continue-on-failure-purge/target/target-1.exheres-0
+SUMMARY="dep"
+PLATFORMS="test"
+SLOT="0"
+END
+
cd ..
diff --git a/paludis/resolver/resolver_TEST_fetches.cc b/paludis/resolver/resolver_TEST_fetches.cc
index cd25443..4528f8a 100644
--- a/paludis/resolver/resolver_TEST_fetches.cc
+++ b/paludis/resolver/resolver_TEST_fetches.cc
@@ -123,7 +123,7 @@ TEST_F(ResolverFetchTestCase, Fetch)
const FetchJob * const fetch_target_job(visitor_cast<const FetchJob>(**resolved->job_lists()->execute_job_list()->fetch(2)));
ASSERT_TRUE(fetch_target_job);
- EXPECT_EQ("1 satisfied, 1 independent",
+ EXPECT_EQ("1 satisfied independent, 1 independent",
join(fetch_target_job->requirements()->begin(), fetch_target_job->requirements()->end(), ", ", stringify_req));
const InstallJob * const target_job(visitor_cast<const InstallJob>(**resolved->job_lists()->execute_job_list()->fetch(3)));