Faster `make uninstall'; fast install for JAVA.
[automake/ericb.git] / lib / am / check.am
blobdaae5a22367a9ed6795616f8949a085477d3311c
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001, 2003, 2006, 2007, 2008 Free Software Foundation,
3 ## Inc.
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3, or (at your option)
8 ## any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 if %?COLOR%
19 # If stdout is a non-dumb tty, use colors.  If test -t is not supported,
20 # then this fails; a conservative approach.  Of course do not redirect
21 # stdout here, just stderr.
22 am__tty_colors = \
23 red=; grn=; lgn=; blu=; std=; \
24 test "X$(AM_COLOR_TESTS)" != Xno \
25 && test "X$$TERM" != Xdumb \
26 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
27 && { \
28   red='\e[0;31m'; \
29   grn='\e[0;32m'; \
30   lgn='\e[1;32m'; \
31   blu='\e[1;34m'; \
32   std='\e[m'; \
34 else !%?COLOR%
35 am__tty_colors = \
36 red=; grn=; lgn=; blu=; std=
37 endif !%?COLOR%
39 .PHONY: check-TESTS
41 check-TESTS: $(TESTS)
42         @failed=0; all=0; xfail=0; xpass=0; skip=0; \
43         srcdir=$(srcdir); export srcdir; \
44 ## Make sure Solaris VPATH-expands all members of this list, even
45 ## the first and the last one; thus the spaces around $(TESTS)
46         list=' $(TESTS) '; \
47         $(am__tty_colors); \
48         if test -n "$$list"; then \
49           for tst in $$list; do \
50             if test -f ./$$tst; then dir=./; \
51 ## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
52 ## why we also try `dir='
53             elif test -f $$tst; then dir=; \
54             else dir="$(srcdir)/"; fi; \
55             if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
56 ## Success
57               all=`expr $$all + 1`; \
58               case " $(XFAIL_TESTS) " in \
59               *[\ \     ]$$tst[\ \      ]*) \
60                 xpass=`expr $$xpass + 1`; \
61                 failed=`expr $$failed + 1`; \
62                 col=$$red; res=XPASS; \
63               ;; \
64               *) \
65                 col=$$grn; res=PASS; \
66               ;; \
67               esac; \
68             elif test $$? -ne 77; then \
69 ## Failure
70               all=`expr $$all + 1`; \
71               case " $(XFAIL_TESTS) " in \
72               *[\ \     ]$$tst[\ \      ]*) \
73                 xfail=`expr $$xfail + 1`; \
74                 col=$$lgn; res=XFAIL; \
75               ;; \
76               *) \
77                 failed=`expr $$failed + 1`; \
78                 col=$$red; res=FAIL; \
79               ;; \
80               esac; \
81             else \
82 ## Skipped
83               skip=`expr $$skip + 1`; \
84               col=$$blu; res=SKIP; \
85             fi; \
86             echo "$${col}$$res$${std}: $$tst"; \
87           done; \
88 ## Prepare the banner
89           if test "$$failed" -eq 0; then \
90             if test "$$xfail" -eq 0; then \
91               banner="All $$all tests passed"; \
92             else \
93               banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
94             fi; \
95           else \
96             if test "$$xpass" -eq 0; then \
97               banner="$$failed of $$all tests failed"; \
98             else \
99               banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
100             fi; \
101           fi; \
102 ## DASHES should contain the largest line of the banner.
103           dashes="$$banner"; \
104           skipped=""; \
105           if test "$$skip" -ne 0; then \
106             skipped="($$skip tests were not run)"; \
107             test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
108               dashes="$$skipped"; \
109           fi; \
110           report=""; \
111           if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
112             report="Please report to $(PACKAGE_BUGREPORT)"; \
113             test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
114               dashes="$$report"; \
115           fi; \
116           dashes=`echo "$$dashes" | sed s/./=/g`; \
117           if test "$$failed" -eq 0; then \
118             echo "$$grn$$dashes"; \
119           else \
120             echo "$$red$$dashes"; \
121           fi; \
122           echo "$$banner"; \
123           test -z "$$skipped" || echo "$$skipped"; \
124           test -z "$$report" || echo "$$report"; \
125           echo "$$dashes$$std"; \
126           test "$$failed" -eq 0; \
127         else :; fi