test-guild-compile: Increase sleep time before sending SIGINT.
[bpt/guile.git] / test-suite / standalone / test-guild-compile
1 #!/bin/sh
2 #
3 # This -*- sh -*- script tests whether 'guild compile' leaves traces
4 # behind it upon SIGINT.
5
6 source="t-guild-compile-$$"
7 target="$source.go"
8
9 trap 'rm -f "$source" "$target"' EXIT
10
11 cat > "$source"<<EOF
12 (eval-when (expand load eval)
13 (sleep 100))
14 (define chbouib 42)
15 EOF
16
17 guild compile -o "$target" "$source" &
18 pid="$!"
19
20 # Send SIGINT.
21 sleep 2 && kill -INT "$pid"
22
23 # Wait for 'guild compile' to terminate.
24 sleep 2
25
26 # Check whether there are any leftovers.
27 for file in "$target"*
28 do
29 if test "$file" != "${target}*"
30 then
31 echo "error: 'guild compile' failed to remove '$file'" >&2
32 rm "$target"*
33 kill "$pid"
34 exit 1
35 fi
36 done
37
38 if test -f "$target"
39 then
40 echo "error: '$target' produced" >&2
41 exit 1
42 fi