]>
Commit | Line | Data |
---|---|---|
ff12a795 JT |
1 | #!/usr/bin/env bash |
2 | set -e | |
8fe9c8d9 | 3 | |
ded65775 | 4 | BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)" |
2535f23d | 5 | if [ $# -gt 0 ]; then |
cc5549ca | 6 | args="$@" |
2535f23d | 7 | else |
693ad298 | 8 | args="setup run clean-again" |
2535f23d | 9 | fi |
73abf7ae ZJS |
10 | args_no_clean=$(sed -r 's/(^| )clean($| )/ /g' <<<$args) |
11 | do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? ) | |
8fe9c8d9 | 12 | |
ded65775 | 13 | ninja -C "$BUILD_DIR" |
8fe9c8d9 LP |
14 | |
15 | declare -A results | |
5a89d7b3 | 16 | declare -A times |
8fe9c8d9 | 17 | |
967bae68 | 18 | COUNT=0 |
8fe9c8d9 LP |
19 | FAILURES=0 |
20 | ||
ded65775 | 21 | cd "$(dirname "$0")" |
8c3534b5 | 22 | |
73abf7ae ZJS |
23 | # Let's always do the cleaning operation first, because it destroys the image |
24 | # cache. | |
8c3534b5 ZJS |
25 | if [ $do_clean = 1 ]; then |
26 | for TEST in TEST-??-* ; do | |
27 | ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean ) | |
28 | done | |
29 | fi | |
30 | ||
3597bf75 ZJS |
31 | pass_blacklist() { |
32 | for marker in $BLACKLIST_MARKERS; do | |
33 | if [ -f "$1/$marker" ]; then | |
34 | echo "========== BLACKLISTED: $1 ($marker) ==========" | |
35 | return 1 | |
36 | fi | |
37 | done | |
38 | return 0 | |
39 | } | |
40 | ||
8fe9c8d9 | 41 | for TEST in TEST-??-* ; do |
cc5549ca | 42 | COUNT=$(($COUNT+1)) |
967bae68 | 43 | |
3597bf75 | 44 | pass_blacklist $TEST || continue |
5a89d7b3 | 45 | start=$(date +%s) |
3597bf75 | 46 | |
cc5549ca ZJS |
47 | echo -e "\n--x-- Running $TEST --x--" |
48 | set +e | |
73abf7ae | 49 | ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args_no_clean ) |
cc5549ca ZJS |
50 | RESULT=$? |
51 | set -e | |
52 | echo "--x-- Result of $TEST: $RESULT --x--" | |
8fe9c8d9 | 53 | |
cc5549ca | 54 | results["$TEST"]="$RESULT" |
5a89d7b3 | 55 | times["$TEST"]=$(( $(date +%s) - $start )) |
8fe9c8d9 | 56 | |
cc5549ca | 57 | [ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1)) |
8fe9c8d9 LP |
58 | done |
59 | ||
8c3534b5 | 60 | if [ $FAILURES -eq 0 -a $do_clean = 1 ]; then |
3597bf75 | 61 | for TEST in ${!results[@]}; do |
8c3534b5 ZJS |
62 | ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean-again ) |
63 | done | |
64 | fi | |
65 | ||
8fe9c8d9 LP |
66 | echo "" |
67 | ||
68 | for TEST in ${!results[@]}; do | |
cc5549ca | 69 | RESULT="${results[$TEST]}" |
5a89d7b3 ZJS |
70 | time="${times[$TEST]}" |
71 | string=$([ "$RESULT" = "0" ] && echo "SUCCESS" || echo "FAIL") | |
72 | printf "%-35s %-8s (%3s s)\n" "${TEST}:" "${string}" "$time" | |
8fe9c8d9 LP |
73 | done | sort |
74 | ||
75 | if [ "$FAILURES" -eq 0 ] ; then | |
cc5549ca | 76 | echo -e "\nALL $COUNT TESTS PASSED" |
8fe9c8d9 | 77 | else |
cc5549ca | 78 | echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT" |
8fe9c8d9 LP |
79 | fi |
80 | ||
81 | exit "$FAILURES" |