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