diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_resolver.cc | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/tests/test_resolver.cc b/tests/test_resolver.cc index 778a9ec8..d4bc8ce9 100644 --- a/tests/test_resolver.cc +++ b/tests/test_resolver.cc @@ -409,7 +409,47 @@ private: catch(NoMoreSolutions) { LOG_TRACE(logger, "Success: only one solution was found."); - return; + + r.mandate_version(b.version_from_name("v2")); + + try + { + sol = r.find_next_solution(1000, NULL); + LOG_TRACE(logger, "Got another solution after a second mandate: " << sol); + + choice_set expected_solution2; + expected_solution2.insert_or_narrow(choice::make_install_version(b.version_from_name("v2"), 0)); + assertSameEffect(expected_solution2, sol.get_choices()); + } + catch(NoMoreSolutions) + { + LOG_ERROR(logger, "Mandating a second solution didn't cancel the first mandate."); + CPPUNIT_FAIL("Mandating a second solution didn't cancel the first mandate."); + } + + try + { + sol = r.find_next_solution(1000, NULL); + LOG_ERROR(logger, "Got an extra solution: " << sol); + CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated."); + } + catch(NoMoreSolutions) + { + try + { + dep av1d1 = *a.version_from_name("v1").deps_begin(); + r.harden(av1d1); + r.unharden(av1d1); + + sol = r.find_next_solution(1000, NULL); + LOG_ERROR(logger, "Got an extra solution: " << sol); + CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated, and after breaking the dep was rejected and unrejected."); + } + catch(NoMoreSolutions) + { + return; + } + } } LOG_ERROR(logger, "Found an unexpected solution: " << sol); @@ -456,7 +496,48 @@ private: catch(NoMoreSolutions) { LOG_TRACE(logger, "Success: only one solution was found."); - return; + + + r.mandate_version(b.version_from_name("v2")); + + try + { + sol = r.find_next_solution(1000, NULL); + LOG_TRACE(logger, "Got another solution after a second mandate: " << sol); + + choice_set expected_solution2; + expected_solution2.insert_or_narrow(choice::make_install_version(b.version_from_name("v2"), 0)); + assertSameEffect(expected_solution2, sol.get_choices()); + } + catch(NoMoreSolutions) + { + LOG_ERROR(logger, "Mandating a second solution didn't cancel the first mandate."); + CPPUNIT_FAIL("Mandating a second solution didn't cancel the first mandate."); + } + + try + { + sol = r.find_next_solution(1000, NULL); + LOG_ERROR(logger, "Got an extra solution: " << sol); + CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated."); + } + catch(NoMoreSolutions) + { + try + { + version bv3(b.version_from_name("v3")); + r.reject_version(bv3); + r.unreject_version(bv3); + + sol = r.find_next_solution(1000, NULL); + LOG_ERROR(logger, "Got an extra solution: " << sol); + CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated, and after a version was rejected and unrejected."); + } + catch(NoMoreSolutions) + { + return; + } + } } LOG_ERROR(logger, "Found an unexpected solution: " << sol); |