2 # Copyright (C) 2011-2017 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/>.
18 # - colorization of TAP results and diagnostic messages
20 required
='grep-nonprint'
23 # Escape '[' for grep, below.
31 cat > Makefile.am
<< 'END'
32 AUTOMAKE_OPTIONS
= color-tests
33 AM_TEST_LOG_DRIVER_FLAGS
= --comments
34 TEST_LOG_COMPILER
= cat
35 TESTS
= all.
test skip.
test bail.
test badplan.
test noplan.
test \
36 few.
test many.
test order.
test afterlate.
test
41 cat > all.
test << 'END'
44 # Hi! I shouldn't be colorized!
45 not ok
2 - bar
# TODO td
51 cat > skip.
test << 'END'
52 1.
.0 # SKIP whole script
55 cat > bail.
test << 'END'
61 cat > badplan.
test << 'END'
68 cat > noplan.
test << 'END'
72 cat > few.
test << 'END'
77 cat > many.
test << 'END'
83 cat > order.
test << 'END'
88 cat > afterlate.
test << 'END'
96 # Not a useless use of cat; see above comments "grep-nonprinting"
97 # requirement in 'test-init.sh'.
98 cat stdout |
grep "^${grn}PASS${std}: all\.test 1 - foo$"
99 cat stdout |
grep "^${lgn}XFAIL${std}: all\.test 2 - bar # TODO td$"
100 cat stdout |
grep "^${blu}SKIP${std}: all\.test 3 - baz # SKIP sk$"
101 cat stdout |
grep "^${red}FAIL${std}: all\.test 4 - quux$"
102 cat stdout |
grep "^${red}XPASS${std}: all\.test 5 - zardoz # TODO$"
103 cat stdout |
grep "^${blu}SKIP${std}: skip\.test - whole script$"
104 cat stdout |
grep "^${grn}PASS${std}: bail\.test 1$"
105 cat stdout |
grep "^${mgn}ERROR${std}: bail\.test - Bail out!$"
106 cat stdout |
grep "^${mgn}ERROR${std}: badplan\.test - multiple test plans$"
107 cat stdout |
grep "^${mgn}ERROR${std}: noplan\.test - missing test plan$"
108 cat stdout |
grep "^${mgn}ERROR${std}: few.test - too few tests run (expected 2, got 1)$"
109 cat stdout |
grep "^${mgn}ERROR${std}: many.test - too many tests run (expected 1, got 2)$"
110 cat stdout |
grep "^${mgn}ERROR${std}: many.test 2 # UNPLANNED$"
111 cat stdout |
grep "^${mgn}ERROR${std}: order.test 5 # OUT-OF-ORDER (expecting 1)$"
112 cat stdout |
grep "^${mgn}ERROR${std}: afterlate\.test 2 # AFTER LATE PLAN$"
113 # Diagnostic messages shouldn't be colorized.
114 cat stdout |
grep "^# all\.test: Hi! I shouldn't be colorized!$"
120 # With make implementations that, like Solaris make, in case of errors
121 # print the whole failing recipe on standard output, we should content
122 # ourselves with a laxer check, to avoid false positives.
123 # Keep this in sync with lib/am/check.am:$(am__color_tests).
124 if $FGREP '= Xalways; then' stdout
; then
125 # Extra verbose make, resort to laxer checks.
126 # But we also want to check that the testsuite summary is not unduly
129 set +e
# In case some grepped regex below isn't matched.
130 # Not a useless use of cat; see above comments "grep-nonprinting"
131 # requirement in 'test-init.sh'.
132 cat stdout |
grep "TOTAL.*:"
133 cat stdout |
grep "PASS.*:"
134 cat stdout |
grep "FAIL.*:"
135 cat stdout |
grep "SKIP.*:"
136 cat stdout |
grep "XFAIL.*:"
137 cat stdout |
grep "XPASS.*:"
138 cat stdout |
grep "ERROR.*:"
139 cat stdout |
grep "^#"
140 cat stdout |
grep 'test.*expected'
141 cat stdout |
grep 'test.*not run'
142 cat stdout |
grep '===='
143 cat stdout |
grep '[Ss]ee .*test-suite\.log'
144 cat stdout |
grep '[Tt]estsuite summary'
145 ) |
grep "$esc" && exit 1
146 : For shells with broken
'set -e'
148 cat stdout |
grep "$esc" && exit 1
149 : For shells with broken
'set -e'
153 # Forced colorization should take place also with non-ANSI terminals;
154 # hence the "TERM=dumb" definition.
155 AM_COLOR_TESTS
=always
; export AM_COLOR_TESTS
156 run_make
-O -e FAIL TERM
=dumb check
160 run_make
-O -e FAIL TERM
=ansi check