scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit eddfeb0f04c1637175408192a13b9f296eebff57
parent b52667cdb794000f53c19e7055878bc0850f5acd
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Thu, 23 Apr 2026 10:33:45 +0200

tests/libc: Add timeout support in runtest

As we are adding time tests that depend of some time
events happen we can end having infinite loops if the
events don't arrive ever, and to avoid them we introduce
a 10s timeout.

Also, this commit introduces the EXEC variable that can
be used to run the tests using some emulator.

Diffstat:
Mtests/libc/execute/runtests.sh | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/libc/execute/runtests.sh b/tests/libc/execute/runtests.sh @@ -17,7 +17,16 @@ do (echo $i $CC $CFLAGS -o $i $i.c echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c - if ./$i 2>&1 | tee $tmp2 | grep '^RESULT: SKIP$' + + $EXEC ./$i 2>&1 > $tmp2 & + pid=$! + sleep 10 && echo timeout >> $tmp2 && kill $pid 2>/dev/null& + timer=$! + wait $pid + kill $timer + wait $timer + + if grep '^RESULT: SKIP$' $tmp2 then printf '\tSKIP\t%s\n' $i $state continue