1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 15:21:37 +03:00
systemd/test/run-integration-tests.sh
Lennart Poettering 40235c3c5e tests: clean up again after running tests (#10446)
Currently, if I run the full "run-integration-tests.sh" script it will
fail on my machine because it fills up /var/tmp whith just too much
crap until the disk is full.

Let's make sure that "run-integration-tests.sh" cleans up after every
test. For that change the make targets to run from "clean setup run" to
"clean setup run clean" — except that that doesn't work since make is
smart enough to realize that the same target appears twice on the
command line and will only execute it once. Let's fix that by defining
another target "clean-again" which is just like "clean", but allows us
to be added to the same command line a second time. Then, let's build
with "clean setup run clean-again" and all is good.

While we are at it, let's also add .PHONY where appropriate, after all
these all are phony targets.
2018-10-19 03:59:24 +09:00

51 lines
1003 B
Bash
Executable File

#!/bin/bash -e
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
if [ $# -gt 0 ]; then
args="$@"
else
args="clean setup run clean-again"
fi
ninja -C "$BUILD_DIR"
declare -A results
COUNT=0
FAILURES=0
cd "$(dirname "$0")"
for TEST in TEST-??-* ; do
COUNT=$(($COUNT+1))
echo -e "\n--x-- Running $TEST --x--"
set +e
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args )
RESULT=$?
set -e
echo "--x-- Result of $TEST: $RESULT --x--"
results["$TEST"]="$RESULT"
[ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
done
echo ""
for TEST in ${!results[@]}; do
RESULT="${results[$TEST]}"
if [ "$RESULT" -eq "0" ] ; then
echo "$TEST: SUCCESS"
else
echo "$TEST: FAIL"
fi
done | sort
if [ "$FAILURES" -eq 0 ] ; then
echo -e "\nALL $COUNT TESTS PASSED"
else
echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
fi
exit "$FAILURES"