From 4fc6affafafda1aee4cee86294ce7a2b799e2799 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 19 May 2024 19:32:05 +0200 Subject: edsp: solver3: Show some progress Ignore the Solving dependencies... line in the testing framework for compatibility with the existing test cases. --- test/integration/framework | 1 + 1 file changed, 1 insertion(+) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index 98fd7710a..d2ab0d1cd 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1554,6 +1554,7 @@ cleanup_output() { cat "$1" | sed \ -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ -e '/^profiling:/ d' \ + -e '/Solving dependencies\.\.\./ d' \ | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ >"$2" } -- cgit v1.2.3-70-g09d2 From 67a8a6470ddb8a603db02c5fab84aa225dc00f8d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 24 May 2024 13:42:11 +0200 Subject: solver3: Implement APT::Solver::RemoveManual to allow removing manual packages This is mostly going to be useful for the test suite for now, implement a function there to set it up so we can use it to improve test suite correctness. --- apt-pkg/solver3.cc | 7 +++++-- doc/examples/configure-index | 1 + test/integration/framework | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'test/integration/framework') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index d43bd5b33..ab66c9501 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -853,6 +853,7 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) bool KeepAuto = not _config->FindB("APT::Get::AutomaticRemove"); bool AllowRemove = _config->FindB("APT::Solver::Remove", true); bool AllowInstall = _config->FindB("APT::Solver::Install", true); + bool AllowRemoveManual = _config->FindB("APT::Solver::RemoveManual", false); DefaultRootSetFunc2 rootSet(&cache); for (auto P = cache.PkgBegin(); not P.end(); P++) @@ -863,6 +864,8 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) auto state = depcache[P]; auto maybeInstall = state.Install() || (state.Keep() && P->CurrentVer); auto reject = state.Delete() || (depcache[P].Keep() && not P->CurrentVer && depcache[P].Protect()); + auto isAuto = (depcache[P].Flags & pkgCache::Flag::Auto); + auto isOptional = isAuto || (AllowRemoveManual && not depcache[P].Protect()); if (P->SelectedState == pkgCache::State::Hold && not state.Protect()) { if (unlikely(debug >= 1)) @@ -884,14 +887,14 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) if (depcache[P].Keep() ? not Install(P, {}) : not Install(depcache.GetCandidateVersion(P), {})) return false; } - else if (maybeInstall && not(depcache[P].Flags & pkgCache::Flag::Auto)) + else if (maybeInstall && not isOptional) { if (unlikely(debug >= 1)) std::cerr << "MANUAL " << P.FullName() << "\n"; if (depcache[P].Keep() ? not Install(P, {}) : not Install(depcache.GetCandidateVersion(P), {})) return false; } - else if (maybeInstall && (KeepAuto || rootSet.InRootSet(P)) && (depcache[P].Flags & pkgCache::Flag::Auto)) + else if (maybeInstall && isOptional && (KeepAuto || rootSet.InRootSet(P) || not isAuto)) { auto Upgrade = depcache.GetCandidateVersion(P) != P.CurrentVer(); if (unlikely(debug >= 1)) diff --git a/doc/examples/configure-index b/doc/examples/configure-index index c27a8f862..6bcf8e354 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -724,6 +724,7 @@ apt::solver::strict-pinning ""; apt::solver::enqueue-common-dependencies ""; apt::solver::upgrade ""; apt::solver::remove ""; +apt::solver::removemanual ""; apt::solver::install ""; apt::keep-downloaded-packages ""; apt::solver ""; diff --git a/test/integration/framework b/test/integration/framework index d2ab0d1cd..ecf5d8703 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -585,6 +585,9 @@ EOF # prefer our apt binaries over the system apt binaries export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" } +allowremovemanual() { + echo 'APT::Solver::RemoveManual "true";' >> ${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/allow-remove-manual.conf +} getarchitecture() { if [ "$1" = "native" -o -z "$1" ]; then -- cgit v1.2.3-70-g09d2 From 1fbdc04be7547b8c4bb84f400329415ea0bc60b5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 19 May 2024 19:31:48 +0200 Subject: test: Run working tests against the 3.0 solver Implement --solver, --only, -skip flags for the test suite, and run the test suite with the broken tests skipped against solver3. --- .gitlab-ci.yml | 9 +++++ test/integration/framework | 8 +++- test/integration/run-tests | 31 +++++++++++++-- test/integration/solver3.broken | 86 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 test/integration/solver3.broken (limited to 'test/integration/framework') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb85a7318..528edf74a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,15 @@ test as root: - CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test - unbuffer ./test/integration/run-tests -q -j 4 +test solver3: + stage: test + variables: + APT_CMAKE_BUILD_OPTIONS: '-DWITH_DOC=OFF -DUSE_NLS=OFF' + DEB_BUILD_PROFILES: 'nodoc' + script: + - CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test + - unbuffer ./test/integration/run-tests -q -j 4 --solver 3.0 --skip solver3.broken + test as user: image: i386/debian:testing stage: test diff --git a/test/integration/framework b/test/integration/framework index ecf5d8703..54bc4da07 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -19,6 +19,9 @@ while [ -n "$1" -a -z "$CHECK_ARGS" ]; do elif [ "$1" = '--level' ]; then export MSGLEVEL=$2 shift + elif [ "$1" = '--solver' ]; then + export APT_SOLVER=$2 + shift else echo >&2 "WARNING: Unknown parameter »$1« will be ignored" fi @@ -537,7 +540,10 @@ exec fakeroot gdb --quiet -ex run '${DPKG:-dpkg}' --args '${DPKG:-dpkg}' --root= EOF chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg - + # Set the solver for the test case. + if [ "$APT_SOLVER" ]; then + echo "APT::Solver \"$APT_SOLVER\";" >> aptconfig.conf + fi { echo 'quiet "0";' echo 'quiet::NoUpdate "true";' diff --git a/test/integration/run-tests b/test/integration/run-tests index c1cc780f0..badc96cc5 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -22,6 +22,15 @@ while [ -n "$1" ]; do elif [ "$1" = '-j' ]; then APT_TEST_JOBS=$2 shift + elif [ "$1" = '--solver' ]; then + export APT_SOLVER="$2" + shift + elif [ "$1" = '--skip' ]; then + export APT_SKIP_TEST_FILE="$2" + shift + elif [ "$1" = '--only' ]; then + TESTLIST="$2" + shift elif [ -x "$1" ]; then TESTTORUN="$1" else @@ -52,14 +61,22 @@ if [ -n "$TESTTORUN" ]; then CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP" trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM { - if [ "$MSGLEVEL" -le 1 ]; then + if [ "$APT_SKIP_TEST_FILE" ] && grep -qFx "${TESTTORUN##*/}" "$APT_SKIP_TEST_FILE"; then + if [ "$MSGLEVEL" -le 2 ]; then + printf "${CTEST}Skip Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}" + else + printf "${CTEST}Skip Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n" + fi + SKIP='yes' + elif [ "$MSGLEVEL" -le 1 ]; then printf "${TESTTORUN##*/}" elif [ "$MSGLEVEL" -le 2 ]; then printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: " else printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n" fi - if ! "$TESTTORUN"; then + + if [ "$SKIP" != "yes" ] && ! "$TESTTORUN"; then FAIL='yes' if [ "$MSGLEVEL" -le 2 ]; then printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}\n" @@ -96,7 +113,11 @@ ALL=0 FAILED_TESTS="" DIR="$(readlink -f "$(dirname "$0")")" cd "$DIR" -TESTLIST="$(find . -mindepth 1 -maxdepth 1 -regex '^\./test-[^/]*$' | sort)" +if [ -e "$TESTLIST" ]; then + TESTLIST="$(sort < "$TESTLIST" | sed 's#^#./#')" +else + TESTLIST="$(find . -mindepth 1 -maxdepth 1 -regex '^\./test-[^/]*$' | sort)" +fi if [ -n "$APT_TEST_JOBS" ]; then if [ "$MSGCOLOR" != 'NO' ]; then export MSGCOLOR='ALWAYS' @@ -125,6 +146,10 @@ if [ "$MSGLEVEL" -le 1 ]; then printf "${CTEST}Running testcases${CRESET}: " fi for testcase in $TESTLIST; do + if [ "$APT_SKIP_TEST_FILE" ] && grep -qFx "${TESTTORUN##*/}" "$APT_SKIP_TEST_FILE"; then + printf "${CTEST}Skipping Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n" + continue + fi if [ "$MSGLEVEL" -le 1 ]; then printf "${testcase##*/}" elif [ "$MSGLEVEL" -le 2 ]; then diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken new file mode 100644 index 000000000..020335238 --- /dev/null +++ b/test/integration/solver3.broken @@ -0,0 +1,86 @@ +test-allow-scores-for-all-dependency-types +test-apt-get-autoremove +test-apt-get-autoremove-kernel-module-providers +test-apt-get-autoremove-real-virtual-provider +test-apt-get-build-dep +test-apt-get-build-dep-barbarian +test-apt-get-build-dep-file +test-apt-get-install-deb +test-apt-get-satisfy +test-apt-get-source-only +test-apt-get-upgrade +test-apt-get-upgrade-by-source +test-apt-install-file-reltag +test-apt-install-order-matters-a-bit +test-apt-move-and-forget-manual-sections +test-apt-never-markauto-sections +test-apt-patterns +test-apt-source-and-build-dep +test-bug-470115-new-and-tighten-recommends +test-bug-549968-install-depends-of-not-installed +test-bug-591882-conkeror +test-bug-596498-trusted-unsigned-repo +test-bug-598669-install-postfix-gets-exim-heavy +test-bug-601961-install-info +test-bug-602412-dequote-redirect +test-bug-604222-new-and-autoremove +test-bug-611729-mark-as-manual +test-bug-612099-multiarch-conflicts +test-bug-612557-garbage-upgrade +test-bug-613420-new-garbage-dependency +test-bug-618848-always-respect-user-requests +test-bug-632221-cross-dependency-satisfaction +test-bug-64141-install-dependencies-for-on-hold +test-bug-657695-resolver-breaks-on-virtuals +test-bug-675449-essential-are-protected +test-bug-683786-build-dep-on-virtual-packages +test-bug-686346-package-missing-architecture +test-bug-709560-set-candidate-release +test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch +test-bug-720597-build-dep-purge +test-bug-723586-any-stripped-in-single-arch +test-bug-735967-lib32-to-i386-unavailable +test-bug-745046-candidate-propagation-fails +test-bug-747261-arch-specific-conflicts +test-bug-753297-upgradable +test-bug-758153-versioned-provides-support +test-bug-767891-force-essential-important +test-bug-769609-triggers-still-pending-after-run +test-bug-796070-downgrade-simulate +test-bug-960705-propagate-protected-to-satisfied-conflict +test-bug-960705-propagate-protected-to-satisfied-depends +test-bug-961266-hold-means-hold +test-bug-lp1562402-nomark-removals-as-keep +test-crossgrades +test-dont-forget-conflicts-via-unknown-architectures +test-dpkg-i-apt-install-fix-broken +test-explore-or-groups-in-markinstall +test-external-dependency-solver-protocol +test-external-installation-planner-protocol +test-handling-broken-orgroups +test-ignore-provides-if-versioned-breaks +test-ignore-provides-if-versioned-conflicts +test-kernel-helper-autoremove +test-method-mirror +test-multiarch-allowed +test-multiarch-barbarian +test-multiarch-foreign +test-not-upgrading-removed-depends +test-parse-all-archs-into-cache +test-phased-updates-new-depends +test-phased-updates-upgrade +test-prefer-higher-priority-providers +test-prevent-markinstall-multiarch-same-versionscrew +test-release-candidate-switching +test-resolve-by-keep-new-recommends +test-resolver-delays-remove-decisions +test-resolver-provider-exchange +test-specific-architecture-dependencies +test-suggests-promoted-to-recommends +test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings +test-ubuntu-bug-1304403-obsolete-priority-standard +test-ubuntu-bug-1974196 +test-ubuntu-bug-1990586 +test-ubuntu-bug-2025462-phased-dist-upgrade +test-ubuntu-bug-614993 +test-unpack-different-version-unpacked -- cgit v1.2.3-70-g09d2 From 0c700522df1c96fd591020e7b3e29bc7e36dec14 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 20 May 2024 13:17:35 +0200 Subject: test: Temporarily ignore autoremovable lists for solver3 We do not show them yet, so let's ignore them so we can focus on getting the rest of the tests to work. --- test/integration/framework | 12 +++++++++++- test/integration/solver3.broken | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index 54bc4da07..e13888da2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1559,12 +1559,22 @@ downloadfile() { fi } +cleanup_solver3_pipe() { + if [ "$APT_SOLVER" != "3.0" ]; then + cat + else + # FIXME: We do not have support for listing autoremovals yet. + # FIXME: Progress output is different + sed -e '/Solving dependencies\.\.\./ d' \ + -e "/no longer required[.:]$/,/^Use '.* autoremove'/ d" + fi +} cleanup_output() { cat "$1" | sed \ -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ -e '/^profiling:/ d' \ - -e '/Solving dependencies\.\.\./ d' \ | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ + | cleanup_solver3_pipe \ >"$2" } diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 020335238..96238232c 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -60,7 +60,6 @@ test-external-installation-planner-protocol test-handling-broken-orgroups test-ignore-provides-if-versioned-breaks test-ignore-provides-if-versioned-conflicts -test-kernel-helper-autoremove test-method-mirror test-multiarch-allowed test-multiarch-barbarian -- cgit v1.2.3-70-g09d2