summaryrefslogtreecommitdiff
path: root/test/integration/test-kernel-helper-autoremove
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2012-11-05 12:32:27 -0800
committerSteve Langasek <steve.langasek@canonical.com>2012-11-05 12:32:27 -0800
commit08807527cb1f8ecd9883f284dad278def3175933 (patch)
treefb62abb3dd2a629c935a90c71cf3667f72b8ca7c /test/integration/test-kernel-helper-autoremove
parent200b3080e739050c3f6c9e1b74242d9140bcbf21 (diff)
parenta7e926d57fbed2e0cc1c059364191a3544ce2fe5 (diff)
Merge test case from mvo
Diffstat (limited to 'test/integration/test-kernel-helper-autoremove')
-rwxr-xr-xtest/integration/test-kernel-helper-autoremove35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove
new file mode 100755
index 000000000..4c0571b13
--- /dev/null
+++ b/test/integration/test-kernel-helper-autoremove
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+# setup testdir
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+TMPDIR=$(mktemp -d)
+cd $TMPDIR
+addtrap "cd /; rm -rf $TMPDIR"
+
+# create mock environment
+mkdir apt.conf.d
+cat > aptconfig.conf <<EOF
+Dir::Etc::parts "$TMPDIR/apt.conf.d";
+Dir::bin::dpkg "$TMPDIR/fake-dpkg";
+EOF
+APT_CONFIG=aptconfig.conf
+export APT_CONFIG
+
+# install fake-dpkg into it
+install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg
+
+# run the helper
+sh ${TESTDIR}/../../debian/apt.auto-removal.sh
+
+# and ensure its there, valid and version 10.0.0-1 is there too
+test -e $TMPDIR/apt.conf.d/01autoremove-kernels
+apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*"
+# ... and also that the running kernel is exlucded
+apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*"
+
+# done
+msgpass