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'.
26 # Escape '[' for grep, below.
34 # Check that grep can parse nonprinting characters.
35 # BSD 'grep' works from a pipe, but not a seekable file.
36 # GNU or BSD 'grep -a' works on files, but is not portable.
37 case `echo "$std" | grep .` in
39 *) skip_ "grep can't parse nonprinting characters";;
42 cat >>configure.ac <<END
46 cat >Makefile.am <<'END'
47 AUTOMAKE_OPTIONS = color-tests
48 TESTS = $(check_SCRIPTS)
49 check_SCRIPTS = pass fail skip xpass xfail error
50 XFAIL_TESTS = xpass xfail
75 chmod +x pass fail skip xpass xfail error
79 $AUTOMAKE --add-missing
83 # Not a useless use of cat; see above comments about grep.
84 cat stdout | grep "^${grn}PASS${std}: .*pass"
85 cat stdout | grep "^${red}FAIL${std}: .*fail"
86 cat stdout | grep "^${blu}SKIP${std}: .*skip"
87 cat stdout | grep "^${lgn}XFAIL${std}: .*xfail"
88 cat stdout | grep "^${red}XPASS${std}: .*xpass"
89 # The old serial testsuite driver doesn't distinguish between failures
91 if test x"$am_parallel_tests" = x"yes"; then
92 cat stdout | grep "^${mgn}ERROR${std}: .*error"
94 cat stdout | grep "^${red}FAIL${std}: .*error"
101 # With make implementations that, like Solaris make, in case of errors
102 # print the whole failing recipe on standard output, we should content
103 # ourselves with a laxer check, to avoid false positives.
104 # Keep this in sync with lib/am/check.am:$(am__color_tests).
105 if $FGREP '= Xalways || test -t 1 ' stdout; then
106 # Extra verbose make, resort to laxer checks.
107 # Note that we also want to check that the testsuite summary is
108 # not unduly colorized.
110 set +e # In case some grepped regex below isn't matched.
111 # Not a useless use of cat; see above comments about grep.
112 cat stdout | grep "TOTAL.*:"
113 cat stdout | grep "PASS.*:"
114 cat stdout | grep "FAIL.*:"
115 cat stdout | grep "SKIP.*:"
116 cat stdout | grep "XFAIL.*:"
117 cat stdout | grep "XPASS.*:"
118 cat stdout | grep "ERROR.*:"
119 cat stdout | grep 'test.*expected'
120 cat stdout | grep 'test.*not run'
121 cat stdout | grep '===='
122 cat stdout | grep '[Ss]ee .*test-suite\.log'
123 cat stdout | grep '[Tt]estsuite summary'
124 ) | grep "$esc" && Exit 1
125 : For shells with broken 'set -e'
127 cat stdout | grep "$esc" && Exit 1
128 : For shells with broken 'set -e'
132 for vpath in false :; do
144 AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
148 $MAKE -e check >stdout && { cat stdout; Exit 1; }