Add IgnoreOnIsolate=yes to dbus.service
[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 CLEANFILES =
8 EXTRA_DIST =
9
10 AM_CPPFLAGS = \
11         $(CODE_COVERAGE_CPPFLAGS) \
12         -I$(top_srcdir) \
13         $(DBUS_STATIC_BUILD_CPPFLAGS) \
14         -DDBUS_COMPILATION \
15         $(APPARMOR_CFLAGS) \
16         $(GLIB_CFLAGS) \
17         $(GIO_UNIX_CFLAGS) \
18         $(NULL)
19
20 # improve backtraces from test stuff
21 AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
22
23 AM_CFLAGS = \
24         $(CODE_COVERAGE_CFLAGS) \
25         $(NULL)
26
27 noinst_LTLIBRARIES = libdbus-testutils.la
28
29 libdbus_testutils_la_SOURCES = \
30         test-utils.c \
31         test-utils.h \
32         $(NULL)
33
34 if DBUS_WITH_GLIB
35 libdbus_testutils_la_SOURCES += \
36         test-utils-glib.c \
37         test-utils-glib.h \
38         $(NULL)
39 endif
40
41 libdbus_testutils_la_LIBADD = \
42         $(CODE_COVERAGE_LIBS) \
43         $(top_builddir)/dbus/libdbus-1.la \
44         $(top_builddir)/dbus/libdbus-internal.la \
45         $(NULL)
46
47 TEST_EXTENSIONS = .sh
48
49 LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh
50 LOG_COMPILER = $(srcdir)/glib-tap-test.sh
51 SH_LOG_DRIVER = $(LOG_DRIVER)
52 SH_LOG_COMPILER = $(SHELL)
53 EXTRA_DIST += glib-tap-test.sh
54 EXTRA_DIST += tap-test.sh.in
55
56 TESTS =
57
58 if DBUS_ENABLE_EMBEDDED_TESTS
59 ## break-loader removed for now
60 ## these binaries are used in tests but are not themselves tests
61 TEST_BINARIES = \
62         test-spawn \
63         test-exit \
64         test-names \
65         test-segfault \
66         test-service \
67         test-shell-service \
68         test-sleep-forever \
69         $(NULL)
70
71 ## These are conceptually part of directories that come earlier in SUBDIRS
72 ## order, but we don't want to run them til we arrive in this directory,
73 ## since they depend on stuff from this directory. We wrap them in a
74 ## simple shell script to get TAP output.
75
76 wrap_bus_tests = test-bus.sh
77 wrap_dbus_tests = test-dbus.sh
78
79 if DBUS_UNIX
80 wrap_bus_tests += test-bus-launch-helper.sh
81 wrap_bus_tests += test-bus-system.sh
82 endif
83
84 TESTS += $(wrap_bus_tests) $(wrap_dbus_tests)
85 CLEANFILES += $(wrap_bus_tests) $(wrap_dbus_tests)
86
87 $(wrap_bus_tests): test-bus%.sh: ../bus/test-bus%$(EXEEXT) tap-test.sh.in Makefile
88         sed -e 's![@]RUN[@]!$<!' \
89                 < $(srcdir)/tap-test.sh.in > $@
90
91 $(wrap_dbus_tests): test-dbus%.sh: ../dbus/test-dbus%$(EXEEXT) tap-test.sh.in Makefile
92         sed -e 's![@]RUN[@]!$<!' \
93                 < $(srcdir)/tap-test.sh.in > $@
94
95 else !DBUS_ENABLE_EMBEDDED_TESTS
96
97 TEST_BINARIES=
98
99 endif !DBUS_ENABLE_EMBEDDED_TESTS
100
101 noinst_PROGRAMS= $(TEST_BINARIES)
102
103 test_service_LDADD = libdbus-testutils.la
104 test_names_LDADD = libdbus-testutils.la
105 ## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la
106 test_shell_service_LDADD = libdbus-testutils.la
107 test_shell_SOURCES = shell-test.c
108 test_shell_LDADD = libdbus-testutils.la
109 test_spawn_SOURCES = spawn-test.c
110 test_spawn_LDADD = $(top_builddir)/dbus/libdbus-internal.la
111
112 test_printf_SOURCES = internals/printf.c
113 test_printf_LDADD = $(top_builddir)/dbus/libdbus-internal.la
114
115 test_refs_SOURCES = internals/refs.c
116 test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
117
118 test_server_oom_SOURCES = internals/server-oom.c
119 test_server_oom_LDADD = libdbus-testutils.la $(GLIB_LIBS)
120
121 test_syslog_SOURCES = internals/syslog.c
122 test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
123
124 test_variant_SOURCES = internals/variant.c
125 test_variant_LDADD = libdbus-testutils.la $(GLIB_LIBS)
126
127 manual_backtrace_SOURCES = manual-backtrace.c
128 manual_backtrace_LDADD = $(top_builddir)/dbus/libdbus-1.la
129
130 manual_dir_iter_SOURCES = manual-dir-iter.c
131 manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la
132
133 manual_paths_SOURCES = manual-paths.c
134 manual_paths_LDADD = $(top_builddir)/dbus/libdbus-internal.la
135
136 manual_tcp_SOURCES = manual-tcp.c
137 manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la
138
139 EXTRA_DIST += dbus-test-runner
140
141 testexecdir = $(libexecdir)/installed-tests/dbus
142 testmetadir = $(datadir)/installed-tests/dbus
143
144 nobase_dist_testexec_SCRIPTS =
145 nobase_testexec_PROGRAMS =
146 nobase_testmeta_DATA =
147
148 installable_helpers = \
149         $(NULL)
150 installable_tests = \
151         test-shell \
152         test-printf \
153         $(NULL)
154 installable_manual_tests = \
155         manual-backtrace \
156         manual-dir-iter \
157         manual-tcp \
158         $(NULL)
159 dist_installable_test_scripts = \
160         $(NULL)
161 dist_installed_test_scripts = \
162         $(NULL)
163
164 if DBUS_WIN
165 installable_manual_tests += manual-paths
166 endif
167
168 if DBUS_WITH_GLIB
169 installable_tests += \
170         test-corrupt \
171         test-dbus-daemon \
172         test-dbus-daemon-eavesdrop \
173         test-fdpass \
174         test-message \
175         test-monitor \
176         test-loopback \
177         test-marshal \
178         test-refs \
179         test-relay \
180         test-server-oom \
181         test-syntax \
182         test-syslog \
183         test-uid-permissions \
184         test-variant \
185         $(NULL)
186
187 if DBUS_UNIX
188 # These binaries are used in tests but are not themselves tests
189 installable_helpers += \
190         test-apparmor-activation \
191         $(NULL)
192
193 installable_tests += \
194         test-sd-activation \
195         $(NULL)
196
197 dist_installable_test_scripts += \
198         test-dbus-daemon-fork.sh \
199         $(NULL)
200
201 # Only runnable when installed, not from the source tree
202 dist_installed_test_scripts += \
203         integration/transient-services.sh \
204         test-apparmor-activation.sh \
205         $(NULL)
206
207 # Testing dbus-launch relies on special code in that binary.
208 if DBUS_ENABLE_EMBEDDED_TESTS
209 dist_installable_test_scripts += \
210         test-dbus-launch-eval.sh \
211         $(NULL)
212
213 if DBUS_ENABLE_X11_AUTOLAUNCH
214 dist_installable_test_scripts += \
215         test-dbus-launch-x11.sh \
216         $(NULL)
217 endif DBUS_ENABLE_X11_AUTOLAUNCH
218 endif DBUS_ENABLE_EMBEDDED_TESTS
219
220 endif DBUS_UNIX
221
222 installable_manual_tests += \
223         manual-authz \
224         manual-test-thread-blocking \
225         $(NULL)
226 endif DBUS_WITH_GLIB
227
228 installable_test_meta = \
229         $(dist_installable_test_scripts:=.test) \
230         $(dist_installed_test_scripts:=.test) \
231         $(installable_tests:=.test) \
232         $(NULL)
233 installable_test_meta_with_config = \
234         $(dist_installable_test_scripts:=_with_config.test) \
235         $(dist_installed_test_scripts:=_with_config.test) \
236         $(installable_tests:=_with_config.test) \
237         $(NULL)
238
239 installcheck_tests =
240 installcheck_environment = \
241         export XDG_DATA_HOME=@abs_top_builddir@/test/XDG_DATA_HOME; \
242         export XDG_DATA_DIRS=@abs_top_builddir@/test/XDG_DATA_DIRS:$(DESTDIR)$(datadir); \
243         export XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR; \
244         export DBUS_SESSION_BUS_ADDRESS=do-not-use-real-session:; \
245         export DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT); \
246         export DBUS_TEST_DBUS_LAUNCH=$(DESTDIR)$(bindir)/dbus-launch$(EXEEXT); \
247         export DBUS_TEST_DBUS_MONITOR=$(DESTDIR)$(bindir)/dbus-monitor$(EXEEXT); \
248         export DBUS_TEST_DBUS_SEND=$(DESTDIR)$(bindir)/dbus-send$(EXEEXT); \
249         export DBUS_TEST_DBUS_UUIDGEN=$(DESTDIR)$(bindir)/dbus-uuidgen$(EXEEXT); \
250         export DBUS_TEST_EXEC=@abs_top_builddir@/test; \
251         export DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus; \
252         export DBUS_TEST_DATADIR=$(DESTDIR)$(datadir); \
253         export DBUS_TEST_UNINSTALLED=1; \
254         export HOME=@abs_top_builddir@/dbus; \
255         ${NULL}
256
257 # Tests in bus/config-parser.c rely on these specific values for XDG_* and
258 # DBUS_TEST_BUILDDIR.
259 AM_TESTS_ENVIRONMENT = \
260         export XDG_DATA_HOME=@abs_top_builddir@/test/XDG_DATA_HOME; \
261         export XDG_DATA_DIRS=@abs_top_builddir@/test/XDG_DATA_DIRS:@abs_top_builddir@/test/XDG_DATA_DIRS2; \
262         export XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR; \
263         export DBUS_FATAL_WARNINGS=1; \
264         export DBUS_SESSION_BUS_ADDRESS=do-not-use-real-session:; \
265         export DBUS_TEST_BUILDDIR=@abs_builddir@; \
266         export DBUS_TEST_SRCDIR=@abs_srcdir@; \
267         export DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT); \
268         export DBUS_TEST_DBUS_LAUNCH=@abs_top_builddir@/tools/dbus-launch$(EXEEXT); \
269         export DBUS_TEST_DBUS_MONITOR=@abs_top_builddir@/tools/dbus-monitor$(EXEEXT); \
270         export DBUS_TEST_DBUS_SEND=@abs_top_builddir@/tools/dbus-send$(EXEEXT); \
271         export DBUS_TEST_DBUS_UUIDGEN=@abs_top_builddir@/tools/dbus-uuidgen$(EXEEXT); \
272         export DBUS_TEST_DATA=@abs_top_builddir@/test/data; \
273         export DBUS_TEST_EXEC=@abs_top_builddir@/test; \
274         export DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus; \
275         export DBUS_TEST_UNINSTALLED=1; \
276         export HOME=@abs_top_builddir@/dbus; \
277         $(NULL)
278
279 manual_authz_SOURCES = manual-authz.c
280 manual_authz_LDADD = \
281     libdbus-testutils.la \
282     $(GLIB_LIBS) \
283     $(NULL)
284
285 if DBUS_UNIX
286 test_apparmor_activation_CPPFLAGS = \
287     $(AM_CPPFLAGS) \
288     -DDBUS_TEST_APPARMOR_ACTIVATION \
289     $(NULL)
290 test_apparmor_activation_SOURCES = \
291     sd-activation.c \
292     $(NULL)
293 test_apparmor_activation_LDADD = \
294     libdbus-testutils.la \
295     $(APPARMOR_LIBS) \
296     $(GLIB_LIBS) \
297     $(NULL)
298 endif
299
300 test_corrupt_SOURCES = corrupt.c
301 test_corrupt_LDADD = \
302     libdbus-testutils.la \
303     $(GLIB_LIBS) \
304     $(NULL)
305
306 test_loopback_SOURCES = loopback.c
307 test_loopback_LDADD = \
308     libdbus-testutils.la \
309     $(GLIB_LIBS) \
310     $(NULL)
311
312 test_relay_SOURCES = relay.c
313 test_relay_LDADD = \
314     libdbus-testutils.la \
315     $(GLIB_LIBS) \
316     $(NULL)
317
318 test_dbus_daemon_SOURCES = dbus-daemon.c
319 test_dbus_daemon_LDADD = \
320     libdbus-testutils.la \
321     $(GLIB_LIBS) \
322     $(GIO_UNIX_LIBS) \
323     $(NULL)
324
325 test_dbus_daemon_eavesdrop_SOURCES = dbus-daemon-eavesdrop.c
326 test_dbus_daemon_eavesdrop_LDADD = \
327     libdbus-testutils.la \
328     $(GLIB_LIBS) \
329     $(NULL)
330
331 if DBUS_UNIX
332 test_sd_activation_SOURCES = \
333     sd-activation.c \
334     $(NULL)
335 test_sd_activation_LDADD = \
336     libdbus-testutils.la \
337     $(GLIB_LIBS) \
338     $(NULL)
339 endif
340
341 test_marshal_SOURCES = marshal.c
342 test_marshal_LDADD = \
343     libdbus-testutils.la \
344     $(GLIB_LIBS) \
345     $(NULL)
346
347 test_message_SOURCES = \
348     message.c \
349     $(NULL)
350 test_message_LDADD = \
351     libdbus-testutils.la \
352     $(top_builddir)/dbus/libdbus-internal.la \
353     $(GLIB_LIBS) \
354     $(NULL)
355
356 test_monitor_SOURCES = \
357     monitor.c \
358     $(NULL)
359 test_monitor_LDADD = \
360     libdbus-testutils.la \
361     $(GLIB_LIBS) \
362     $(NULL)
363
364 test_syntax_SOURCES = syntax.c
365 test_syntax_LDADD = \
366     libdbus-testutils.la \
367     $(GLIB_LIBS) \
368     $(NULL)
369
370 manual_test_thread_blocking_SOURCES = thread-blocking.c
371 manual_test_thread_blocking_LDADD = \
372     libdbus-testutils.la \
373     $(GLIB_LIBS) \
374     $(NULL)
375
376 test_uid_permissions_SOURCES = \
377     uid-permissions.c \
378     $(NULL)
379 test_uid_permissions_LDADD = \
380     libdbus-testutils.la \
381     $(GLIB_LIBS) \
382     $(NULL)
383
384 test_fdpass_SOURCES = \
385     fdpass.c \
386     $(NULL)
387 test_fdpass_LDADD = \
388     libdbus-testutils.la \
389     $(GLIB_LIBS) \
390     $(NULL)
391
392 TESTS += $(dist_installable_test_scripts)
393 installcheck_tests += $(dist_installable_test_scripts)
394
395 if DBUS_ENABLE_MODULAR_TESTS
396 TESTS += $(installable_tests)
397 installcheck_tests += $(installable_tests)
398
399 if DBUS_ENABLE_INSTALLED_TESTS
400   nobase_testexec_PROGRAMS += $(installable_helpers)
401   nobase_testexec_PROGRAMS += $(installable_manual_tests)
402   nobase_testexec_PROGRAMS += $(installable_tests)
403   nobase_dist_testexec_SCRIPTS += $(dist_installed_test_scripts)
404   nobase_dist_testexec_SCRIPTS += $(dist_installable_test_scripts)
405
406   nobase_testmeta_DATA += $(installable_test_meta)
407   nobase_testmeta_DATA += $(installable_test_meta_with_config)
408 else !DBUS_ENABLE_INSTALLED_TESTS
409   noinst_PROGRAMS += $(installable_tests) $(installable_manual_tests)
410 endif !DBUS_ENABLE_INSTALLED_TESTS
411
412 endif DBUS_ENABLE_MODULAR_TESTS
413
414 # If we're installing the tests into a DESTDIR we can't run them
415 # again using the installed copy, because we don't know how to
416 # do a portable equivalent of setting LD_LIBRARY_PATH.
417 installcheck-local:
418         $(MAKE) check-TESTS TESTS='$$(installcheck_tests)' \
419                 AM_TESTS_ENVIRONMENT='$$(installcheck_environment)'
420 if DBUS_ENABLE_INSTALLED_TESTS
421         test -n "$(DESTDIR)" || { \
422         $(installcheck_environment) \
423                 $(srcdir)/dbus-test-runner \
424                 $(testexecdir) \
425                 $(installable_tests); }
426 endif DBUS_ENABLE_INSTALLED_TESTS
427
428 in_data = \
429         data/dbus-installed-tests.aaprofile.in \
430         data/systemd-activation/com.example.ReceiveDeniedByAppArmorLabel.service.in \
431         data/systemd-activation/com.example.SendDeniedByAppArmorLabel.service.in \
432         data/systemd-activation/com.example.SendDeniedByNonexistentAppArmorLabel.service.in \
433         data/systemd-activation/com.example.SystemdActivatable3.service.in \
434         data/valid-config-files-system/debug-allow-all-fail.conf.in \
435         data/valid-config-files-system/debug-allow-all-pass.conf.in \
436         data/valid-config-files/as-another-user.conf.in \
437         data/valid-config-files/count-fds.conf.in \
438         data/valid-config-files/debug-allow-all-sha1.conf.in \
439         data/valid-config-files/debug-allow-all.conf.in \
440         data/valid-config-files/finite-timeout.conf.in \
441         data/valid-config-files/forbidding.conf.in \
442         data/valid-config-files/debug-check-some.conf.in \
443         data/valid-config-files/incoming-limit.conf.in \
444         data/valid-config-files/max-completed-connections.conf.in \
445         data/valid-config-files/max-connections-per-user.conf.in \
446         data/valid-config-files/max-match-rules-per-connection.conf.in \
447         data/valid-config-files/max-names-per-connection.conf.in \
448         data/valid-config-files/max-replies-per-connection.conf.in \
449         data/valid-config-files/multi-user.conf.in \
450         data/valid-config-files/pending-fd-timeout.conf.in \
451         data/valid-config-files/systemd-activation.conf.in \
452         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \
453         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \
454         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in \
455         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in \
456         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
457         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
458         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
459         data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in \
460         data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in \
461         data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in \
462         data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
463         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
464         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
465         $(NULL)
466
467 EXTRA_DIST += $(in_data)
468
469 static_data = \
470         name-test/tmp-session-like-system.conf \
471         data/auth/anonymous-client-successful.auth-script \
472         data/auth/anonymous-server-successful.auth-script \
473         data/auth/cancel.auth-script \
474         data/auth/client-out-of-mechanisms.auth-script \
475         data/auth/cookie-sha1-username.auth-script \
476         data/auth/cookie-sha1.auth-script \
477         data/auth/external-failed.auth-script \
478         data/auth/external-root.auth-script \
479         data/auth/external-silly.auth-script \
480         data/auth/external-successful.auth-script \
481         data/auth/extra-bytes.auth-script \
482         data/auth/fail-after-n-attempts.auth-script \
483         data/auth/fallback.auth-script \
484         data/auth/invalid-command-client.auth-script \
485         data/auth/invalid-command.auth-script \
486         data/auth/invalid-hex-encoding.auth-script \
487         data/auth/mechanisms.auth-script \
488         data/equiv-config-files/basic/basic-1.conf \
489         data/equiv-config-files/basic/basic-2.conf \
490         data/equiv-config-files/basic/basic.d/basic.conf \
491         data/equiv-config-files/entities/basic.d/basic.conf \
492         data/equiv-config-files/entities/entities-1.conf \
493         data/equiv-config-files/entities/entities-2.conf \
494         data/incomplete-messages/missing-body.message \
495         data/invalid-config-files/badselinux-1.conf \
496         data/invalid-config-files/badselinux-2.conf \
497         data/invalid-config-files/circular-1.conf \
498         data/invalid-config-files/circular-2.conf \
499         data/invalid-config-files/circular-3.conf \
500         data/invalid-config-files/impossible-send.conf \
501         data/invalid-config-files/not-well-formed.conf \
502         data/invalid-config-files/truncated-file.conf \
503         data/invalid-config-files/send-and-receive.conf \
504         data/invalid-messages/array-of-nil.message \
505         data/invalid-messages/array-with-mixed-types.message \
506         data/invalid-messages/bad-boolean-array.message \
507         data/invalid-messages/bad-boolean.message \
508         data/invalid-messages/bad-endian.message \
509         data/invalid-messages/bad-header-field-alignment.message \
510         data/invalid-messages/boolean-has-no-value.message-raw \
511         data/invalid-messages/local-namespace.message \
512         data/invalid-messages/no-dot-in-name.message \
513         data/invalid-messages/not-nul-header-padding.message \
514         data/invalid-messages/overlong-name.message \
515         data/invalid-messages/too-little-header-padding.message \
516         data/invalid-messages/too-much-header-padding-by-far.message \
517         data/invalid-messages/too-much-header-padding.message \
518         data/invalid-messages/too-short-dict.message \
519         data/sha-1/Readme.txt \
520         data/sha-1/bit-hashes.sha1 \
521         data/sha-1/bit-messages.sha1 \
522         data/sha-1/byte-hashes.sha1 \
523         data/sha-1/byte-messages.sha1 \
524         data/systemd-activation/com.example.ReceiveDenied.service \
525         data/systemd-activation/com.example.SendDenied.service \
526         data/systemd-activation/com.example.SendDeniedByAppArmorName.service \
527         data/systemd-activation/com.example.SystemdActivatable1.service \
528         data/systemd-activation/com.example.SystemdActivatable2.service \
529         data/systemd-activation/org.freedesktop.systemd1.service \
530         data/valid-config-files/basic.conf \
531         data/valid-config-files/basic.d/basic.conf \
532         data/valid-config-files/check-own-rules.conf \
533         data/valid-config-files/entities.conf \
534         data/valid-config-files/listen-unix-runtime.conf \
535         data/valid-config-files/many-rules.conf \
536         data/valid-config-files/standard-session-dirs.conf \
537         data/valid-config-files-system/many-rules.conf \
538         data/valid-config-files-system/system.d/test.conf \
539         data/valid-messages/array-of-array-of-uint32.message \
540         data/valid-messages/dict-simple.message \
541         data/valid-messages/dict.message \
542         data/valid-messages/emptiness.message \
543         data/valid-messages/lots-of-arguments.message \
544         data/valid-messages/no-padding.message \
545         data/valid-messages/opposite-endian.message \
546         data/valid-messages/recursive-types.message \
547         data/valid-messages/simplest-manual.message \
548         data/valid-messages/simplest.message \
549         data/valid-messages/standard-acquire-service.message \
550         data/valid-messages/standard-hello.message \
551         data/valid-messages/standard-list-services.message \
552         data/valid-messages/standard-service-exists.message \
553         data/valid-messages/unknown-header-field.message \
554         $(NULL)
555
556 EXTRA_DIST += $(static_data)
557
558 ## copy tests to builddir so that generated tests and static tests
559 ## are all in one place.
560 ## Note that we can't create the XDG_RUNTIME_DIR with permissions 0700
561 ## on MSYS2, which rejects attempts to change permissions, hence "|| true".
562 all-local: copy-config-local uninstalled-config-local
563         $(AM_V_at)$(MKDIR_P) XDG_RUNTIME_DIR
564         $(AM_V_at)chmod 0700 XDG_RUNTIME_DIR || true
565
566 copy-config-local:
567         $(AM_V_at)$(MKDIR_P) data/valid-config-files/session.d
568         $(AM_V_GEN)set -e; \
569         if test $(srcdir) = . || test $(srcdir) -ef .; then \
570                 echo '-- No need to copy test data as srcdir = builddir'; \
571         else \
572                 for F in $(static_data); do \
573                         $(MKDIR_P) "$${F%/*}"; \
574                         rm -f "$$F"; \
575                         cp $(srcdir)/"$$F" "$$F"; \
576                 done; \
577         fi
578
579 uninstalled-config-local:
580         $(AM_V_GEN)set -e; \
581         for F in $(in_data); do \
582                 $(MKDIR_P) "$${F%/*}"; \
583                 sed \
584                         -e 's,[@]DBUS_TEST_DATA[@],@abs_builddir@/data,' \
585                         -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \
586                         -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
587                         -e 's,[@]EXEEXT[@],$(EXEEXT),' \
588                         -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/bus/dbus-daemon-launch-helper-test$(EXEEXT),' \
589                         -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
590                         < $(srcdir)/"$$F" > "$${F%.in}"; \
591         done
592
593 installable-config-local:
594 if DBUS_ENABLE_INSTALLED_TESTS
595         $(AM_V_GEN)set -e; \
596         for F in $(in_data); do \
597                 $(MKDIR_P) "installable/$${F%/*}"; \
598                 sed \
599                         -e 's,[@]DBUS_TEST_DATA[@],$(testexecdir)/data,' \
600                         -e 's,[@]DBUS_TEST_EXEC[@],$(testexecdir),' \
601                         -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
602                         -e 's,[@]EXEEXT[@],$(EXEEXT),' \
603                         -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],/bin/false,' \
604                         -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
605                         < $(srcdir)/"$$F" > "installable/$${F%.in}"; \
606         done
607 else
608         @:
609 endif
610
611
612 install-data-local: install-config-local
613         @:
614
615 install-config-local: installable-config-local
616 if DBUS_ENABLE_INSTALLED_TESTS
617         $(AM_V_GEN)set -e; \
618         for F in $(static_data); do \
619                 install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
620                 install -m644 "$(srcdir)/$$F" "$(DESTDIR)$(testexecdir)/$$F"; \
621         done; \
622         for F in $(in_data); do \
623                 install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
624                 install -m644 "installable/$${F%.in}" "$(DESTDIR)$(testexecdir)/$${F%.in}"; \
625         done
626         ln -nfs $(datadir)/dbus-1/session.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/session.conf
627         ln -nfs $(datadir)/dbus-1/system.conf $(DESTDIR)$(testexecdir)/data/valid-config-files-system/system.conf
628 else
629         @:
630 endif
631
632 ## this doesn't clean most copied test data files when srcdir=builddir
633 clean-local:
634         $(AM_V_at)if test $(srcdir) = . || test $(srcdir) -ef .; then \
635                 echo '-- No need to clean test data as srcdir = builddir'; \
636         else \
637                 rm -f $(static_data); \
638                 for F in $(in_data); do \
639                         rm -f "$${F%.in}"; \
640                 done; \
641         fi
642         rm -fr ./XDG_RUNTIME_DIR ./installable
643
644 imported_data = \
645         data/valid-config-files/session.conf \
646         data/valid-config-files-system/system.conf \
647         $(NULL)
648
649 noinst_DATA = $(imported_data)
650 CLEANFILES += \
651         $(noinst_DATA) \
652         $(NULL)
653
654 data/valid-config-files/session.conf: $(top_builddir)/bus/session.conf
655         $(AM_V_at)$(MKDIR_P) data/valid-config-files
656         $(AM_V_GEN)cp $< $@
657
658 data/valid-config-files-system/system.conf: $(top_builddir)/bus/system.conf
659         $(AM_V_at)$(MKDIR_P) data/valid-config-files-system
660         $(AM_V_GEN)cp $< $@
661
662 $(installable_test_meta): %.test: %$(EXEEXT) Makefile
663         $(AM_V_at)$(MKDIR_P) $(dir $@)
664         $(AM_V_GEN) ( \
665                 echo '[Test]'; \
666                 echo 'Type=session'; \
667                 echo 'Output=TAP'; \
668                 echo 'Exec=env $(testexecdir)/$* --tap'; \
669         ) > $@.tmp && mv $@.tmp $@
670
671 $(installable_test_meta_with_config): %_with_config.test: %$(EXEEXT) Makefile
672         $(AM_V_at)$(MKDIR_P) $(dir $@)
673         $(AM_V_GEN) ( \
674                 echo '[Test]'; \
675                 echo 'Type=session'; \
676                 echo 'Output=TAP'; \
677                 echo 'Exec=env DBUS_TEST_EXEC=$(testexecdir) DBUS_TEST_DATA=$(testexecdir)/data $(testexecdir)/$* --tap'; \
678         ) > $@.tmp && mv $@.tmp $@
679
680 # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
681 include $(top_srcdir)/aminclude_static.am