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