tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / check10.sh
blobe76773c160bd9f3c64b05966d883abaffc2707a4
1 #! /bin/sh
2 # Copyright (C) 2008-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)
7 # any later version.
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 singular and plural in test summaries.
19 # This test only makes sense for the older serial testsuite driver.
20 am_serial_tests=yes
21 . ./defs || exit 1
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
27 cat > Makefile.am << 'END'
28 TESTS = fail pass skip xfail xpass fail2 pass2 skip2 xfail2 xpass2
29 XFAIL_TESTS = xfail xpass xfail2 xpass2
30 END
32 cat > pass <<'END'
33 #! /bin/sh
34 exit 0
35 END
36 cat > fail <<'END'
37 #! /bin/sh
38 exit 1
39 END
40 cat > skip <<'END'
41 #! /bin/sh
42 exit 77
43 END
44 chmod a+x pass fail skip
45 cp pass pass2
46 cp pass xpass
47 cp xpass xpass2
48 cp fail xfail
49 cp fail fail2
50 cp xfail xfail2
51 cp skip skip2
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
57 ./configure
59 # Do not check for failure in this subshell
60 set +e
61 env TESTS=pass $MAKE -e check
62 env TESTS=fail $MAKE -e check
63 env TESTS=skip $MAKE -e check
64 env TESTS=xfail $MAKE -e check
65 env TESTS=xpass $MAKE -e check
66 env TESTS="pass pass2" $MAKE -e check
67 env TESTS="fail fail2" $MAKE -e check
68 env TESTS="skip skip2" $MAKE -e check
69 env TESTS="xfail xfail2" $MAKE -e check
70 env TESTS="xpass xpass2" $MAKE -e check
71 env TESTS='pass skip xfail' $MAKE -e check
72 $MAKE check
74 ) >stdout || { cat stdout; exit 1; }
75 cat stdout
77 grep '1 [tT]ests' stdout && exit 1
78 grep '[02-9] [tT]est ' stdout && exit 1
79 grep '1 .* were ' stdout && exit 1
80 grep '[02-9].* was .*run' stdout && exit 1
81 grep 'All 1 ' stdout && exit 1
82 $EGREP '1 (un)?expected (failures|passes)' stdout && exit 1
83 $EGREP '[^1] (un)?expected (failure|pass)\)' stdout && exit 1