2 # Copyright (C) 2007-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 # Test Automake TESTS color output, by forcing it.
18 # Keep this in sync with the sister test 'color2.test'.
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
24 # Escape '[' for grep, below.
32 # Check that grep can parse nonprinting characters.
33 # BSD 'grep' works from a pipe, but not a seekable file.
34 # GNU or BSD 'grep -a' works on files, but is not portable.
35 case $(echo "$std" | grep .) in
37 *) skip_ "grep can't parse nonprinting characters";;
40 cat >>configure.ac <<END
44 cat >Makefile.am <<'END'
45 AUTOMAKE_OPTIONS = color-tests
46 TESTS = $(check_SCRIPTS)
47 check_SCRIPTS = pass fail skip xpass xfail error
48 XFAIL_TESTS = xpass xfail
73 chmod +x pass fail skip xpass xfail error
77 $AUTOMAKE --add-missing
81 # Not a useless use of cat; see above comments about grep.
82 cat stdout | grep "^${grn}PASS${std}: .*pass"
83 cat stdout | grep "^${red}FAIL${std}: .*fail"
84 cat stdout | grep "^${blu}SKIP${std}: .*skip"
85 cat stdout | grep "^${lgn}XFAIL${std}: .*xfail"
86 cat stdout | grep "^${red}XPASS${std}: .*xpass"
87 # The old serial testsuite driver doesn't distinguish between failures
89 if test x"$am_serial_tests" = x"yes"; then
90 cat stdout | grep "^${red}FAIL${std}: .*error"
92 cat stdout | grep "^${mgn}ERROR${std}: .*error"
99 # With make implementations that, like Solaris make, in case of errors
100 # print the whole failing recipe on standard output, we should content
101 # ourselves with a laxer check, to avoid false positives.
102 # Keep this in sync with lib/am/check.am:$(am__color_tests).
103 if $FGREP '= Xalways; then' stdout; then
104 # Extra verbose make, resort to laxer checks.
105 # Note that we also want to check that the testsuite summary is
106 # not unduly colorized.
108 set +e # In case some grepped regex below isn't matched.
109 # Not a useless use of cat; see above comments about grep.
110 cat stdout | grep "TOTAL.*:"
111 cat stdout | grep "PASS.*:"
112 cat stdout | grep "FAIL.*:"
113 cat stdout | grep "SKIP.*:"
114 cat stdout | grep "XFAIL.*:"
115 cat stdout | grep "XPASS.*:"
116 cat stdout | grep "ERROR.*:"
117 cat stdout | grep 'test.*expected'
118 cat stdout | grep 'test.*not run'
119 cat stdout | grep '===='
120 cat stdout | grep '[Ss]ee .*test-suite\.log'
121 cat stdout | grep '[Tt]estsuite summary'
122 ) | grep "$esc" && Exit 1
123 : For shells with broken 'set -e'
125 cat stdout | grep "$esc" && Exit 1
126 : For shells with broken 'set -e'
130 for vpath in false :; do
142 # Forced colorization should take place also with non-ANSI terminals;
143 # hence the "TERM=dumb" definition.
144 TERM=dumb AM_COLOR_TESTS=always $MAKE -e check >stdout \
145 && { cat stdout; Exit 1; }
149 TERM=ansi $MAKE -e check >stdout && { cat stdout; Exit 1; }