mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
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>
This commit is contained in:
parent
cd8b75abc0
commit
2c2e0478f8
1 changed files with 8 additions and 3 deletions
|
@ -104,12 +104,13 @@ environment:
|
|||
artifacts:
|
||||
- bash.log
|
||||
- bash.err
|
||||
- bash.trace
|
||||
execute: |
|
||||
# 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
|
||||
# we can parallelize it through spread and also have a way to run precisely
|
||||
# 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
|
||||
if [ "$SPREAD_SYSTEM" = "$xfail" ]; then
|
||||
echo "Ignoring expected failure of $SPREAD_TASK on $SPREAD_SYSTEM"
|
||||
|
@ -118,13 +119,17 @@ execute: |
|
|||
done
|
||||
|
||||
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
|
||||
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} 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
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue