* automake.texi (Java Support): Added index, @section.
[automake.git] / check.am
blobefe605400312f6a8e31e7895e322251276c52667
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright 2001 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., 59 Temple Place - Suite 330, Boston, MA
17 ## 02111-1307, USA.
19 .PHONY: check-TESTS
21 check-TESTS: $(TESTS)
22         @failed=0; all=0; xfail=0; xpass=0; \
23         srcdir=$(srcdir); export srcdir; \
24         list='$(TESTS)'; \
25         if test -n "$$list"; then \
26           for tst in $$list; do \
27             if test -f ./$$tst; then dir=./; \
28 ## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
29 ## why we also try `dir='
30             elif test -f $$tst; then dir=; \
31             else dir="$(srcdir)/"; fi; \
32             if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
33               all=`expr $$all + 1`; \
34               case " $(XFAIL_TESTS) " in \
35               *" $$tst "*) \
36                 xpass=`expr $$xpass + 1`; \
37                 failed=`expr $$failed + 1`; \
38                 echo "XPASS: $$tst"; \
39               ;; \
40               *) \
41                 echo "PASS: $$tst"; \
42               ;; \
43               esac; \
44             elif test $$? -ne 77; then \
45               all=`expr $$all + 1`; \
46               case " $(XFAIL_TESTS) " in \
47               *" $$tst "*) \
48                 xfail=`expr $$xfail + 1`; \
49                 echo "XFAIL: $$tst"; \
50               ;; \
51               *) \
52                 failed=`expr $$failed + 1`; \
53                 echo "FAIL: $$tst"; \
54               ;; \
55               esac; \
56             fi; \
57           done; \
58           if test "$$failed" -eq 0; then \
59             if test "$$xfail" -eq 0; then \
60               banner="All $$all tests passed"; \
61             else \
62               banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
63             fi; \
64           else \
65             if test "$$xpass" -eq 0; then \
66               banner="$$failed of $$all tests failed"; \
67             else \
68               banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
69             fi; \
70           fi; \
71           dashes=`echo "$$banner" | sed s/./=/g`; \
72           echo "$$dashes"; \
73           echo "$$banner"; \
74           echo "$$dashes"; \
75           test "$$failed" -eq 0; \
76         fi