cmake: Add X11 include path for tools
[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/incoming-limit.conf.in \
443         data/valid-config-files/max-completed-connections.conf.in \
444         data/valid-config-files/max-connections-per-user.conf.in \
445         data/valid-config-files/max-match-rules-per-connection.conf.in \
446         data/valid-config-files/max-names-per-connection.conf.in \
447         data/valid-config-files/max-replies-per-connection.conf.in \
448         data/valid-config-files/multi-user.conf.in \
449         data/valid-config-files/pending-fd-timeout.conf.in \
450         data/valid-config-files/systemd-activation.conf.in \
451         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \
452         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \
453         data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in \
454         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in \
455         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
456         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
457         data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
458         data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in \
459         data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in \
460         data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in \
461         data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in \
462         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in \
463         data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in \
464         $(NULL)
465
466 EXTRA_DIST += $(in_data)
467
468 static_data = \
469         name-test/tmp-session-like-system.conf \
470         data/auth/anonymous-client-successful.auth-script \
471         data/auth/anonymous-server-successful.auth-script \
472         data/auth/cancel.auth-script \
473         data/auth/client-out-of-mechanisms.auth-script \
474         data/auth/cookie-sha1-username.auth-script \
475         data/auth/cookie-sha1.auth-script \
476         data/auth/external-failed.auth-script \
477         data/auth/external-root.auth-script \
478         data/auth/external-silly.auth-script \
479         data/auth/external-successful.auth-script \
480         data/auth/extra-bytes.auth-script \
481         data/auth/fail-after-n-attempts.auth-script \
482         data/auth/fallback.auth-script \
483         data/auth/invalid-command-client.auth-script \
484         data/auth/invalid-command.auth-script \
485         data/auth/invalid-hex-encoding.auth-script \
486         data/auth/mechanisms.auth-script \
487         data/equiv-config-files/basic/basic-1.conf \
488         data/equiv-config-files/basic/basic-2.conf \
489         data/equiv-config-files/basic/basic.d/basic.conf \
490         data/equiv-config-files/entities/basic.d/basic.conf \
491         data/equiv-config-files/entities/entities-1.conf \
492         data/equiv-config-files/entities/entities-2.conf \
493         data/incomplete-messages/missing-body.message \
494         data/invalid-config-files/badselinux-1.conf \
495         data/invalid-config-files/badselinux-2.conf \
496         data/invalid-config-files/circular-1.conf \
497         data/invalid-config-files/circular-2.conf \
498         data/invalid-config-files/circular-3.conf \
499         data/invalid-config-files/impossible-send.conf \
500         data/invalid-config-files/not-well-formed.conf \
501         data/invalid-config-files/truncated-file.conf \
502         data/invalid-config-files/send-and-receive.conf \
503         data/invalid-messages/array-of-nil.message \
504         data/invalid-messages/array-with-mixed-types.message \
505         data/invalid-messages/bad-boolean-array.message \
506         data/invalid-messages/bad-boolean.message \
507         data/invalid-messages/bad-endian.message \
508         data/invalid-messages/bad-header-field-alignment.message \
509         data/invalid-messages/boolean-has-no-value.message-raw \
510         data/invalid-messages/local-namespace.message \
511         data/invalid-messages/no-dot-in-name.message \
512         data/invalid-messages/not-nul-header-padding.message \
513         data/invalid-messages/overlong-name.message \
514         data/invalid-messages/too-little-header-padding.message \
515         data/invalid-messages/too-much-header-padding-by-far.message \
516         data/invalid-messages/too-much-header-padding.message \
517         data/invalid-messages/too-short-dict.message \
518         data/sha-1/Readme.txt \
519         data/sha-1/bit-hashes.sha1 \
520         data/sha-1/bit-messages.sha1 \
521         data/sha-1/byte-hashes.sha1 \
522         data/sha-1/byte-messages.sha1 \
523         data/systemd-activation/com.example.ReceiveDenied.service \
524         data/systemd-activation/com.example.SendDenied.service \
525         data/systemd-activation/com.example.SendDeniedByAppArmorName.service \
526         data/systemd-activation/com.example.SystemdActivatable1.service \
527         data/systemd-activation/com.example.SystemdActivatable2.service \
528         data/systemd-activation/org.freedesktop.systemd1.service \
529         data/valid-config-files/basic.conf \
530         data/valid-config-files/basic.d/basic.conf \
531         data/valid-config-files/check-own-rules.conf \
532         data/valid-config-files/entities.conf \
533         data/valid-config-files/listen-unix-runtime.conf \
534         data/valid-config-files/many-rules.conf \
535         data/valid-config-files/standard-session-dirs.conf \
536         data/valid-config-files-system/many-rules.conf \
537         data/valid-config-files-system/system.d/test.conf \
538         data/valid-messages/array-of-array-of-uint32.message \
539         data/valid-messages/dict-simple.message \
540         data/valid-messages/dict.message \
541         data/valid-messages/emptiness.message \
542         data/valid-messages/lots-of-arguments.message \
543         data/valid-messages/no-padding.message \
544         data/valid-messages/opposite-endian.message \
545         data/valid-messages/recursive-types.message \
546         data/valid-messages/simplest-manual.message \
547         data/valid-messages/simplest.message \
548         data/valid-messages/standard-acquire-service.message \
549         data/valid-messages/standard-hello.message \
550         data/valid-messages/standard-list-services.message \
551         data/valid-messages/standard-service-exists.message \
552         data/valid-messages/unknown-header-field.message \
553         $(NULL)
554
555 EXTRA_DIST += $(static_data)
556
557 ## copy tests to builddir so that generated tests and static tests
558 ## are all in one place.
559 ## Note that we can't create the XDG_RUNTIME_DIR with permissions 0700
560 ## on MSYS2, which rejects attempts to change permissions, hence "|| true".
561 all-local: copy-config-local uninstalled-config-local
562         $(AM_V_at)$(MKDIR_P) XDG_RUNTIME_DIR
563         $(AM_V_at)chmod 0700 XDG_RUNTIME_DIR || true
564
565 copy-config-local:
566         $(AM_V_at)$(MKDIR_P) data/valid-config-files/session.d
567         $(AM_V_GEN)set -e; \
568         if test $(srcdir) = . || test $(srcdir) -ef .; then \
569                 echo '-- No need to copy test data as srcdir = builddir'; \
570         else \
571                 for F in $(static_data); do \
572                         $(MKDIR_P) "$${F%/*}"; \
573                         rm -f "$$F"; \
574                         cp $(srcdir)/"$$F" "$$F"; \
575                 done; \
576         fi
577
578 uninstalled-config-local:
579         $(AM_V_GEN)set -e; \
580         for F in $(in_data); do \
581                 $(MKDIR_P) "$${F%/*}"; \
582                 sed \
583                         -e 's,[@]DBUS_TEST_DATA[@],@abs_builddir@/data,' \
584                         -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \
585                         -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
586                         -e 's,[@]EXEEXT[@],$(EXEEXT),' \
587                         -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/bus/dbus-daemon-launch-helper-test$(EXEEXT),' \
588                         -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
589                         < $(srcdir)/"$$F" > "$${F%.in}"; \
590         done
591
592 installable-config-local:
593 if DBUS_ENABLE_INSTALLED_TESTS
594         $(AM_V_GEN)set -e; \
595         for F in $(in_data); do \
596                 $(MKDIR_P) "installable/$${F%/*}"; \
597                 sed \
598                         -e 's,[@]DBUS_TEST_DATA[@],$(testexecdir)/data,' \
599                         -e 's,[@]DBUS_TEST_EXEC[@],$(testexecdir),' \
600                         -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
601                         -e 's,[@]EXEEXT[@],$(EXEEXT),' \
602                         -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],/bin/false,' \
603                         -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
604                         < $(srcdir)/"$$F" > "installable/$${F%.in}"; \
605         done
606 else
607         @:
608 endif
609
610
611 install-data-local: install-config-local
612         @:
613
614 install-config-local: installable-config-local
615 if DBUS_ENABLE_INSTALLED_TESTS
616         $(AM_V_GEN)set -e; \
617         for F in $(static_data); do \
618                 install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
619                 install -m644 "$(srcdir)/$$F" "$(DESTDIR)$(testexecdir)/$$F"; \
620         done; \
621         for F in $(in_data); do \
622                 install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
623                 install -m644 "installable/$${F%.in}" "$(DESTDIR)$(testexecdir)/$${F%.in}"; \
624         done
625         ln -nfs $(datadir)/dbus-1/session.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/session.conf
626         ln -nfs $(datadir)/dbus-1/system.conf $(DESTDIR)$(testexecdir)/data/valid-config-files-system/system.conf
627 else
628         @:
629 endif
630
631 ## this doesn't clean most copied test data files when srcdir=builddir
632 clean-local:
633         $(AM_V_at)if test $(srcdir) = . || test $(srcdir) -ef .; then \
634                 echo '-- No need to clean test data as srcdir = builddir'; \
635         else \
636                 rm -f $(static_data); \
637                 for F in $(in_data); do \
638                         rm -f "$${F%.in}"; \
639                 done; \
640         fi
641         rm -fr ./XDG_RUNTIME_DIR ./installable
642
643 imported_data = \
644         data/valid-config-files/session.conf \
645         data/valid-config-files-system/system.conf \
646         $(NULL)
647
648 noinst_DATA = $(imported_data)
649 CLEANFILES += \
650         $(noinst_DATA) \
651         $(NULL)
652
653 data/valid-config-files/session.conf: $(top_builddir)/bus/session.conf
654         $(AM_V_at)$(MKDIR_P) data/valid-config-files
655         $(AM_V_GEN)cp $< $@
656
657 data/valid-config-files-system/system.conf: $(top_builddir)/bus/system.conf
658         $(AM_V_at)$(MKDIR_P) data/valid-config-files-system
659         $(AM_V_GEN)cp $< $@
660
661 $(installable_test_meta): %.test: %$(EXEEXT) Makefile
662         $(AM_V_at)$(MKDIR_P) $(dir $@)
663         $(AM_V_GEN) ( \
664                 echo '[Test]'; \
665                 echo 'Type=session'; \
666                 echo 'Output=TAP'; \
667                 echo 'Exec=env $(testexecdir)/$* --tap'; \
668         ) > $@.tmp && mv $@.tmp $@
669
670 $(installable_test_meta_with_config): %_with_config.test: %$(EXEEXT) Makefile
671         $(AM_V_at)$(MKDIR_P) $(dir $@)
672         $(AM_V_GEN) ( \
673                 echo '[Test]'; \
674                 echo 'Type=session'; \
675                 echo 'Output=TAP'; \
676                 echo 'Exec=env DBUS_TEST_EXEC=$(testexecdir) DBUS_TEST_DATA=$(testexecdir)/data $(testexecdir)/$* --tap'; \
677         ) > $@.tmp && mv $@.tmp $@
678
679 # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
680 include $(top_srcdir)/aminclude_static.am