2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check parallel-tests features:
20 # - stdout and stderr of a test script go in its log file
21 # - TEST_SUITE_LOG redefinition, at either automake or make time
22 # - VERBOSE environment variable support
23 # Keep in sync with 'tap-log.test'.
28 cat >> configure.
in <<END
32 cat > Makefile.am
<< 'END'
33 TESTS
= pass.
test skip.
test xfail.
test fail.
test xpass.
test error.
test
34 XFAIL_TESTS
= xpass.
test xfail.
test
35 TEST_SUITE_LOG
= global.log
38 # Custom markers, for use in grepping checks.
39 cmarker
=::: # comment marker
40 pmarker
=%%% # plain maker
44 echo "$pmarker pass $pmarker" >&2
45 echo "# $cmarker pass $cmarker" >&2
51 echo "$pmarker skip $pmarker"
52 echo "# $cmarker skip $cmarker"
56 cat > xfail.
test <<END
58 echo "$pmarker xfail $pmarker" >&2
59 echo "# $cmarker xfail $cmarker" >&2
65 echo "$pmarker fail $pmarker"
66 echo "# $cmarker fail $cmarker"
70 cat > xpass.
test <<END
72 echo "$pmarker xpass $pmarker" >&2
73 echo "# $cmarker xpass $cmarker" >&2
77 cat > error.
test <<END
79 echo "$pmarker error $pmarker"
80 echo "# $cmarker error $cmarker"
92 TEST_SUITE_LOG
=my.log
$MAKE -e check
&& Exit
1
93 ls -l # For debugging.
94 test ! -f test-suite.log
98 for result
in pass fail xfail xpass skip error
; do
99 cat $result.log
# For debugging.
100 $FGREP "$pmarker $result $pmarker" $result.log || st
=1
101 $FGREP "$cmarker $result $cmarker" $result.log || st
=1
103 test $st -eq 0 || Exit
1
104 cat my.log
# For debugging.
105 for result
in xfail fail xpass skip error
; do
106 cat $result.log
# For debugging.
107 $FGREP "$pmarker $result $pmarker" my.log || st
=1
108 $FGREP "$cmarker $result $cmarker" my.log || st
=1
110 test `$FGREP -c "$pmarker" my.log` -eq 5
111 test `$FGREP -c "$cmarker" my.log` -eq 5
115 eqeq
=`echo "$1" | sed 's/./=/g'`
116 # Assume $1 contains no RE metacharacters.
117 sed -n "/^$1$/,/^$eqeq$/p" $2 > got
118 (echo "$1" && echo "$eqeq") > exp
124 # Passed test scripts shouldn't be mentioned in the global log.
125 $EGREP ':.*[^x]pass' my.log
&& Exit
1
126 # But failing (expectedly or not) and skipped ones should.
127 have_rst_section
'SKIP: skip' my.log
128 have_rst_section
'FAIL: fail' my.log
129 have_rst_section
'XFAIL: xfail' my.log
130 have_rst_section
'XPASS: xpass' my.log
131 have_rst_section
'ERROR: error' my.log
133 touch error2.log test-suite.log global.log
134 TEST_SUITE_LOG
=my.log
$MAKE -e mostlyclean
135 ls -l # For debugging.
143 # "make mostlyclean" shouldn't remove unrelated log files.
145 test -f test-suite.log
150 VERBOSE
=yes $MAKE check
>stdout
&& { cat stdout
; Exit
1; }
154 test ! -f test-suite.log
155 # Check that VERBOSE causes the global testsuite log to be
159 case $out in *"$log"*) ;; *) Exit
1;; esac
161 touch error2.log test-suite.log my.log
163 ls -l # For debugging.
171 # "make clean" shouldn't remove unrelated log files.
173 test -f test-suite.log