summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-20 10:23:41 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-20 10:37:46 +0200
commit4fa34122cbe347d21b3a162ff2fa75dd2e73c3a8 (patch)
tree07de5c1bedf542cb0111cdf9f7aecd03c4affee9 /test/integration/framework
parent1df24acfdb8ba1cd8bbbaa166f170dda480ce41e (diff)
testcases: do not allow warnings in testsuccess
Adds a new testwarning which tests for zero exit and the presents of a warning in the output, failing if either is not the case or if an error is found, too. This allows us to change testsuccess to accept only totally successful executions (= without warnings) which should help finding regressions. Git-Dch: Ignore
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework34
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