scc

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

commit 99f85528fd9bef81dac4612fed849aafb321dea1
parent 8935f439dc0a6b3c1dfc9f8b08f33ae09154ec96
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 10 Jan 2025 12:26:26 +0100

tests/make: Add 0100-signal.sh

Diffstat:
Atests/make/execute/0100-signal.sh | 39+++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)

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