diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-03-04 20:57:41 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-03-04 20:57:41 +0000 |
| commit | b63127f956c7768c75e4b10f8f3ccecd6058066f (patch) | |
| tree | 59b3b21ce283f7b4131df76f33e7b49eb12f5af1 /test/integration/framework | |
| parent | 8dcfb1237aa16247fbe038b818d875a92a1d3c1a (diff) | |
| parent | 1b959f0129460f2267e66bc77ca9464c28c915c5 (diff) | |
Merge branch 'test-suite-grep-error-details' into 'main'
test: Grep continuation lines in error messages
See merge request apt-team/apt!456
Diffstat (limited to 'test/integration/framework')
| -rw-r--r-- | test/integration/framework | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework index 35c1a1032..d2570b6b2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -2068,6 +2068,19 @@ testfailureequal() { testreturnstateequal 'testfailure' "$@" } +grepmsg() { + awk '{ + if (/^[WEN]:/) + msg=1; + else if (/^ / && msg) + msg=1; + else + msg=0; + if (msg) + print + }' +} + testfailuremsg() { msggroup 'testfailuremsg' local CMP="$1" @@ -2075,7 +2088,7 @@ testfailuremsg() { testfailure "$@" msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" - grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true + grepmsg < "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true testoutputequal "$COMPAREFILE" echo "$CMP" msggroup } @@ -2086,7 +2099,7 @@ testwarningmsg() { testwarning "$@" msgtest 'Check that the output of the previous warned command has expected' 'warnings' local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" - grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true + grepmsg < "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true testoutputequal "$COMPAREFILE" echo "$CMP" msggroup } |
