123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #! /bin/sh
- . test-init.sh
- plan_ 16
- cat >> configure.ac << 'END'
- AC_OUTPUT
- END
- cat > Makefile.am << 'END'
- TESTS = foo.test
- TEST_LOG_COMPILER = $(SHELL) -ex
- AM_TESTS_FD_REDIRECT = 9>&1
- END
- cat - "$am_scriptdir"/test-driver > test-driver <<'END'
- #!/bin/sh
- echo $$ > pid
- END
- cat > foo.test << 'END'
- trap 'exit 0' 0;
- stop_test () { exit 0; }
- $PERL -e 'BEGIN { $| = 1 }; print "foo is starting to run\n"' || stop_test
- ls -l >&9 || stop_test
- bailout ()
- {
-
-
-
- echo "Bail out! $*" >&9
- stop_test
- }
- test $sig -gt 0 || bailout "\$sig not exported to test script"
- res=ok; cat foo.log >&9 || res="not ok"
- echo "$res - logfile created and readable [SIG $sig]" >&9
- res=ok; grep '^foo is starting to run$' foo.log >&9 || res='not ok'
- echo "$res - logfile contains output from test script [SIG $sig]" >&9
- cat pid >&9 || bailout "cannot get PID of test driver"
- kill -$sig `cat pid` || bailout "cannot send signal $sig to test driver"
- stop_test
- END
- chmod a+x foo.test
- $ACLOCAL || fatal_ "aclocal failed"
- $AUTOCONF || fatal_ "autoconf failed"
- $AUTOMAKE || fatal_ "automake failed"
- ./configure || fatal_ "./configure failed"
- trapped_signals='1 2 13 15'
- for sig in $trapped_signals; do
- if is_blocked_signal $sig; then
- for i in 1 2 3 4; do echo "ok # SKIP signal $sig is blocked"; done
- continue
- fi
- rm -f pid fail *.log
- r=ok; env PERL="$PERL" sig="$sig" $MAKE check && r='not ok'
- echo "$r - signal $sig to test driver causes \"make check\" to fail"
- ls -l
-
-
- cat foo.log || :
- cat test-suite.log || :
- r=ok; ls | $EGREP 'foo.*\.(log|tmp)' && r='not ok'
- echo "$r - test driver clean up log and tmp files after signal $sig"
- done
- :
|