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