From f9b4f12d65b827612b29071f05d605bc05fa62bd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 13 Feb 2014 23:38:28 +0100 Subject: report https download start only if we really get it Reporting it via progress means that e.g. a redirect will trigger it, too, so you get a Get & Hit while http only reports a Hit as it should be. --- test/integration/test-bug-602412-dequote-redirect | 33 ++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index bcebb57b8..6393f0c27 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -15,15 +15,24 @@ changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \ mv aptarchive/pool aptarchive/newpool mv aptarchive/dists aptarchive/newdists -msgtest 'Test redirection works in' 'apt-get update' -testsuccess --nomsg aptget update - -# check that I-M-S header is kept in redirections -testequal 'Hit http://localhost:8080 unstable InRelease -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en -Reading package lists...' aptget update #-o debug::pkgacquire=1 -o debug::pkgacquire::worker=1 - -msgtest 'Test redirection works in' 'package download' -testsuccess --nomsg aptget install unrelated --download-only -y +testrun() { + msgtest 'Test redirection works in' 'apt-get update' + testsuccess --nomsg aptget update + + # check that I-M-S header is kept in redirections + testequal "Hit $1 unstable InRelease +Hit $1 unstable/main Sources +Hit $1 unstable/main amd64 Packages +Hit $1 unstable/main Translation-en +Reading package lists..." aptget update + + msgtest 'Test redirection works in' 'package download' + testsuccess --nomsg aptget install unrelated --download-only -y +} + +testrun 'http://localhost:8080' + +rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives +changetohttpswebserver + +testrun 'https://localhost:4433' -- cgit v1.2.3 From 9082a1fc7be02f58cbe18a34539c6a3436463dd0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Feb 2014 00:30:58 +0100 Subject: allow http protocol to switch to https switch protocols at random is a bad idea if e.g. http can switch to file, so we limit the possibilities to http to http and http to https. As very few people (less than 1% according to popcon) have https installed this likely changes nothing in terms of failure. The commit is adding a friendly hint which package needs to be installed though. --- test/integration/framework | 2 +- test/integration/test-bug-738785-switch-protocol | 52 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100755 test/integration/test-bug-738785-switch-protocol (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 5b9a58568..f3699861b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -190,7 +190,7 @@ setupenvironment() { mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers touch var/lib/dpkg/available mkdir -p usr/lib/apt - ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods + ln -s ${METHODSDIR} usr/lib/apt/methods cd .. local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol new file mode 100755 index 000000000..d3469f34f --- /dev/null +++ b/test/integration/test-bug-738785-switch-protocol @@ -0,0 +1,52 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +# setup http redirecting to https +setupaptarchive --no-update +changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \ + -o 'aptwebserver::support::http=false' +changetohttpswebserver +sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/* + +testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1 + +msgtest 'Test that the webserver does not answer' 'http requests' +downloadfile 'http://localhost:8080//pool/apt_1.0/changelog' >/dev/null 2>&1 && msgfail || msgpass + +echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf +testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris + +testsuccess aptget changelog apt -d +testsuccess test -s apt.changelog +rm -f apt.changelog + +testsuccess aptget download apt +testsuccess test -s apt_1.0_all.deb +rm apt_1.0_all.deb + +testsuccess aptget install apt -y +testdpkginstalled 'apt' + +# create a copy of all methods, expect https +eval `aptconfig shell METHODS Dir::Bin::Methods/d` +COPYMETHODS='usr/lib/apt/methods' +rm rootdir/$COPYMETHODS +mkdir -p rootdir/$COPYMETHODS +cd rootdir/$COPYMETHODS +find $METHODS \! -type d | while read meth; do + ln -s $meth +done +rm https +cd - >/dev/null +echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf + +aptget download apt +testsuccess test ! -e apt_1.0_all.deb -- cgit v1.2.3 From 75b093128e7ced667f8ed89a5367af461e727736 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Feb 2014 00:44:06 +0100 Subject: enforce 'house-style' on changelog testcase Git-Dch: Ignore --- test/integration/test-apt-get-changelog | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index d013cc458..a73c3e249 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -9,11 +9,11 @@ configarchitecture "i386" buildsimplenativepackage 'apt' 'all' '1.0' 'stable' -setupaptarchive +setupaptarchive --no-update changetowebserver -aptget update -qq +testsuccess aptget update -echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf +echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris @@ -24,7 +24,7 @@ aptget changelog apt -qq > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm apt.changelog -aptget changelog apt -d -qq +testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm apt.changelog aptarchive/pool/apt_1.0/changelog @@ -32,7 +32,7 @@ aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-serv testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" rm apt.changelog -aptget changelog apt -d -qq +testsuccess aptget changelog apt -d testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" rm apt.changelog aptarchive/pool/apt_1.0.changelog -- cgit v1.2.3 From 3f621056f7f672988c0efc6d38935c22b5ae041f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 14 Feb 2014 17:32:42 +0100 Subject: test/integration/test-bug-723705-tagfile-truncates-fields: fix autopkgtest failure --- test/integration/test-bug-723705-tagfile-truncates-fields | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/test-bug-723705-tagfile-truncates-fields b/test/integration/test-bug-723705-tagfile-truncates-fields index 3180e7fc9..29f98550c 100755 --- a/test/integration/test-bug-723705-tagfile-truncates-fields +++ b/test/integration/test-bug-723705-tagfile-truncates-fields @@ -8,7 +8,7 @@ configarchitecture 'amd64' setupaptarchive -aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed 's#file:///tmp/tmp.[^/]\+#file:///tmp#g' > filename.log +aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed "s#file://${TMPWORKINGDIRECTORY}#file:///tmp#g" > filename.log testfileequal filename.log "Reading package lists... Building dependency tree... -- cgit v1.2.3 From dc95fee18e8df2b00404c7d0f321f5b78e00f170 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 14 Feb 2014 17:11:07 +0100 Subject: disable https->http redirects in libcurl This change prevents changing the protocol from https to http. --- test/integration/framework | 2 +- test/integration/test-apt-https-no-redirect | 24 ++++++++++++++++++++++++ test/integration/test-bug-738785-switch-protocol | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 test/integration/test-apt-https-no-redirect (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index f3699861b..e4f018472 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -901,7 +901,7 @@ changetohttpswebserver() { msgdie 'You need to install stunnel4 for https testcases' fi if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then - changetowebserver --no-rewrite + changetowebserver --no-rewrite "$@" fi echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid cert = ${TESTDIRECTORY}/apt.pem diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect new file mode 100755 index 000000000..c405d1167 --- /dev/null +++ b/test/integration/test-apt-https-no-redirect @@ -0,0 +1,24 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +setupaptarchive --no-update + +changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/' + +msgtest 'normal http download works' +downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 >/dev/null 2>/dev/null && msgpass || msgfail + +msgtest 'normal https download works' +downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog >/dev/null 2>/dev/null && msgpass || msgfail + +msgtest 'redirecting https to http does not work' +downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass + + diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index d3469f34f..bc3c6dbad 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -19,7 +19,7 @@ sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/so testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1 msgtest 'Test that the webserver does not answer' 'http requests' -downloadfile 'http://localhost:8080//pool/apt_1.0/changelog' >/dev/null 2>&1 && msgfail || msgpass +downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris -- cgit v1.2.3 From 5543218acdbbeef1d9f6d118e0b86a765c341430 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Feb 2014 18:35:35 +0100 Subject: honor option to disable pulses for the testcases Git-Dch: Ignore --- test/integration/test-bug-738785-switch-protocol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index bc3c6dbad..b51be244a 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -48,5 +48,6 @@ rm https cd - >/dev/null echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf -aptget download apt +testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. +N: Is the package apt-transport-https installed?" aptget download apt -q=0 testsuccess test ! -e apt_1.0_all.deb -- cgit v1.2.3 From 889b0072a93a5afe9ffec93ab791d584c64754a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Feb 2014 18:59:46 +0100 Subject: =?UTF-8?q?add=20a=20testcase=20to=20check=20for=20forbidden=20htt?= =?UTF-8?q?ps=E2=86=92http=20downgrades?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore --- test/integration/framework | 2 +- test/integration/test-bug-738785-switch-protocol | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index e4f018472..08d796a10 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1119,7 +1119,7 @@ testfailure() { if [ "$1" = '--nomsg' ]; then shift else - msgtest 'Test for failure in execution of' "$*" + msgtest 'Test for failure in execution of' "$*" fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if $@ >${OUTPUT} 2>&1; then diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index b51be244a..1e5748eae 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -12,6 +12,7 @@ buildsimplenativepackage 'apt' 'all' '1.0' 'stable' # setup http redirecting to https setupaptarchive --no-update changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \ + -o 'aptwebserver::redirect::replace::/downgrademe/=http://localhost:8080/' \ -o 'aptwebserver::support::http=false' changetohttpswebserver sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/* @@ -38,7 +39,7 @@ testdpkginstalled 'apt' # create a copy of all methods, expect https eval `aptconfig shell METHODS Dir::Bin::Methods/d` COPYMETHODS='usr/lib/apt/methods' -rm rootdir/$COPYMETHODS +mv rootdir/${COPYMETHODS} rootdir/${COPYMETHODS}.bak mkdir -p rootdir/$COPYMETHODS cd rootdir/$COPYMETHODS find $METHODS \! -type d | while read meth; do @@ -51,3 +52,12 @@ echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?" aptget download apt -q=0 testsuccess test ! -e apt_1.0_all.deb + +# revert to all methods +rm -rf rootdir/$COPYMETHODS +mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS} + +# check that downgrades from https to http are not allowed +webserverconfig 'aptwebserver::support::http' 'true' +sed -i -e 's#:8080/redirectme#:4433/downgrademe#' -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/* +testfailure aptget update -- cgit v1.2.3 From e5bdcc8708ee571a7d7d54bbdfa7e226300344ea Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 5 Nov 2012 11:31:29 +0100 Subject: add testcase for the autoremove feature Conflicts: debian/apt.auto-removal.sh --- test/integration/test-kernel-helper-autoremove | 33 ++++++++++++++++++++++ .../test-kernel-helper-autoremove.fake-dpkg | 13 +++++++++ 2 files changed, 46 insertions(+) create mode 100755 test/integration/test-kernel-helper-autoremove create mode 100644 test/integration/test-kernel-helper-autoremove.fake-dpkg (limited to 'test/integration') 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 < Date: Mon, 5 Nov 2012 11:39:47 +0100 Subject: also check that the running kernel is kept --- test/integration/test-kernel-helper-autoremove | 4 +++- test/integration/test-kernel-helper-autoremove.fake-dpkg | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index a4c31283e..4c0571b13 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -28,6 +28,8 @@ 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 \ No newline at end of file +msgpass diff --git a/test/integration/test-kernel-helper-autoremove.fake-dpkg b/test/integration/test-kernel-helper-autoremove.fake-dpkg index aec6d4418..a365c5370 100644 --- a/test/integration/test-kernel-helper-autoremove.fake-dpkg +++ b/test/integration/test-kernel-helper-autoremove.fake-dpkg @@ -3,7 +3,7 @@ set -e if [ "$1" = "-l" ]; then echo "ii linux-image-1.0.0-2-generic 1.0.01-2 amd64" - echo "ii linux-image-3.5.0-17-generic 3.5.0-17 amd64" + echo "ii linux-image-$(uname -r) not-used amd64" echo "ii linux-image-10.0.0-1-generic 10.0.0.1-1 amd64" elif [ "$1" = "--compare-versions" ]; then dpkg "$1" "$2" "$3" "$4" -- cgit v1.2.3 From d27a691d72c8cc07767e92ae94bdfe391d9e9513 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 5 Nov 2012 12:32:50 -0800 Subject: typo fix --- test/integration/test-kernel-helper-autoremove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 4c0571b13..52fa01bc5 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -28,7 +28,7 @@ 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 +# ... and also that the running kernel is excluded apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" # done -- cgit v1.2.3 From c6918c16c7b98fe709b4f7af5fa1c43f201fb1af Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 5 Nov 2012 13:11:39 -0800 Subject: Make the test more verbose and check for the negative case of a kernel that should not be marked not-for-autoremoval --- test/integration/test-kernel-helper-autoremove | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 52fa01bc5..37c1b6a43 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -25,11 +25,18 @@ install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg # run the helper sh ${TESTDIR}/../../debian/apt.auto-removal.sh +msgtest 'Check that kernel autoremoval list is correctly created' # 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\.\*" +test -e $TMPDIR/apt.conf.d/01autoremove-kernels && msgpass || msgfail + +msgtest 'Check that most recent kernel is saved from autoremoval' +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*" && msgpass || msgfail + # ... and also that the running kernel is excluded -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" +msgtest 'Check that running kernel is saved from autoremoval' +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" && msgpass || msgfail +# and that the old kernel is *not* excluded from autoremoval +msgtest 'Check that older kernels are not excluded from autoremoval' +apt-config -c ${APT_CONFIG} dump | grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.0-2-generic\.\*" && msgfail || msgpass # done -msgpass -- cgit v1.2.3 From d269b88d95686b77a170af203d0f4a7e44d28fc8 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 5 Nov 2012 14:44:59 -0800 Subject: Additional test for the case when installed version != newest version --- test/integration/test-kernel-helper-autoremove | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 37c1b6a43..ffcd3963a 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -23,7 +23,7 @@ export APT_CONFIG install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg # run the helper -sh ${TESTDIR}/../../debian/apt.auto-removal.sh +sh ${TESTDIR}/../../debian/apt.auto-removal.sh msgtest 'Check that kernel autoremoval list is correctly created' # and ensure its there, valid and version 10.0.0-1 is there too @@ -38,5 +38,18 @@ apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image- # and that the old kernel is *not* excluded from autoremoval msgtest 'Check that older kernels are not excluded from autoremoval' -apt-config -c ${APT_CONFIG} dump | grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.0-2-generic\.\*" && msgfail || msgpass +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic\.\*" && msgfail || msgpass + +msgtest "Check that the older kernel is retained when it's being installed" +sh ${TESTDIR}/../../debian/apt.auto-removal.sh 1.0.01-2-generic +test -e $TMPDIR/apt.conf.d/01autoremove-kernels +if ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*" \ + || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" \ + || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic\.\*" +then + msgfail +else + msgpass +fi + # done -- cgit v1.2.3 From f2f53128c01f0620ab21c312cd6601d903aaae3c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 14 Feb 2014 22:01:35 +0100 Subject: fix the test-kernel-helper-autoremove testcase --- test/integration/test-kernel-helper-autoremove | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index ffcd3963a..2b165d100 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -30,22 +30,22 @@ msgtest 'Check that kernel autoremoval list is correctly created' test -e $TMPDIR/apt.conf.d/01autoremove-kernels && msgpass || msgfail msgtest 'Check that most recent kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*" && msgpass || msgfail +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" && msgpass || msgfail # ... and also that the running kernel is excluded msgtest 'Check that running kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" && msgpass || msgfail +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" && msgpass || msgfail # and that the old kernel is *not* excluded from autoremoval msgtest 'Check that older kernels are not excluded from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic\.\*" && msgfail || msgpass +apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" && msgfail || msgpass msgtest "Check that the older kernel is retained when it's being installed" sh ${TESTDIR}/../../debian/apt.auto-removal.sh 1.0.01-2-generic test -e $TMPDIR/apt.conf.d/01autoremove-kernels -if ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic\.\*" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)\.\*" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic\.\*" +if ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" \ + || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" \ + || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" then msgfail else -- cgit v1.2.3