Merge tests: provide better output on failures

When a test fails because of an unexpected success (XFAIL), do not display the empty error log as that may confuse the reader just as it had confused the author.

In addition, when something legitimately fails then display tail of trace log as that may show some useful information.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1548
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
John Johansen 2025-02-18 15:06:33 +00:00
commit 8711c7754b

View file

@ -123,14 +123,13 @@ execute: |
echo "Test execution logs are in the files bash.{log,err,trace} and are collected as artifacts"
echo "Bash errors are listed below:"
cat bash.err
echo "Tail of the trace is:"
tail bash.trace
exit 1
else
for xfail in ${XFAIL:-}; do
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
echo "Test $SPREAD_VARIANT has unexpectedly passed"
echo "Test execution logs are in the files bash.{log,err,trace} and are collected as artifacts"
echo "Bash errors are listed below:"
cat bash.err
exit 1
fi
done