summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2022-04-06 13:51:08 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2022-04-07 13:19:52 +0200
commit824651ded0bcf8603e9b508860b8fe5a68fc53ff (patch)
treeea9b042a2d16cfc6723851faf87c119d03d9b78f /test
parent023c270e27e09cad9f35908caeb933fb23f8bd79 (diff)
Only protect two kernels, not last installed one
The kernel autoremoval algorithm was written to accomodate for Ubuntu's boot partition sizing, which was written to accomodate 3 kernels - 2 installed ones + a new one being unpacked. It seems that when the algorithm was designed, it was overlooked that it actually kept 3 kernels. LP: #1968154
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-kernel-helper-autoremove22
1 files changed, 6 insertions, 16 deletions
diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove
index 8dac44b93..208bd1425 100755
--- a/test/integration/test-kernel-helper-autoremove
+++ b/test/integration/test-kernel-helper-autoremove
@@ -29,15 +29,6 @@ testsuccess aptmark auto "$CURRENTKERNEL" "${CURRENTKERNEL}-dbg" "${CURRENTKERNE
testsuccess aptmark hold "${CURRENTKERNEL}-rt"
testprotected() {
- rm -f rootdir/etc/apt/apt.conf.d/01autoremove-kernels protected.list
-
- testsuccess runapt sh "${TESTDIR}/../../debian/apt.auto-removal.sh" "$@"
- testfailure test -s rootdir/tmp/testsuccess.output
-
- msgtest 'Check kernel autoremoval protection list' 'is created'
- testsuccess --nomsg test -e rootdir/etc/apt/apt.conf.d/01autoremove-kernels
- testfilestats 'rootdir/etc/apt/apt.conf.d/01autoremove-kernels' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:444"
-
testsuccess --nomsg apt -o Debug::PkgAutoRemove=1 autoremove -s
grep "Kernel protection regex" rootdir/tmp/testsuccess.output | cut -f2- -d: | tr '|' '\n' | sed 's/\s*//g' | sort -u > protected.list
@@ -134,8 +125,6 @@ msgmsg "install unknown kernel"
testprotected 1.0.0-2-ungeneric
msgtest 'Check kernel autoremoval protection list does not include' 'old kernel'
testfailure --nomsg grep '^\^linux-.*-1\\\.0\\\.0-2-generic\$$' protected.list
-msgtest 'Check kernel autoremoval protection list does include' 'unknown installed kernel'
-testsuccess --nomsg grep '^\^linux-.*-1\\\.0\\\.0-2-ungeneric\$$' protected.list
export COLUMNS=9
testsuccessequal "Reading package lists...
Building dependency tree...
@@ -152,17 +141,17 @@ unset COLUMNS
msgmsg "install an old kernel"
testprotected 1.0.0-2-generic
-msgtest 'Check kernel autoremoval protection list includes' 'installed kernel'
-testsuccess --nomsg grep '^\^linux-.*-1\\\.0\\\.0-2-generic\$$' protected.list
export COLUMNS=9
testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
linux-headers-1000000-1-generic
+ linux-image-1.0.0-2-generic
${CURRENTKERNEL}-dbg
-0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
+0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
Remv linux-headers-1000000-1-generic [100.0.0-1]
+Remv linux-image-1.0.0-2-generic [1.0.0-2]
Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s
unset COLUMNS
@@ -173,8 +162,9 @@ testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
- linux-headers-1000000-1-generic ${CURRENTKERNEL}-dbg
-0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
+ linux-headers-1000000-1-generic linux-image-1.0.0-2-generic ${CURRENTKERNEL}-dbg
+0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
Remv linux-headers-1000000-1-generic [100.0.0-1]
+Remv linux-image-1.0.0-2-generic [1.0.0-2]
Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s
unset COLUMNS