mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Merge tests: regression: separate bash traces from errors
The BASH_XTRACEFD variable can be used to redirect "set -x" traces to a dedicated file. We can use it to split the execution trace (what has actually happened) from the failure messages. On a failing test this does provide improved clarity when debugging interactively with "spread -debug". On non-interactive runs the now shorter error list is also implicitly printed. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1481 Approved-by: Christian Boltz <apparmor@cboltz.de> Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Merged-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
commit
b4cb33b488
@ -104,12 +104,13 @@ environment:
|
|||||||
artifacts:
|
artifacts:
|
||||||
- bash.log
|
- bash.log
|
||||||
- bash.err
|
- bash.err
|
||||||
|
- bash.trace
|
||||||
execute: |
|
execute: |
|
||||||
# Run the shell script that is named after the spread variant we are running
|
# Run the shell script that is named after the spread variant we are running
|
||||||
# now. The makefile runs them all sequentially via the "alltests" goal. Here
|
# now. The makefile runs them all sequentially via the "alltests" goal. Here
|
||||||
# we can parallelize it through spread and also have a way to run precisely
|
# we can parallelize it through spread and also have a way to run precisely
|
||||||
# the test we want, especially for debugging.
|
# the test we want, especially for debugging.
|
||||||
if ! bash -x "$SPREAD_VARIANT".sh >bash.log 2>bash.err; then
|
if ! BASH_XTRACEFD=42 bash -x "$SPREAD_VARIANT".sh >bash.log 2>bash.err 42>bash.trace; then
|
||||||
for xfail in ${XFAIL:-}; do
|
for xfail in ${XFAIL:-}; do
|
||||||
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
|
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
|
||||||
echo "Ignoring expected failure of $SPREAD_TASK on $SPREAD_SYSTEM"
|
echo "Ignoring expected failure of $SPREAD_TASK on $SPREAD_SYSTEM"
|
||||||
@ -118,13 +119,17 @@ execute: |
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Test $SPREAD_VARIANT has unexpectedly failed"
|
echo "Test $SPREAD_VARIANT has unexpectedly failed"
|
||||||
echo "Test execution logs are in the files bash.{log.err} and are collected as artifacts"
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
for xfail in ${XFAIL:-}; do
|
for xfail in ${XFAIL:-}; do
|
||||||
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
|
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
|
||||||
echo "Test $SPREAD_VARIANT has unexpectedly passed"
|
echo "Test $SPREAD_VARIANT has unexpectedly passed"
|
||||||
echo "Test execution logs are in the files bash.{log.err} and are collected as artifacts"
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user