]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/run-integration-tests.sh
test: add test cases for RuntimeDirectoryPreserve=yes
[thirdparty/systemd.git] / test / run-integration-tests.sh
CommitLineData
ff12a795
JT
1#!/usr/bin/env bash
2set -e
8fe9c8d9 3
ded65775 4BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
2535f23d 5if [ $# -gt 0 ]; then
cc5549ca 6 args="$@"
2535f23d 7else
693ad298 8 args="setup run clean-again"
2535f23d 9fi
73abf7ae
ZJS
10args_no_clean=$(sed -r 's/(^| )clean($| )/ /g' <<<$args)
11do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
8fe9c8d9 12
ded65775 13ninja -C "$BUILD_DIR"
8fe9c8d9
LP
14
15declare -A results
5a89d7b3 16declare -A times
8fe9c8d9 17
967bae68 18COUNT=0
8fe9c8d9
LP
19FAILURES=0
20
ded65775 21cd "$(dirname "$0")"
8c3534b5 22
73abf7ae
ZJS
23# Let's always do the cleaning operation first, because it destroys the image
24# cache.
8c3534b5
ZJS
25if [ $do_clean = 1 ]; then
26 for TEST in TEST-??-* ; do
27 ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
28 done
29fi
30
3597bf75
ZJS
31pass_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 41for 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
58done
59
8c3534b5 60if [ $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
64fi
65
8fe9c8d9
LP
66echo ""
67
68for 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
73done | sort
74
75if [ "$FAILURES" -eq 0 ] ; then
cc5549ca 76 echo -e "\nALL $COUNT TESTS PASSED"
8fe9c8d9 77else
cc5549ca 78 echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
8fe9c8d9
LP
79fi
80
81exit "$FAILURES"