diff options
Diffstat (limited to 'test/integration/framework')
-rw-r--r-- | test/integration/framework | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework index 617daa283..9ce300d55 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1207,10 +1207,41 @@ testsuccess() { local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" if "$@" >${OUTPUT} 2>&1; then if expr match "$1" '^apt.*' >/dev/null; then + if grep -q -E '^[WE]: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail 'successful run, but output contains warnings/errors' + else + msgpass + fi + else + msgpass + fi + else + local EXITCODE=$? + echo >&2 + cat >&2 $OUTPUT + msgfail "exitcode $EXITCODE" + fi + aptautotest 'testsuccess' "$@" +} +testwarning() { + if [ "$1" = '--nomsg' ]; then + shift + else + msgtest 'Test for successful execution with warnings of' "$*" + fi + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" + if "$@" >${OUTPUT} 2>&1; then + if expr match "$1" '^apt.*' >/dev/null; then if grep -q -E '^E: ' "$OUTPUT"; then echo >&2 cat >&2 $OUTPUT msgfail 'successful run, but output contains errors' + elif ! grep -q -E '^W: ' "$OUTPUT"; then + echo >&2 + cat >&2 $OUTPUT + msgfail 'successful run, but output contains no warnings' else msgpass fi @@ -1223,9 +1254,8 @@ testsuccess() { cat >&2 $OUTPUT msgfail "exitcode $EXITCODE" fi - aptautotest 'testsuccess' "$@" + aptautotest 'testwarning' "$@" } - testfailure() { if [ "$1" = '--nomsg' ]; then shift |