Hash :
5e3ae4e1
Author :
Date :
2011-08-05T10:36:06
testsuite: use AM_TESTS_FD_REDIRECT where appropriate * parallel-tests-interrupt.test: Use AM_TESTS_FD_REDIRECT, not AM_TESTS_ENVIRONMENT, to define file descriptors' redirection for "make check". Fix botched comment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
#! /bin/sh
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that the parallel-tests driver removed incomplete log files
# when interrupt upon some signal. This test is definitely too hacky,
# but we couldn't find a better way to deal with inter-processes
# signals and the whole process-synchronization mess.
parallel_tests=yes
. ./defs || Exit 1
cat >> configure.in << 'END'
AC_OUTPUT
END
cat > Makefile.am << 'END'
TESTS = foo.test
## Provide more debugging info.
TEST_LOG_COMPILER = $(SHELL) -x
## Required by foo.test; see below.
AM_TESTS_FD_REDIRECT = 9>&2
END
# This is hacky and ugly, but has the great advantage of avoiding us a lot
# of pain with background processes and related synchronization issues.
cat - "$top_testsrcdir"/lib/test-driver > test-driver <<'END'
#!/bin/sh
echo $$ > pid
END
cat > foo.test << 'END'
#!/bin/sh
exec 2>&9
echo "foo is starting to run"
ls -l >&2
cat foo.log >&2 || : > fail
grep '^foo is starting to run$' foo.log >&2 || : > fail
cat pid >&2 || : > fail
kill -$signum `cat pid` || : > fail
END
chmod a+x foo.test
$ACLOCAL
$AUTOCONF
$AUTOMAKE
./configure
# The only signals that can be trapped portable are 1 "SIGHUP",
# 2 "SIGINT", 13 "SIGPIPE" and 15 "SIGTERM".
trapped_signals='1 2 13 15'
for signum in $trapped_signals; do
rm -f pid fail *.log
env signum=$signum $MAKE check && { ls -l; Exit 1; }
ls -l
# These files shouldn't exist, but in case they do, their content might
# provide helpful information about the causes of the failure(s).
cat foo.log || :
cat test-suite.log || :
test -f fail && Exit 1
ls | $EGREP 'foo.*\.(log|tmp)' && Exit 1
done
: