commit beae6fa9c8f59ad6441260412add9b9c84617cac from: Sven M. Hallberg date: Sun Jul 20 15:56:21 2025 UTC adapt-tst: run tests in the background commit - 0cbb500d5465f28a383fa7f778ca9daca3f7cebd commit + beae6fa9c8f59ad6441260412add9b9c84617cac blob - 75de0f328efa70906b9f140a69ae7dec8ed158b2 blob + 9c22585ae2e9587d11e6592284a19d66ccf4e4cb --- support/adapt-tst +++ support/adapt-tst @@ -26,13 +26,13 @@ do done shift $(($OPTIND - 1)) -# create temp. file for communicating with the test -tmp=/tmp/adapt-tst.$$ -trap "rm -f $tmp" EXIT - # initialize the counters run=0 ok=0 fail=0 error=0 +# create temp. file for communicating with the test +tmp=/tmp/adapt-tst.$$.tmp +trap "rm -f $tmp" EXIT + # clear the flag variables for the test executable unset D V K X [ $vflag -ge 2 ] && export V=1 @@ -41,9 +41,13 @@ unset D V K X D=1 "$cmd" "$@" >$tmp || exit 127 run=$(echo $(wc -l <$tmp)) -# perform the tests, counting and reporting results +# run the tests in the background, redirecting output to a fifo +rm -f $tmp +mkfifo $tmp || exit 127 +"$cmd" "$@" >$tmp & + +# interpret and report test results echo "run $run ok $ok fail $fail error $error" -"$cmd" "$@" >$tmp IFS= # disable field splitting to read the whole line while read -r line do @@ -70,6 +74,7 @@ do echo "run $run ok $ok fail $fail error $error" done <$tmp +wait # exit 0 if and only if the counters indicate a perfect run [ $ok -eq $run -a $fail -eq 0 -a $error -eq 0 ]