Fix distcheck: remove potentially-read-only files from builddir
[platform/upstream/dbus.git] / test / Makefile.am
1 ## the "name-test" subdir in fact contains a bunch of tests now that need a temporary bus 
2 ## to be running to do stuff with. The directory should be renamed.
3 ## We want to build the current directory first to pick up the testutils lib
4 SUBDIRS= . name-test 
5 DIST_SUBDIRS=name-test
6
7 AM_CPPFLAGS = \
8         -I$(top_srcdir) \
9         $(GLIB_CFLAGS) \
10         $(DBUS_GLIB_CFLAGS) \
11         $(NULL)
12
13 # improve backtraces from test stuff
14 AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
15
16 static_cppflags = \
17         $(AM_CPPFLAGS) \
18         -DDBUS_STATIC_BUILD \
19         $(NULL)
20
21 libdbus_testutils_la_CPPFLAGS = \
22         $(static_cppflags)
23 libdbus_testutils_la_SOURCES = \
24         test-utils.c \
25         test-utils.h \
26         $(NULL)
27 libdbus_testutils_la_LIBADD = \
28         $(top_builddir)/dbus/libdbus-internal.la \
29         $(NULL)
30
31 noinst_LTLIBRARIES = libdbus-testutils.la
32
33 if DBUS_BUILD_TESTS
34 ## break-loader removed for now
35 ## these binaries are used in tests but are not themselves tests
36 TEST_BINARIES = \
37         spawn-test \
38         test-exit \
39         test-names \
40         test-segfault \
41         test-service \
42         test-shell-service \
43         test-sleep-forever \
44         $(NULL)
45
46 ## These are conceptually part of directories that come earlier in SUBDIRS
47 ## order, but we don't want to run them til we arrive in this directory,
48 ## since they depend on stuff from this directory
49 TESTS = \
50         ../bus/bus-test$(EXEEXT) \
51         ../bus/bus-test-system$(EXEEXT) \
52         ../dbus/dbus-test$(EXEEXT) \
53         $(NULL)
54
55 if DBUS_UNIX
56 TESTS += ../bus/bus-test-launch-helper$(EXEEXT)
57 endif
58
59 else !DBUS_BUILD_TESTS
60
61 TEST_BINARIES=
62 TESTS=
63
64 endif !DBUS_BUILD_TESTS
65
66 noinst_PROGRAMS= $(TEST_BINARIES)
67
68 test_service_CPPFLAGS = $(static_cppflags)
69 test_service_LDADD = libdbus-testutils.la
70 test_names_CPPFLAGS = $(static_cppflags)
71 test_names_LDADD = libdbus-testutils.la
72 ## break_loader_CPPFLAGS = $(static_cppflags)
73 ## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la
74 test_shell_service_CPPFLAGS = $(static_cppflags)
75 test_shell_service_LDADD = libdbus-testutils.la
76 shell_test_CPPFLAGS = $(static_cppflags)
77 shell_test_LDADD = libdbus-testutils.la
78 spawn_test_CPPFLAGS = $(static_cppflags)
79 spawn_test_LDADD = $(top_builddir)/dbus/libdbus-internal.la
80
81 test_refs_SOURCES = internals/refs.c
82 test_refs_CPPFLAGS = $(static_cppflags)
83 test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
84
85 test_syslog_SOURCES = internals/syslog.c
86 test_syslog_CPPFLAGS = $(static_cppflags)
87 test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
88
89 EXTRA_DIST = dbus-test-runner
90
91 testexecdir = $(libdir)/dbus-1.0/test
92
93 testexec_PROGRAMS =
94
95 installable_tests = \
96         shell-test \
97         $(NULL)
98
99 if DBUS_WITH_GLIB
100 installable_tests += \
101         test-corrupt \
102         test-dbus-daemon \
103         test-dbus-daemon-eavesdrop \
104         test-loopback \
105         test-marshal \
106         test-refs \
107         test-relay \
108         test-syntax \
109         test-syslog \
110         $(NULL)
111 endif DBUS_WITH_GLIB
112
113 installcheck_tests =
114 installcheck_environment = \
115         DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT) \
116         DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \
117         DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir)
118
119 TESTS_ENVIRONMENT = \
120         DBUS_BLOCK_ON_ABORT=1 \
121         DBUS_FATAL_WARNINGS=1 \
122         DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \
123         DBUS_TEST_DATA=@abs_top_builddir@/test/data \
124         DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \
125         $(NULL)
126
127 test_corrupt_SOURCES = corrupt.c
128 test_corrupt_LDADD = $(top_builddir)/dbus/libdbus-1.la \
129     $(GLIB_LIBS) \
130     $(DBUS_GLIB_LIBS)
131
132 test_loopback_SOURCES = loopback.c
133 test_loopback_LDADD = $(top_builddir)/dbus/libdbus-1.la \
134     $(GLIB_LIBS) \
135     $(DBUS_GLIB_LIBS)
136
137 test_relay_SOURCES = relay.c
138 test_relay_LDADD = $(top_builddir)/dbus/libdbus-1.la \
139     $(GLIB_LIBS) \
140     $(DBUS_GLIB_LIBS)
141
142 test_dbus_daemon_SOURCES = dbus-daemon.c
143 test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \
144     $(GLIB_LIBS) \
145     $(DBUS_GLIB_LIBS)
146
147 test_dbus_daemon_eavesdrop_SOURCES = dbus-daemon-eavesdrop.c
148 test_dbus_daemon_eavesdrop_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS)
149 test_dbus_daemon_eavesdrop_LDFLAGS = @R_DYNAMIC_LDFLAG@
150 test_dbus_daemon_eavesdrop_LDADD = $(top_builddir)/dbus/libdbus-1.la \
151     $(GLIB_LIBS) \
152     $(DBUS_GLIB_LIBS)
153
154 test_marshal_SOURCES = marshal.c
155 test_marshal_LDADD = $(top_builddir)/dbus/libdbus-1.la \
156     $(GLIB_LIBS) \
157     $(DBUS_GLIB_LIBS)
158
159 test_syntax_SOURCES = syntax.c
160 test_syntax_LDADD = $(top_builddir)/dbus/libdbus-1.la \
161     $(GLIB_LIBS)
162
163 if DBUS_ENABLE_MODULAR_TESTS
164 TESTS += $(installable_tests)
165 installcheck_tests += $(installable_tests)
166
167 if DBUS_ENABLE_INSTALLED_TESTS
168   testexec_PROGRAMS += $(installable_tests)
169 else !DBUS_ENABLE_INSTALLED_TESTS
170   noinst_PROGRAMS += $(installable_tests)
171 endif !DBUS_ENABLE_INSTALLED_TESTS
172
173 endif DBUS_ENABLE_MODULAR_TESTS
174
175 # If we're installing the tests into a DESTDIR we can't run them
176 # again using the installed copy, because we don't know how to
177 # do a portable equivalent of setting LD_LIBRARY_PATH.
178 installcheck-local:
179         $(MAKE) check-TESTS TESTS='$$(installcheck_tests)' \
180                 TESTS_ENVIRONMENT='$$(installcheck_environment)'
181 if DBUS_ENABLE_INSTALLED_TESTS
182         test -n "$(DESTDIR)" || \
183         $(installcheck_environment) \
184                 $(srcdir)/dbus-test-runner \
185                 $(testexecdir) \
186                 $(testexec_PROGRAMS)
187 endif DBUS_ENABLE_INSTALLED_TESTS
188
189 in_data = \
190         data/valid-config-files-system/debug-allow-all-fail.conf.in \
191         data/valid-config-files-system/debug-allow-all-pass.conf.in \
192         data/valid-config-files/debug-allow-all-sha1.conf.in \
193         data/valid-config-files/debug-allow-all.conf.in \
194         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \
195         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \
196         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in \
197         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in \
198         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
199         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
200         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
201         data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in \
202         data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in \
203         data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in \
204         data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
205         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
206         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
207         $(NULL)
208
209 EXTRA_DIST += $(in_data)
210
211 static_data = \
212         name-test/tmp-session-like-system.conf \
213         data/auth/anonymous-client-successful.auth-script \
214         data/auth/anonymous-server-successful.auth-script \
215         data/auth/cancel.auth-script \
216         data/auth/client-out-of-mechanisms.auth-script \
217         data/auth/external-failed.auth-script \
218         data/auth/external-root.auth-script \
219         data/auth/external-silly.auth-script \
220         data/auth/external-successful.auth-script \
221         data/auth/extra-bytes.auth-script \
222         data/auth/fail-after-n-attempts.auth-script \
223         data/auth/fallback.auth-script \
224         data/auth/invalid-command-client.auth-script \
225         data/auth/invalid-command.auth-script \
226         data/auth/invalid-hex-encoding.auth-script \
227         data/auth/mechanisms.auth-script \
228         data/equiv-config-files/basic/basic-1.conf \
229         data/equiv-config-files/basic/basic-2.conf \
230         data/equiv-config-files/basic/basic.d/basic.conf \
231         data/equiv-config-files/entities/basic.d/basic.conf \
232         data/equiv-config-files/entities/entities-1.conf \
233         data/equiv-config-files/entities/entities-2.conf \
234         data/incomplete-messages/missing-body.message \
235         data/invalid-config-files/badselinux-1.conf \
236         data/invalid-config-files/badselinux-2.conf \
237         data/invalid-config-files/circular-1.conf \
238         data/invalid-config-files/circular-2.conf \
239         data/invalid-config-files/circular-3.conf \
240         data/invalid-config-files/not-well-formed.conf \
241         data/invalid-config-files/truncated-file.conf \
242         data/invalid-messages/array-of-nil.message \
243         data/invalid-messages/array-with-mixed-types.message \
244         data/invalid-messages/bad-boolean-array.message \
245         data/invalid-messages/bad-boolean.message \
246         data/invalid-messages/bad-endian.message \
247         data/invalid-messages/bad-header-field-alignment.message \
248         data/invalid-messages/boolean-has-no-value.message-raw \
249         data/invalid-messages/local-namespace.message \
250         data/invalid-messages/no-dot-in-name.message \
251         data/invalid-messages/not-nul-header-padding.message \
252         data/invalid-messages/overlong-name.message \
253         data/invalid-messages/too-little-header-padding.message \
254         data/invalid-messages/too-much-header-padding-by-far.message \
255         data/invalid-messages/too-much-header-padding.message \
256         data/invalid-messages/too-short-dict.message \
257         data/sha-1/Readme.txt \
258         data/sha-1/bit-hashes.sha1 \
259         data/sha-1/bit-messages.sha1 \
260         data/sha-1/byte-hashes.sha1 \
261         data/sha-1/byte-messages.sha1 \
262         data/valid-config-files/basic.conf \
263         data/valid-config-files/basic.d/basic.conf \
264         data/valid-config-files/entities.conf \
265         data/valid-config-files/incoming-limit.conf \
266         data/valid-config-files/many-rules.conf \
267         data/valid-config-files/system.d/test.conf \
268         data/valid-messages/array-of-array-of-uint32.message \
269         data/valid-messages/dict-simple.message \
270         data/valid-messages/dict.message \
271         data/valid-messages/emptiness.message \
272         data/valid-messages/lots-of-arguments.message \
273         data/valid-messages/no-padding.message \
274         data/valid-messages/opposite-endian.message \
275         data/valid-messages/recursive-types.message \
276         data/valid-messages/simplest-manual.message \
277         data/valid-messages/simplest.message \
278         data/valid-messages/standard-acquire-service.message \
279         data/valid-messages/standard-hello.message \
280         data/valid-messages/standard-list-services.message \
281         data/valid-messages/standard-service-exists.message \
282         data/valid-messages/unknown-header-field.message \
283         $(NULL)
284
285 EXTRA_DIST += $(static_data)
286
287 ## copy tests to builddir so that generated tests and static tests
288 ## are all in one place.
289 all-local:
290         $(AM_V_at)$(MKDIR_P) data/valid-config-files/session.d
291         $(AM_V_at)set -e && \
292         if test $(srcdir) = . || test $(srcdir) -ef .; then \
293                 echo '-- No need to copy test data as srcdir = builddir'; \
294         else \
295                 for F in $(static_data); do \
296                         $(MKDIR_P) $${F%/*}; \
297                         rm -f $$F; \
298                         cp $(srcdir)/$$F $$F; \
299                 done; \
300         fi
301
302 ## this doesn't clean most copied test data files when srcdir=builddir
303 clean-local:
304         $(AM_V_at)if test $(srcdir) = . || test $(srcdir) -ef .; then \
305                 echo '-- No need to clean test data as srcdir = builddir'; \
306         else \
307                 rm -f $(static_data); \
308         fi
309
310 imported_data = \
311         data/valid-config-files/session.conf \
312         data/valid-config-files/system.conf \
313         $(NULL)
314
315 noinst_DATA = $(imported_data)
316 CLEANFILES = $(noinst_DATA)
317
318 data/valid-config-files/session.conf: $(top_builddir)/bus/session.conf
319         $(AM_V_at)$(MKDIR_P) data/valid-config-files
320         $(AM_V_GEN)cp $< $@
321
322 data/valid-config-files/system.conf: $(top_builddir)/bus/system.conf
323         $(AM_V_at)$(MKDIR_P) data/valid-config-files
324         $(AM_V_GEN)cp $< $@