summaryrefslogtreecommitdiff
path: root/test/integration/test-kernel-helper-autoremove
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-11-05 11:31:29 +0100
committerMichael Vogt <mvo@debian.org>2014-02-14 20:26:41 +0100
commite5bdcc8708ee571a7d7d54bbdfa7e226300344ea (patch)
treebd9ebfb6d5566cbcf721655c56ad9338db96bedc /test/integration/test-kernel-helper-autoremove
parent32611903e8dcd6599042552c6c576b70e3d6633a (diff)
add testcase for the autoremove feature
Conflicts: debian/apt.auto-removal.sh
Diffstat (limited to 'test/integration/test-kernel-helper-autoremove')
-rwxr-xr-xtest/integration/test-kernel-helper-autoremove33
1 files changed, 33 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..a4c31283e
--- /dev/null
+++ b/test/integration/test-kernel-helper-autoremove
@@ -0,0 +1,33 @@
+#!/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\.\*"
+
+# done
+msgpass \ No newline at end of file