docs: deprecate .log -> .html conversion by parallel-tests
[automake.git] / tests / color.test
blobc1032fdc7b036a4113c478d5a6ba624387c0f83b
1 #! /bin/sh
2 # Copyright (C) 2007, 2008, 2010 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 # Test Automake TESTS color output, by forcing it.
18 # Keep this in sync with the sister test `color2.test'.
20 . ./defs || Exit 1
22 set -e
24 TERM=ansi
25 export TERM
27 red='\e[0;31m'
28 grn='\e[0;32m'
29 lgn='\e[1;32m'
30 blu='\e[1;34m'
31 std='\e[m'
33 # Check that grep can parse nonprinting characters.
34 # BSD 'grep' works from a pipe, but not a seekable file.
35 # GNU or BSD 'grep -a' works on files, but is not portable.
36 case `echo "$std" | grep .` in
37 "$std") ;;
38 *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
39 esac
41 cat >>configure.in <<END
42 AC_OUTPUT
43 END
45 cat >Makefile.am <<'END'
46 AUTOMAKE_OPTIONS = color-tests
47 TESTS = $(check_SCRIPTS)
48 check_SCRIPTS = pass fail skip xpass xfail
49 XFAIL_TESTS = xpass xfail
50 END
52 cat >pass <<END
53 #! /bin/sh
54 exit 0
55 END
57 cat >fail <<END
58 #! /bin/sh
59 exit 1
60 END
62 cat >skip <<END
63 #! /bin/sh
64 exit 77
65 END
67 cp fail xfail
68 cp pass xpass
69 chmod +x pass fail skip xpass xfail
71 $ACLOCAL
72 $AUTOMAKE
73 $AUTOCONF
74 ./configure
76 test_color ()
78 # Not a useless use of cat; see above comments about grep.
79 cat stdout | grep ": pass" | $FGREP "$grn"
80 cat stdout | grep ": fail" | $FGREP "$red"
81 cat stdout | grep ": xfail" | $FGREP "$lgn"
82 cat stdout | grep ": xpass" | $FGREP "$red"
83 cat stdout | grep ": skip" | $FGREP "$blu"
86 test_no_color ()
88 # Not a useless use of cat; see above comments about grep.
89 cat stdout | grep ": pass" | $FGREP "$grn" && Exit 1
90 cat stdout | grep ": fail" | $FGREP "$red" && Exit 1
91 cat stdout | grep ": xfail" | $FGREP "$lgn" && Exit 1
92 cat stdout | grep ": xpass" | $FGREP "$red" && Exit 1
93 cat stdout | grep ": skip" | $FGREP "$blu" && Exit 1
97 AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
98 cat stdout
99 test_color