xref: /aosp_15_r20/external/cronet/third_party/apache-portable-runtime/src/test/Makefile (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1srcdir = .
2
3
4# PROGRAMS includes all test programs built on this platform.
5# STDTEST_PORTABLE
6#   test programs invoked via standard user interface, run on all platforms
7# TESTS
8#   test modules invoked through the abts suite (./testall)
9# STDTEST_NONPORTABLE
10#   test programs invoked via standard user interface, not portable
11# OTHER_PROGRAMS
12#   programs such as sockperf, that have to be invoked in a special sequence
13#   or with special parameters
14# TESTALL_COMPONENTS
15#   programs such as globalmutexchild which the various TESTS will invoke
16#   to validate process creation, pipes, dso mechanisms and so forth
17
18STDTEST_PORTABLE = \
19	testlockperf \
20	testmutexscope \
21	testall \
22	sendfile
23
24TESTS = testtime.lo teststr.lo testvsn.lo testipsub.lo testshm.lo \
25	testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo \
26	testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo \
27	testdso.lo testoc.lo testdup.lo testsockets.lo testproc.lo \
28	testpoll.lo testlock.lo testsockopt.lo testpipe.lo testthread.lo \
29	testhash.lo testargs.lo testnames.lo testuser.lo testpath.lo \
30	testenv.lo testprocmutex.lo testfnmatch.lo testatomic.lo testflock.lo \
31	testsock.lo testglobalmutex.lo teststrnatcmp.lo testfilecopy.lo \
32	testtemp.lo testlfs.lo testcond.lo testescape.lo testskiplist.lo
33
34OTHER_PROGRAMS = \
35	echod \
36	sockperf
37
38TESTALL_COMPONENTS = \
39	globalmutexchild \
40	libmod_test.la \
41	mod_test.la \
42	occhild \
43	proc_child \
44	readchild \
45	sockchild \
46	testshmproducer \
47	testshmconsumer \
48	tryread
49
50PROGRAMS = $(TESTALL_COMPONENTS) $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE) \
51	   $(OTHER_PROGRAMS)
52
53TARGETS = $(PROGRAMS)
54
55# bring in rules.mk for standard functionality
56include /ssd/chrome/repo/android/src/third_party/apache-portable-runtime/build/apr_rules.mk
57
58LOCAL_LIBS=../libapr-${APR_MAJOR_VERSION}.la
59
60CLEAN_TARGETS = testfile.tmp lfstests/*.bin \
61	data/test*.txt data/test*.dat data/apr.testshm.shm
62
63CLEAN_SUBDIRS = internal
64
65INCDIR=../include
66INCLUDES=-I$(INCDIR) -I$(srcdir)/../include
67
68# link programs using -no-install to get real executables not
69# libtool wrapper scripts which link an executable when first run.
70LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LT_LDFLAGS) \
71	    -no-install $(ALL_LDFLAGS) -o $@
72
73# STDTEST_PORTABLE;
74
75abts.lo: $(srcdir)/abts.c $(srcdir)/abts.h $(srcdir)/abts_tests.h \
76	 $(srcdir)/testutil.h
77
78testutil.lo: $(srcdir)/abts.c $(srcdir)/abts.h $(srcdir)/abts_tests.h \
79	     $(srcdir)/testutil.h
80
81OBJECTS_testall = abts.lo testutil.lo $(TESTS) $(LOCAL_LIBS)
82testall: $(OBJECTS_testall)
83	$(LINK_PROG) $(OBJECTS_testall) $(ALL_LIBS)
84# For VPATH builds; where we have no ./data, copy us some data
85# if we wait until 'make check', then 'make; ./testall' fails;
86	if test ! -d "./data"; then cp -r $(srcdir)/data data; fi
87
88OBJECTS_testlockperf = testlockperf.lo $(LOCAL_LIBS)
89testlockperf: $(OBJECTS_testlockperf)
90	$(LINK_PROG) $(OBJECTS_testlockperf) $(ALL_LIBS)
91
92OBJECTS_testmutexscope = testmutexscope.lo $(LOCAL_LIBS)
93testmutexscope: $(OBJECTS_testmutexscope)
94	$(LINK_PROG) $(OBJECTS_testmutexscope) $(ALL_LIBS)
95
96# OTHER_PROGRAMS;
97
98OBJECTS_echod = echod.lo $(LOCAL_LIBS)
99echod: $(OBJECTS_echod)
100	$(LINK_PROG) $(OBJECTS_echod) $(ALL_LIBS)
101
102OBJECTS_sendfile = sendfile.lo $(LOCAL_LIBS)
103sendfile: $(OBJECTS_sendfile)
104	$(LINK_PROG) $(OBJECTS_sendfile) $(ALL_LIBS)
105
106OBJECTS_sockperf = sockperf.lo $(LOCAL_LIBS)
107sockperf: $(OBJECTS_sockperf)
108	$(LINK_PROG) $(OBJECTS_sockperf) $(ALL_LIBS)
109
110# TESTALL_COMPONENTS;
111
112OBJECTS_globalmutexchild = globalmutexchild.lo $(LOCAL_LIBS)
113globalmutexchild: $(OBJECTS_globalmutexchild)
114	$(LINK_PROG) $(OBJECTS_globalmutexchild) $(ALL_LIBS)
115
116# Note -prefer-pic is only supported with libtool-1.4+
117mod_test.lo: $(srcdir)/mod_test.c
118	$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -prefer-pic -o $@ \
119	  -c $(srcdir)/mod_test.c
120
121OBJECTS_mod_test = mod_test.lo
122mod_test.la: $(OBJECTS_mod_test) $(LOCAL_LIBS)
123	$(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -rpath `pwd` -module \
124	  -avoid-version $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@ \
125	  $(OBJECTS_mod_test) $(LOCAL_LIBS)
126
127OBJECTS_libmod_test = mod_test.lo $(LOCAL_LIBS)
128libmod_test.la: $(OBJECTS_libmod_test)
129	$(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -rpath `pwd` \
130	  -avoid-version $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@ \
131	  $(OBJECTS_libmod_test) $(ALL_LIBS)
132
133OBJECTS_occhild = occhild.lo $(LOCAL_LIBS)
134occhild: $(OBJECTS_occhild)
135	$(LINK_PROG) $(OBJECTS_occhild) $(ALL_LIBS)
136
137OBJECTS_proc_child = proc_child.lo $(LOCAL_LIBS)
138proc_child: $(OBJECTS_proc_child)
139	$(LINK_PROG) $(OBJECTS_proc_child) $(ALL_LIBS)
140
141OBJECTS_readchild = readchild.lo $(LOCAL_LIBS)
142readchild: $(OBJECTS_readchild)
143	$(LINK_PROG) $(OBJECTS_readchild) $(ALL_LIBS)
144
145OBJECTS_sockchild = sockchild.lo $(LOCAL_LIBS)
146sockchild: $(OBJECTS_sockchild)
147	$(LINK_PROG) $(OBJECTS_sockchild) $(ALL_LIBS)
148
149OBJECTS_testshmconsumer = testshmconsumer.lo $(LOCAL_LIBS)
150testshmconsumer: $(OBJECTS_testshmconsumer) $(LOCAL_LIBS)
151	$(LINK_PROG) $(OBJECTS_testshmconsumer) $(ALL_LIBS)
152
153OBJECTS_testshmproducer = testshmproducer.lo $(LOCAL_LIBS)
154testshmproducer: $(OBJECTS_testshmproducer)
155	$(LINK_PROG) $(OBJECTS_testshmproducer) $(ALL_LIBS)
156
157OBJECTS_tryread = tryread.lo $(LOCAL_LIBS)
158tryread: $(OBJECTS_tryread)
159	$(LINK_PROG) $(OBJECTS_tryread) $(ALL_LIBS)
160
161check: $(TESTALL_COMPONENTS) $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE)
162	teststatus=0; \
163	progfailed=""; \
164	for prog in $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE); do \
165		if test "$$prog" = 'sendfile'; then \
166			for mode in blocking nonblocking timeout; do \
167				./$$prog client $$mode startserver 127.0.0.1; \
168				status=$$?; \
169				if test $$status != 0; then \
170					teststatus=$$status; \
171					progfailed="$$progfailed '$$prog mode $$mode'"; \
172				fi; \
173			done; \
174	        else \
175			./$$prog -v; \
176			status=$$?; \
177			if test $$status != 0; then \
178				teststatus=$$status; \
179				progfailed="$$progfailed $$prog"; \
180			fi; \
181		fi; \
182	done; \
183	if test $$teststatus != 0; then \
184		echo "Programs failed:$$progfailed"; \
185	fi; \
186	exit $$teststatus
187
188# DO NOT REMOVE
189