summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2018-05-15 22:24:29 -0700
committerFilipe Brandenburger <filbranden@google.com>2018-05-21 09:19:33 -0700
commit5d263a39d6106f6d20b2b447ffc14ef0c096ea22 (patch)
tree1381b2663113fed1ae62b9c41f9e7b079562da98 /test
parentf0c2263dd702d646722b749f7b7d278d15c18c55 (diff)
Extend test-apt-get-autoremove to check debug output
Run `apt-get autoremove -o Debug::pkgAutoRemove=yes` and confirm the logged reason for packages to be kept is correct. Only check for specific debug lines containing 'MarkPackage:' in order to prevent new debug logging to break the test case.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-get-autoremove25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove
index 6f3452fbd..4dba4f164 100755
--- a/test/integration/test-apt-get-autoremove
+++ b/test/integration/test-apt-get-autoremove
@@ -9,6 +9,12 @@ configarchitecture 'i386'
buildsimplenativepackage 'unrelated' 'all' '1' 'unstable'
buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
+buildsimplenativepackage 'base-files' 'all' '10' 'unstable' 'Essential: yes'
+buildsimplenativepackage 'fdisk' 'all' '2.30.2' 'unstable' 'XB-Important: yes'
+buildsimplenativepackage 'linux-image' 'all' '4.9.80' 'unstable'
+buildsimplenativepackage 'hold-me' 'all' '1.0' 'unstable'
+buildsimplenativepackage 'remove-me' 'all' '1.0' 'unstable'
+buildsimplenativepackage 'system-base' 'all' '1.0' 'unstable' 'Depends: unrelated, base-files, fdisk, linux-image, hold-me, remove-me'
setupaptarchive
testsuccess aptget install unrelated debhelper -y
@@ -158,6 +164,25 @@ testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Mark
testmarkedauto 'po-debconf'
testdpkgstatus 'pi' '1' 'unrelated'
+testsuccess aptget install system-base debhelper -y
+testdpkginstalled 'debhelper' 'po-debconf' 'system-base' 'base-files' 'fdisk' 'linux-image' 'hold-me' 'remove-me'
+testsuccess aptmark hold 'hold-me'
+echo 'APT::NeverAutoRemove { "^linux-image$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
+testsuccess aptget remove system-base -y
+testsuccess aptget autoremove -y -o Debug::pkgAutoRemove=yes
+DEBUGLOG=${TMPWORKINGDIRECTORY}/rootdir/tmp/autoremove.debuglog
+cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: fdisk:i386 2.30.2 (Important)' "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: base-files:i386 10 (Essential)' "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: unrelated:i386 1 (Manual-Installed)' "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: hold-me:i386 1.0 (Hold)' "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: po-debconf:i386 1.0.16 (Dependency)' "$DEBUGLOG"
+testsuccess grep -Fx 'Marking: linux-image:i386 4.9.80 (Blacklisted [APT::NeverAutoRemove])' "$DEBUGLOG"
+testdpkginstalled 'debhelper' 'po-debconf' 'base-files' 'fdisk' 'linux-image'
+testdpkgstatus 'hi' '1' 'hold-me'
+testdpkgnotinstalled 'remove-me'
+testdpkgstatus 'pi' '1' 'unrelated'
+
insertinstalledpackage 'bar' 'all' '1' 'Depends: foo-provider'
insertinstalledpackage 'foo-multi1-1' 'all' '1' 'Provides: foo-provider
Source: foo-multi (1)'