File: report.sh

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (43 lines) | stat: -rwxr-xr-x 1,079 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

# save failed logs to logs/, then print failure information
# returns failure code if any failed logs exist

# save step

SAVEDIR="logs"

# reset for local builds
rm -rf "$SAVEDIR"
mkdir "$SAVEDIR"

FAILED=$(mktemp)
grep -F 'Error!' -r . -l --null --include="*.log" > "$FAILED"

rsync -a --from0 --files-from="$FAILED" . "$SAVEDIR"
cp summary.log "$SAVEDIR"/

# cleanup
rm "$FAILED"

# print info
if [ -n "$CI" ] || [ -n "$PRINT_LOGS" ]; then
    find logs/ -name '*.log' -not -name 'summary.log' -print0 | while IFS= read -r -d '' file; do
        printf '%s\n' "$file"
        cat "$file"
        printf '\n'
    done
    printed_logs=1
fi

if grep -q -F 'Error!' summary.log ; then
    echo FAILURES;
    grep -F 'Error!' summary.log;
    if [ -z "$printed_logs" ]; then
        echo 'To print details of failed tests, rerun with environment variable PRINT_LOGS=1'
        echo 'eg "make report PRINT_LOGS=1" from the test suite directory"'
        echo 'See README.md in the test suite directory for more information.'
    fi
    false
else echo NO FAILURES;
fi