1## Makefile.in for ICU tests
2## Copyright (c) 1999-2014, International Business Machines Corporation and
3## others. All Rights Reserved.
4
5## Source directory information
6srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8
9top_builddir = ..
10
11include $(top_builddir)/icudefs.mk
12
13## Build directory information
14subdir = test
15
16@ICUIO_TRUE@IOTEST = iotest
17@LAYOUT_TRUE@LETEST = letest
18
19# status dir
20STATUS_TMP = tmp
21STATUS_FULL = $(shell pwd)/$(STATUS_TMP)
22
23## Files to remove for 'make clean'
24CLEANFILES = *~ $(STATUS_TMP)
25
26SUBDIRS = testdata intltest $(IOTEST) cintltst $(LETEST)
27
28## List of phony targets
29.PHONY : everything all all-local all-recursive install install-local		\
30install-recursive clean clean-local clean-recursive distclean		\
31distclean-local distclean-recursive dist dist-recursive dist-local	\
32check check-recursive check-local xcheck xcheck-recursive xcheck-local	\
33check-exhaustive check-exhaustive-recursive
34
35## Clear suffix list
36.SUFFIXES :
37
38## List of standard targets
39everything: all-recursive all-local
40all:
41ifneq ($(RECURSIVE),YES)
42	@echo simply use \`make\' \(or \`make everything\'\) to do all
43endif
44
45install: install-recursive install-local
46clean: clean-recursive clean-local
47distclean : distclean-recursive distclean-local
48	$(RMV) hdrtst/Makefile
49	$(RMV) perf/convperf/Makefile
50	$(RMV) $(STATUS_TMP)
51
52dist: dist-recursive dist-local
53check: everything check-recursive check-local
54check-recursive: all-recursive
55# the xcheck targets create a ../test-*.xml file in JUnit format.
56xcheck: everything xcheck-recursive xcheck-local
57xcheck-recursive: all-recursive
58check-exhaustive: everything check-exhaustive-recursive check-local
59
60## Recursive targets
61all-recursive install-recursive clean-recursive distclean-recursive dist-recursive:
62	@dot_seen=no; \
63	target=`echo $@ | sed s/-recursive//`; \
64	list='$(SUBDIRS)'; for subdir in $$list; do \
65	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
66	  if test "$$subdir" = "."; then \
67	    dot_seen=yes; \
68	    local_target="$$target-local"; \
69	  else \
70	    local_target="$$target"; \
71	  fi; \
72	  (cd $$subdir && $(MAKE) $$local_target) || exit; \
73	done; \
74	if test "$$dot_seen" = "no"; then \
75	  $(MAKE) "$$target-local" || exit; \
76	fi
77
78xcheck-recursive check-recursive check-exhaustive-recursive:
79	@$(MKINSTALLDIRS) $(STATUS_TMP)
80	@mystatus=$(STATUS_FULL)/status.$$$$.deleteme ; \
81	$(RMV) "$$mystatus".* ; \
82	@goods=; \
83	bads=; \
84	target=`echo $@ | sed s/-recursive//`; \
85	list='$(SUBDIRS)'; for subdir in $$list; do \
86	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
87	  local_target="$$target"; \
88	  if (cd $$subdir && $(MAKE) $$local_target TEST_STATUS_FILE="$$mystatus.$$subdir" ); then \
89	    goods="$$goods $$subdir"; \
90          else \
91            bads="$$bads $$subdir"; \
92          fi; \
93	done; \
94	for subdir in $$list; do \
95	  if [ -f "$$mystatus.$$subdir" ]; then \
96	    echo "-------------" ; \
97	    echo "| ***     FAILING TEST SUMMARY FOR:              $$subdir  " ; \
98	    cat "$$mystatus.$$subdir" ; \
99	    echo "| *** END FAILING TEST SUMMARY FOR:              $$subdir" ; \
100	    $(RMV) "$$mystatus.$$subdir" ; \
101	  fi; \
102	done; \
103	echo "---------------"; \
104	echo "ALL TESTS SUMMARY:"; \
105        if test ! "x$$bads" = "x"; then \
106	  echo "ok: $$goods"; \
107	  echo "===== ERRS: $$bads"; exit 1; \
108	else \
109	  echo "All tests OK: $$goods"; \
110	fi
111
112# pcheck = parallel check. We don't care about the output interleaving,
113# just run it as fast as possible.
114# todo would be to merge this code into the above non-parallel check.
115STATUS_NUM:=$(shell echo $$$$)
116MYSTATUS_R=$(STATUS_FULL)/status.$(STATUS_NUM).deleteme
117STATUS_FILES=$(SUBDIRS:%=$(MYSTATUS_R).%)
118
119pcheck_setup: testdata
120	@$(MKINSTALLDIRS) $(STATUS_TMP)
121	$(RMV) "$(MYSTATUS_R)".*
122	@echo Beginning parallel make. Output may be interleaved!
123
124$(STATUS_FULL)/status.$(STATUS_NUM).deleteme.%: pcheck_setup
125	-@$(MAKE) -C $* TEST_STATUS_FILE=$@ check || ( echo "FAILED: $* (other tests may still be running..)" ; touch $@ ; cp $@ $@.FAIL ; false )
126	-@[ ! -f $@.FAIL ] && touch $@.PASS && echo "PASSED: $* (other tests may still be running..)"
127	-@touch $@
128
129# print out status
130pcheck: $(STATUS_FILES)
131	@goods= ; \
132	bads= ; \
133	echo "----------------------------------------"; \
134	for subdir in $(SUBDIRS); do \
135	  if [ -s "$(MYSTATUS_R).$$subdir" ]; then \
136	    echo "-------------" ; \
137	    echo "| ***     FAILING TEST SUMMARY FOR:              $$subdir  " ; \
138	    cat "$(MYSTATUS_R).$$subdir" ; \
139	    echo "| *** END FAILING TEST SUMMARY FOR:              $$subdir" ; \
140	    $(RMV) "$(MYSTATUS_R).$$subdir" ; \
141	  fi; \
142	done; \
143	for subdir in $(SUBDIRS); do \
144		if [ -f "$(MYSTATUS_R).$$subdir.FAIL" ]; \
145		then \
146			bads="$$bads $$subdir" ; \
147		elif [ -f "$(MYSTATUS_R).$$subdir.PASS" ]; \
148		then \
149			goods="$$goods $$subdir" ; \
150		else \
151			echo "*** subtest did not complete - $$subdir" ; \
152			bads="$$bads $$subdir" ; \
153		fi ; \
154	done ; \
155	echo "ALL TESTS SUMMARY:"; \
156        if test ! "x$$bads" = "x"; then \
157	  echo "(to get non-interleaved err output, use \"$(MAKE) check\" instead.)" ; \
158	  echo "ok: $$goods"; \
159	  echo "===== ERRS: $$bads"; exit 1; \
160	else \
161	  echo "All tests OK: $$goods"; \
162	fi
163	-@$(RMV) "$(MYSTATUS_R)".*
164
165all-local:
166
167install-local:
168
169dist-local:
170
171clean-local:
172	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
173
174distclean-local: clean-local
175	$(RMV) Makefile
176
177xcheck-local check-local: all-local
178
179Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
180	cd $(top_builddir) \
181	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
182
183