diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-10-19 14:14:37 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-10-20 10:37:46 +0200 |
commit | 1df24acfdb8ba1cd8bbbaa166f170dda480ce41e (patch) | |
tree | 992b2cc2f5f02a34a49b5bac160070ec30cf34b1 /test/integration/test-releasefile-valid-until | |
parent | cecc5532b8d64394a8f8641e78f4a0cc5f7a51fc (diff) |
check for failure message in testsuccess/failure
These functions check the exit code of the command, but for apt commands
we can go further and require an error message for non-zero exits and
none for zero exits.
Git-Dch: Ignore
Diffstat (limited to 'test/integration/test-releasefile-valid-until')
-rwxr-xr-x | test/integration/test-releasefile-valid-until | 100 |
1 files changed, 27 insertions, 73 deletions
diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index e673d5f71..0d9a91254 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -12,84 +12,38 @@ getlabelfromsuite() { echo -n 'Testcases' } +setupaptarchive --no-update -setupaptarchive - -setupreleasefile() { +runtest() { + local MSG="$1" + msgtest "$1" "$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 expr match "$MSG" '.*accepted.*' >/dev/null; 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 'Release file is accepted as it has' 'no Until' '' '' +runtest 'Release file is accepted as it has' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600 +runtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600 +runtest 'Release file is accepted as it has' 'good Until' 'now - 3 days' 'now + 1 day' +runtest 'Release file is rejected as it has' 'bad Until' 'now - 7 days' 'now - 4 days' +runtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600 +runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 +runtest 'Release file is accepted as it has' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 +runtest 'Release file is rejected as it has' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 +runtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600 +runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600 +runtest 'Release file is accepted as it has' '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 'Release file is rejected as it has' '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 'Release file is rejected as it has' '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 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 |