diff --git a/tools/tracing/rtla/tests/engine.sh b/tools/tracing/rtla/tests/engine.sh index ab4fa0a8ded7..395b472921a7 100644 --- a/tools/tracing/rtla/tests/engine.sh +++ b/tools/tracing/rtla/tests/engine.sh @@ -9,6 +9,12 @@ test_begin() { testdir=$(dirname "$scriptfile") [ -z "$RTLA" ] && RTLA="$(pwd)/rtla" [ -n "$TEST_COUNT" ] && echo "1..$TEST_COUNT" + + # Convert newlines to spaces so that seq can be used + unset subtests + if [ -n "$SUBTESTS" ]; then + subtests=$(echo "$SUBTESTS"|tr '\n' ' ') + fi } reset_osnoise() { @@ -50,8 +56,7 @@ check() { # Simple check: run rtla with given arguments and test exit code. # If TEST_COUNT is set, run the test. Otherwise, just count. ctr=$(($ctr + 1)) - if [ -n "$TEST_COUNT" ] - then + if [[ -n "$TEST_COUNT" && ( -z "$subtests" || " $subtests " == *" $ctr "* ) ]]; then # Reset osnoise options before running test. [ "$NO_RESET_OSNOISE" == 1 ] || reset_osnoise @@ -62,6 +67,7 @@ check() { # Run rtla; in case of failure, include its output as comment # in the test results. result=$(eval stdbuf -oL $TIMEOUT "$RTLA" $2 2>&1); exitcode=$? + popd >/dev/null failbuf='' fail=0 @@ -90,10 +96,18 @@ check() { echo -n "$failbuf" echo "$result" | col -b | while read line; do echo "# $line"; done printf "#\n# exit code %s\n" $exitcode + + if [ -n "$STOPONFAIL" ]; then + # If the directory is not empty, tell the user where + # to find the output + if ! rmdir $tmpdir; then + echo "# output dir: $tmpdir" + fi + exit 1 + fi fi # Remove temporary directory - popd >/dev/null rm -r $tmpdir fi }