Debian Codegraph @

test-suite/report.sh

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 #!/usr/bin/bash
2
3 # save failed logs to logs/, then print failure information
4 # returns failure code if any failed logs exist
5
6 # save step
7
8 SAVEDIR="logs"
9
10 # reset for local builds
11 rm -rf "$SAVEDIR"
12 mkdir "$SAVEDIR"
13
14 FAILED=$(mktemp)
15 grep -F 'Error!' -r . -l --null --include="*.log" > "$FAILED"
16
17 rsync -a --from0 --files-from="$FAILED" . "$SAVEDIR"
18 cp summary.log "$SAVEDIR"/
19
20 # cleanup
21 rm "$FAILED"
22
23 # print info
24 if [ -n "$CI" ] || [ -n "$PRINT_LOGS" ]; then
25 find logs/ -name '*.log' -not -name 'summary.log' -print0 | while IFS= read -r -d '' file; do
26 printf '%s\n' "$file"
27 cat "$file"
28 printf '\n'
29 done
30 printed_logs=1
31 fi
32
33 if grep -q -F 'Error!' summary.log ; then
34 echo FAILURES;
35 grep -F 'Error!' summary.log;
36 if [ -z "$printed_logs" ]; then
37 echo 'To print details of failed tests, rerun with environment variable PRINT_LOGS=1'
38 echo 'eg "make report PRINT_LOGS=1" from the test suite directory"'
39 echo 'See README.md in the test suite directory for more information.'
40 fi
41 false
42 else echo NO FAILURES;
43 fi