Hash :
7b142a7b
Author :
Date :
2012-05-15T16:12:09
tests: use 'parallel-tests' Automake option by default This will help our transition from 'serial-tests' to 'parallel-tests' as the default test suite driver enabled by a TESTS assignment in the input Makefile.am. Note that that change of default will only take place in master, though. * defs: Pass the 'parallel-tests' option to the AM_INIT_AUTOMAKE invocation in the created 'configure.ac' stub, unless the variable 'am_serial_tests' is set to "yes". Don't pay attention anymore to the 'am_parallel_tests' variable, that's obsolete now. * defs-static.in: Warn if the 'am_serial_tests' variable is set in the environment; conversely, don't warn anymore about 'am_parallel_tests' being set in the environment. * Makefile.am (AM_TESTS_ENVIRONMENT): Nullify the 'am_serial_tests' variable instead of the now-obsolete 'am_parallel_tests' one. * syntax-checks.mk (sc_tests_obsolete_variables): Also warn against uses of 'am_parallel_tests', which is now deprecated in favor of 'am_serial_tests'. Similarly, if a use of 'parallel_tests' is seen, suggest using 'am_serial_tests' instead, not 'am_parallel_tests'. * gen-testsuite-part: Now that we use the 'parallel-tests' by default in our tests, we need to completely change the logic and semantics of generation of sibling tests for those tests that check the Automake generated testsuite harness itself. Do that, and give a complete explanation of the new logic and semantics in the relevant comments. * t/README: Update. * Lots of test cases: Adjust. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
#! /bin/sh
# Copyright (C) 2011-2012 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/>.
# More on TAP support:
# - more than one TAP-generating test script in $(TESTS)
# - VPATH builds
# - use with parallel make (if supported)
# - basic use of diagnostic messages (lines beginning with "#")
# - flags for TAP driver defined through AC_SUBST in configure.ac
# - messages generated by the testsuite harness reference the
# correct test script(s)
# - "make distcheck" works
. ./defs || Exit 1
fetch_tap_driver
cat >> configure.ac <<END
AC_SUBST([AM_TEST_LOG_DRIVER_FLAGS], ['--comments'])
AC_OUTPUT
END
cat > Makefile.am << 'END'
TEST_LOG_DRIVER = $(srcdir)/tap-driver
TESTS = 1.test 2.test 3.test
EXTRA_DIST = $(TESTS) tap-driver
END
cat > 1.test <<'END'
#! /bin/sh
echo 1..2
echo ok 1 - mu
if test -f not-skip; then
echo "not ok 2 zardoz"
else
echo "ok 2 zardoz # SKIP"
fi
END
cat > 2.test <<'END'
#! /bin/sh
echo 1..3
echo "ok"
echo "not ok # TODO not implemented"
echo "ok 3"
END
cat > 3.test <<END
#! /bin/sh
echo 1..1
echo ok - blah blah blah
echo '# Some diagnostic'
if test -f bail-out; then
echo 'Bail out! Kernel Panic'
else
:
fi
END
chmod a+x [123].test
$ACLOCAL
$AUTOCONF
$AUTOMAKE
# Try a VPATH and by default serial build first, and then an in-tree
# and by default parallel build.
for try in 0 1; do
if test $try -eq 0; then
# VPATH serial build.
mkdir build
cd build
srcdir=..
run_make=$MAKE
elif test $try -eq 1; then
# In-tree parallel build.
srcdir=.
case $MAKE in
*\ -j*)
# Degree of parallelism already specified by the user: do
# not override it.
run_make=$MAKE
;;
*)
# Some make implementations (e.g., HP-UX) don't grok '-j',
# some require no space between '-j' and the number of jobs
# (e.g., older GNU make versions), and some *do* require a
# space between '-j' and the number of jobs (e.g., Solaris
# dmake). We need a runtime test to see what works.
echo 'all:' > Makefile
for run_make in "$MAKE -j3" "$MAKE -j 3" "$MAKE"; do
$run_make && break
done
rm -f Makefile
;;
esac
else
fatal_ "internal error, invalid value of '$try' for \$try"
fi
$srcdir/configure
ls -l # For debugging.
# Success.
# Use append mode here to avoid dropping output. See automake bug#11413.
# Also, use 'echo' here to "nullify" the previous contents of 'stdout',
# since Solaris 10 /bin/sh would try to optimize a ':' away after the
# first iteration, even if it is redirected.
echo " " >stdout
$run_make check >>stdout || { cat stdout; Exit 1; }
cat stdout
count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0
grep '^PASS: 1\.test 1 - mu$' stdout
grep '^SKIP: 1\.test 2 zardoz # SKIP$' stdout
test `$FGREP -c '1.test' stdout` -eq 2
grep '^PASS: 2\.test 1$' stdout
grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
grep '^PASS: 2\.test 3$' stdout
test `$FGREP -c '2.test' stdout` -eq 3
grep '^PASS: 3\.test 1 - blah blah blah$' stdout
grep '^# 3\.test: Some diagnostic$' stdout
test `$FGREP -c '3.test' stdout` -eq 2
# Failure.
# Use 'echo' here, since Solaris 10 /bin/sh would try to optimize
# a ':' away after the first iteration, even if it is redirected.
echo dummy > not-skip
echo dummy > bail-out
# Use append mode here to avoid dropping output. See automake bug#11413.
# Also, use 'echo' here to "nullify" the previous contents of 'stdout',
# since Solaris 10 /bin/sh would try to optimize a ':' away after the
# first iteration, even if it is redirected.
echo " " >stdout
$run_make check >>stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1
grep '^PASS: 1\.test 1 - mu$' stdout
grep '^FAIL: 1\.test 2 zardoz$' stdout
test `$FGREP -c '1.test' stdout` -eq 2
grep '^PASS: 2\.test 1$' stdout
grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
grep '^PASS: 2\.test 3$' stdout
test `$FGREP -c '2.test' stdout` -eq 3
grep '^PASS: 3\.test 1 - blah blah blah$' stdout
grep '^# 3\.test: Some diagnostic$' stdout
grep '^ERROR: 3\.test - Bail out! Kernel Panic$' stdout
test `$FGREP -c '3.test' stdout` -eq 3
cd $srcdir
done
$MAKE distcheck
: