commit 36a1eef62de6d85631e2f6ae728620dec34454cc
parent 3a1198d1a58ea4e4aff5a3c127b9235e14e13c47
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 28 May 2026 11:39:48 +0200
tests/libc: Use timeout
While the timeout utility became standard only in POSIX 2024
it was available for many years in every UNIX alike system
and dealing directly wit signals and timeout in the shell it
is not easy and it was generating problems in OpenBSD.
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/tests/libc/execute/runtests.sh b/tests/libc/execute/runtests.sh
@@ -15,16 +15,10 @@ do
rm -f *.o $i $tmp1 $tmp2
(echo $i
- $CC $CFLAGS $LDFLAGS -o $i $i.c
+ ${MAKE-make} $i
echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
- $EXEC ./$i >$tmp2 2>&1 &
- pid=$!
- sleep 10 && echo timeout >> $tmp2 && kill $pid 2>/dev/null&
- timer=$!
- wait $pid
- kill $timer
- wait $timer
+ timeout 30 $EXEC ./$i >$tmp2 2>&1
if grep '^RESULT: SKIP$' $tmp2
then