2 # SPDX-License-Identifier: GPL-2.0
4 # Count tests to allow the test harness to double-check if all were
7 [ -z "$RTLA" ] && RTLA="./rtla"
8 [ -n "$TEST_COUNT" ] && echo "1..$TEST_COUNT"
12 # Simple check: run rtla with given arguments and test exit code.
13 # If TEST_COUNT is set, run the test. Otherwise, just count.
15 if [ -n "$TEST_COUNT" ]
17 # Run rtla; in case of failure, include its output as comment
18 # in the test results.
19 result=$(stdbuf -oL $TIMEOUT "$RTLA" $2 2>&1); exitcode=$?
20 if [ $exitcode -eq 0 ]
24 echo "not ok $ctr - $1"
25 # Add rtla output and exit code as comments in case of failure
26 echo "$result" | col -b | while read line; do echo "# $line"; done
27 printf "#\n# exit code %s\n" $exitcode
33 TIMEOUT="timeout -v -k 15s $1"
41 # If running without TEST_COUNT, tests are not actually run, just
42 # counted. In that case, re-run the test with the correct count.
43 [ -z "$TEST_COUNT" ] && TEST_COUNT=$ctr exec bash $0 || true
46 # Avoid any environmental discrepancies