diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2025-03-04 21:41:41 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2025-03-04 21:41:41 +0100 |
| commit | 1b959f0129460f2267e66bc77ca9464c28c915c5 (patch) | |
| tree | 59b3b21ce283f7b4131df76f33e7b49eb12f5af1 /test/integration/framework | |
| parent | 8dcfb1237aa16247fbe038b818d875a92a1d3c1a (diff) | |
test: Grep continuation lines in error messages
This is important for upcoming multi-line solver error message
work.
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 } |
