Update automake to version 1.10
[msysgit.git] / share / automake-1.10 / am / check.am
blob61c3031804518af3ef3f5129af77bf02c945dea0
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001, 2003, 2006 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, write to the Free Software
16 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 ## 02110-1301, USA.
19 .PHONY: check-TESTS
21 check-TESTS: $(TESTS)
22         @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[        ]'; \
23         srcdir=$(srcdir); export srcdir; \
24 ## Make sure Solaris VPATH-expands all members of this list, even
25 ## the first and the last one; thus the spaces around $(TESTS)
26         list=' $(TESTS) '; \
27         if test -n "$$list"; then \
28           for tst in $$list; do \
29             if test -f ./$$tst; then dir=./; \
30 ## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
31 ## why we also try `dir='
32             elif test -f $$tst; then dir=; \
33             else dir="$(srcdir)/"; fi; \
34             if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
35 ## Success
36               all=`expr $$all + 1`; \
37               case " $(XFAIL_TESTS) " in \
38               *$$ws$$tst$$ws*) \
39                 xpass=`expr $$xpass + 1`; \
40                 failed=`expr $$failed + 1`; \
41                 echo "XPASS: $$tst"; \
42               ;; \
43               *) \
44                 echo "PASS: $$tst"; \
45               ;; \
46               esac; \
47             elif test $$? -ne 77; then \
48 ## Failure
49               all=`expr $$all + 1`; \
50               case " $(XFAIL_TESTS) " in \
51               *$$ws$$tst$$ws*) \
52                 xfail=`expr $$xfail + 1`; \
53                 echo "XFAIL: $$tst"; \
54               ;; \
55               *) \
56                 failed=`expr $$failed + 1`; \
57                 echo "FAIL: $$tst"; \
58               ;; \
59               esac; \
60             else \
61 ## Skipped
62               skip=`expr $$skip + 1`; \
63               echo "SKIP: $$tst"; \
64             fi; \
65           done; \
66 ## Prepare the banner
67           if test "$$failed" -eq 0; then \
68             if test "$$xfail" -eq 0; then \
69               banner="All $$all tests passed"; \
70             else \
71               banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
72             fi; \
73           else \
74             if test "$$xpass" -eq 0; then \
75               banner="$$failed of $$all tests failed"; \
76             else \
77               banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
78             fi; \
79           fi; \
80 ## DASHES should contain the largest line of the banner.
81           dashes="$$banner"; \
82           skipped=""; \
83           if test "$$skip" -ne 0; then \
84             skipped="($$skip tests were not run)"; \
85             test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
86               dashes="$$skipped"; \
87           fi; \
88           report=""; \
89           if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
90             report="Please report to $(PACKAGE_BUGREPORT)"; \
91             test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
92               dashes="$$report"; \
93           fi; \
94           dashes=`echo "$$dashes" | sed s/./=/g`; \
95           echo "$$dashes"; \
96           echo "$$banner"; \
97           test -z "$$skipped" || echo "$$skipped"; \
98           test -z "$$report" || echo "$$report"; \
99           echo "$$dashes"; \
100           test "$$failed" -eq 0; \
101         else :; fi