scc

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

commit 08f9ec8a609965cecbb560144d0890efed8910ca
parent 1c6b69955c1fbe9c58d9bbb82419984ecc027614
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 10 Jan 2025 10:14:43 +0100

tests/make: Improve 0098-signal.sh

Remove the sleeps and use a global timeout instead.

Diffstat:
Mtests/make/execute/0098-signal.sh | 31+++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tests/make/execute/0098-signal.sh b/tests/make/execute/0098-signal.sh @@ -1,29 +1,36 @@ #!/bin/sh -trap 'rm -f file.txt; kill -KILL $pid 2>/dev/null' EXIT INT TERM HUP +cleanup() +{ + rm -f test.txt + kill -KILL $pid 2>/dev/null + if test $1 -ne 0 + then + kill -KILL $$ + fi +} + +trap 'cleanup 0' EXIT +trap 'cleanup 1' INT TERM HUP scc-make -f - <<'EOF' 2>&1 & file.txt: @touch $@ - @test -f $@ @while : ; do sleep 1 ; done EOF pid=$! -for i in 1 2 3 +sleep 10 && kill $$ 2>/dev/null & + +while : do if test -f file.txt then - kill $pid - for i in 1 2 3 - do - test -f file.txt || exit 0 - sleep 1 - done - exit 1 + kill $pid 2>/dev/null + wait $pid + break fi - sleep 1 done -exit 1 +! test -f file.txt