X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0440d936d70b1e331d49bbc32735f1b749632604..757ec4e1ef633f9867928559df82adf3d0ac7b78:/test/integration/test-releasefile-valid-until diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index e673d5f71..f64c6329d 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -1,8 +1,8 @@ #!/bin/sh set -e -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" setupenvironment configarchitecture 'i386' @@ -12,84 +12,46 @@ getlabelfromsuite() { echo -n 'Testcases' } +setupaptarchive --no-update -setupaptarchive - -setupreleasefile() { +runtest() { + local MSG="$1" + msgtest "Release file is $MSG as it has" "$2" rm -rf rootdir/var/lib/apt/lists - aptget clean - generatereleasefiles "$1" "$2" + generatereleasefiles "$3" "$4" signreleasefiles -} - -aptgetupdate() { - if aptget update $* 2>&1 | grep -q 'is expired'; then - return 1 + shift 4 + if [ "$MSG" = 'accepted' ]; then + testsuccess --nomsg aptget update "$@" + testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output else - return 0 + testfailure --nomsg aptget update "$@" + testsuccess grep -q 'is expired' rootdir/tmp/testfailure.output fi } -setupreleasefile -msgtest 'Release file is accepted as it has' 'no Until' -testsuccess --nomsg aptgetupdate - -setupreleasefile -msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid' -testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 - -setupreleasefile 'now - 2 days' -msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 - -setupreleasefile 'now - 3 days' 'now + 1 day' -msgtest 'Release file is accepted as it has' 'good Until' -testsuccess --nomsg aptgetupdate - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Until' -testfailure --nomsg aptgetupdate - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is accepted as it has' 'good labeled Max-Valid' -testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 - -setupreleasefile 'now - 7 days' 'now + 4 days' -msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 - -setupreleasefile 'now - 7 days' 'now + 1 days' -msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 4 days' -msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' -testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' -testfailure --nomsg aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 - -setupreleasefile 'now - 7 days' 'now - 2 days' -msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' -testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 +runtest 'accepted' 'no Until' '' '' +runtest 'accepted' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600 +runtest 'rejected' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600 +runtest 'accepted' 'good Until' 'now - 3 days' 'now + 1 day' +runtest 'rejected' 'bad Until' 'now - 7 days' 'now - 4 days' +runtest 'rejected' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600 +runtest 'rejected' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'rejected' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'accepted' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 +runtest 'rejected' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 +runtest 'accepted' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600 +runtest 'accepted' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600 +runtest 'accepted' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 +runtest 'rejected' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 +runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 +runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 + +sed -i -e 's#\(deb\(-src\)\?\) #\1 [check-valid-until=no] #' rootdir/etc/apt/sources.list.d/* +runtest 'accepted' 'bad Until but overriden by sources option' 'now - 7 days' 'now - 4 days' + +sed -i -e 's#\(deb\(-src\)\?\) \[check-valid-until=no\] #\1 [valid-until-max=86400] #' rootdir/etc/apt/sources.list.d/* +runtest 'rejected' 'bad Max-Valid (good Until) via sources option' 'now - 7 days' 'now + 4 days' + +sed -i -e 's#\(deb\(-src\)\?\) \[valid-until-max=86400\] #\1 [valid-until-min=1209600] #' rootdir/etc/apt/sources.list.d/* +runtest 'accepted' 'good Min-Valid (bad Until) via sources option' 'now - 7 days' 'now - 4 days'