| •1 |
#!/usr/bin/bashscip-shell filesystem . . `/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 |
rmscip-shell system . . rm. -rf "$SAVEDIR" |
| 12 |
mkdirscip-shell system . . mkdir. "$SAVEDIR" |
| 13 |
|
| 14 |
FAILED=$(mktempscip-shell system . . mktemp.) |
| 15 |
grepscip-shell system . . grep. -F 'Error!' -r . -l --null --include="*.log" > "$FAILED" |
| 16 |
|
| 17 |
rsyncscip-shell system . . rsync. -a --from0 --files-from="$FAILED" . "$SAVEDIR" |
| 18 |
cpscip-shell system . . cp. summary.log "$SAVEDIR"/ |
| 19 |
|
| 20 |
# cleanup |
| 21 |
rmscip-shell system . . rm. "$FAILED" |
| 22 |
|
| 23 |
# print info |
| 24 |
if [scip-shell system . . `[`. -n "$CI" ] || [scip-shell system . . `[`. -n "$PRINT_LOGS" ]; then |
| 25 |
findscip-shell system . . find. logs/ -name '*.log' -not -name 'summary.log' -print0 | while IFS= read -r -d '' file; do |
| 26 |
printfscip-shell system . . printf. '%s\n' "$file" |
| 27 |
catscip-shell system . . cat. "$file" |
| 28 |
printfscip-shell system . . printf. '\n' |
| 29 |
done |
| 30 |
printed_logs=1 |
| 31 |
fi |
| 32 |
|
| 33 |
if grepscip-shell system . . grep. -q -F 'Error!' summary.log ; then |
| 34 |
echoscip-shell system . . echo. FAILURES; |
| 35 |
grepscip-shell system . . grep. -F 'Error!' summary.log; |
| 36 |
if [scip-shell system . . `[`. -z "$printed_logs" ]; then |
| 37 |
echoscip-shell system . . echo. 'To print details of failed tests, rerun with environment variable PRINT_LOGS=1' |
| 38 |
echoscip-shell system . . echo. 'eg "make report PRINT_LOGS=1" from the test suite directory"' |
| 39 |
echoscip-shell system . . echo. 'See README.md in the test suite directory for more information.' |
| 40 |
fi |
| 41 |
falsescip-shell system . . false. |
| 42 |
else echoscip-shell system . . echo. NO FAILURES; |
| 43 |
fi |