compile: implement library search to support MSVC static linking
[automake.git] / tests / color2.test
blobeedd37d2b41524b7fe033b4830ad9b71cd11531e
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, using the expect(1) program.
18 # Keep this in sync with the sister test `color.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 # Check that we have a working expect program.
42 cat >expect-check <<'END'
43 #! /usr/bin/expect -f
44 spawn $env(THE_SYSTEM_SHELL) -c :
45 expect eof
46 END
47 THE_SYSTEM_SHELL=/bin/sh expect -f expect-check || {
48 echo "$me: failed to find a working expect program" >&2
49 Exit 77
52 # Do the tests.
54 cat >>configure.in <<END
55 AC_OUTPUT
56 END
58 cat >Makefile.am <<'END'
59 AUTOMAKE_OPTIONS = color-tests
60 TESTS = $(check_SCRIPTS)
61 check_SCRIPTS = pass fail skip xpass xfail
62 XFAIL_TESTS = xpass xfail
63 END
65 cat >pass <<END
66 #! /bin/sh
67 exit 0
68 END
70 cat >fail <<END
71 #! /bin/sh
72 exit 1
73 END
75 cat >skip <<END
76 #! /bin/sh
77 exit 77
78 END
80 cp fail xfail
81 cp pass xpass
82 chmod +x pass fail skip xpass xfail
84 $ACLOCAL
85 $AUTOMAKE
86 $AUTOCONF
87 ./configure
89 test_color ()
91 # Not a useless use of cat; see above comments about grep.
92 cat stdout | grep ": pass" | $FGREP "$grn"
93 cat stdout | grep ": fail" | $FGREP "$red"
94 cat stdout | grep ": xfail" | $FGREP "$lgn"
95 cat stdout | grep ": xpass" | $FGREP "$red"
96 cat stdout | grep ": skip" | $FGREP "$blu"
99 test_no_color ()
101 # Not a useless use of cat; see above comments about grep.
102 cat stdout | grep ": pass" | $FGREP "$grn" && Exit 1
103 cat stdout | grep ": fail" | $FGREP "$red" && Exit 1
104 cat stdout | grep ": xfail" | $FGREP "$lgn" && Exit 1
105 cat stdout | grep ": xpass" | $FGREP "$red" && Exit 1
106 cat stdout | grep ": skip" | $FGREP "$blu" && Exit 1
110 cat >expect-make <<'END'
111 #! /usr/bin/expect -f
112 spawn $env(MAKE) -e check
113 expect eof
116 MAKE=$MAKE expect -f expect-make >stdout \
117 || { cat stdout; Exit 1; }
118 cat stdout
119 test_color
121 AM_COLOR_TESTS=no MAKE=$MAKE expect -f expect-make >stdout \
122 || { cat stdout; Exit 1; }
123 cat stdout
124 test_no_color