1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
guile/test-suite/standalone/test-guild-compile
Ludovic Courtès 05bea208b3 tests: Make 'test-guild-compile' more reliable.
Before that it would occasionally fail because the "$target" (not the
intermediate temporary file) would be produced.

* test-suite/standalone/test-guild-compile: Call 'pause' before 'sleep'
  in test program.
2016-05-22 19:09:25 +02:00

47 lines
873 B
Bash
Executable file

#!/bin/sh
#
# This -*- sh -*- script tests whether 'guild compile' leaves traces
# behind it upon SIGINT.
source="t-guild-compile-$$"
target="$source.go"
trap 'rm -f "$source" "$target"' EXIT
cat > "$source"<<EOF
(eval-when (expand load eval)
;; Wait for SIGINT.
(pause)
;; Then sleep so that the SIGINT handler gets to run
;; and compilation doesn't complete before it runs.
(sleep 100))
(define chbouib 42)
EOF
guild compile -o "$target" "$source" &
pid="$!"
# Send SIGINT.
sleep 2 && kill -INT "$pid"
# Wait for 'guild compile' to terminate.
sleep 2
# Check whether there are any leftovers.
for file in "$target"*
do
if test "$file" != "${target}*"
then
echo "error: 'guild compile' failed to remove '$file'" >&2
rm "$target"*
kill "$pid"
exit 1
fi
done
if test -f "$target"
then
echo "error: '$target' produced" >&2
exit 1
fi