Fix failure to build exit-on-close gdbus test
[platform/upstream/glib.git] / gio / tests / Makefile.am
1 include $(top_srcdir)/glib.mk
2 dist_uninstalled_test_data =
3 test_ltlibraries =
4
5 SUBDIRS = gdbus-object-manager-example services
6
7 LDADD = \
8         $(top_builddir)/glib/libglib-2.0.la             \
9         $(top_builddir)/gobject/libgobject-2.0.la       \
10         $(top_builddir)/gmodule/libgmodule-2.0.la       \
11         $(top_builddir)/gio/libgio-2.0.la
12 AM_CPPFLAGS = $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio
13 DEFS = -DG_LOG_DOMAIN=\"GLib-GIO\" -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\"
14 AM_CFLAGS = $(GLIB_WARN_CFLAGS)
15
16 # -----------------------------------------------------------------------------
17 #  Test programs buildable on all platforms
18
19 test_programs = \
20         io-stream                               \
21         memory-input-stream                     \
22         memory-output-stream                    \
23         readwrite                               \
24         g-file                                  \
25         g-file-info                             \
26         converter-stream                        \
27         data-input-stream                       \
28         data-output-stream                      \
29         g-icon                                  \
30         buffered-input-stream                   \
31         buffered-output-stream                  \
32         sleepy-stream                           \
33         filter-streams                          \
34         volumemonitor                           \
35         simple-async-result                     \
36         srvtarget                               \
37         contexts                                \
38         async-close-output-stream               \
39         gdbus-addresses                         \
40         network-address                         \
41         gdbus-message                           \
42         socket                                  \
43         pollable                                \
44         tls-interaction                         \
45         cancellable                             \
46         vfs                                     \
47         network-monitor                         \
48         fileattributematcher                    \
49         proxy-test                              \
50         simple-proxy                            \
51         inet-address                            \
52         permission                              \
53         task                                    \
54         credentials                             \
55         $(NULL)
56
57 uninstalled_test_programs = \
58         $(NULL)
59
60 dist_test_data = \
61         contexts.c                              \
62         g-icon.c                                \
63         $(NULL)
64
65 test_data = \
66         test.gresource                          \
67         $(NULL)
68
69 uninstalled_test_extra_programs = \
70         resolver                                \
71         socket-server                           \
72         echo-server                             \
73         httpd                                   \
74         send-data                               \
75         filter-cat                              \
76         gdbus-example-export                    \
77         gdbus-example-own-name                  \
78         gdbus-example-watch-name                \
79         gdbus-example-watch-proxy               \
80         gdbus-example-server                    \
81         gdbus-example-subtree                   \
82         gdbus-example-peer                      \
83         gdbus-example-proxy-subclass            \
84         proxy                                   \
85         gapplication-example-open               \
86         gapplication-example-cmdline            \
87         gapplication-example-cmdline2           \
88         gapplication-example-cmdline3           \
89         gapplication-example-actions            \
90         gapplication-example-dbushooks          \
91         $(NULL)
92
93 test_extra_programs = \
94         gdbus-testserver                        \
95         gdbus-connection-flush-helper           \
96         $(NULL)
97
98 dist_uninstalled_test_data += $(addprefix schema-tests/,$(schema_tests))
99 schema_tests = \
100         array-default-not-in-choices.gschema.xml        \
101         bad-choice.gschema.xml                          \
102         bad-key.gschema.xml                             \
103         bad-key2.gschema.xml                            \
104         bad-key3.gschema.xml                            \
105         bad-key4.gschema.xml                            \
106         bad-type.gschema.xml                            \
107         bare-alias.gschema.xml                          \
108         choice-alias.gschema.xml                        \
109         choice-bad.gschema.xml                          \
110         choice-badtype.gschema.xml                      \
111         choice-invalid-alias.gschema.xml                \
112         choice-missing-value.gschema.xml                \
113         choice-shadowed-alias.gschema.xml               \
114         choice-upside-down.gschema.xml                  \
115         choice.gschema.xml                              \
116         choices-wrong-type.gschema.xml                  \
117         default-in-aliases.gschema.xml                  \
118         default-not-in-choices.gschema.xml              \
119         default-out-of-range.gschema.xml                \
120         empty-key.gschema.xml                           \
121         enum-with-aliases.gschema.xml                   \
122         enum-with-bad-default.gschema.xml               \
123         enum-with-chained-alias.gschema.xml             \
124         enum-with-choice.gschema.xml                    \
125         enum-with-invalid-alias.gschema.xml             \
126         enum-with-repeated-alias.gschema.xml            \
127         enum-with-repeated-nick.gschema.xml             \
128         enum-with-repeated-value.gschema.xml            \
129         enum-with-shadow-alias.gschema.xml              \
130         enum.gschema.xml                                \
131         flags-aliased-default.gschema.xml               \
132         flags-bad-default.gschema.xml                   \
133         flags-more-than-one-bit.gschema.xml             \
134         flags-with-enum-attr.gschema.xml                \
135         flags-with-enum-tag.gschema.xml                 \
136         extend-and-shadow-indirect.gschema.xml          \
137         extend-and-shadow.gschema.xml                   \
138         extend-missing.gschema.xml                      \
139         extend-nonlist.gschema.xml                      \
140         extend-self.gschema.xml                         \
141         extend-wrong-list-indirect.gschema.xml          \
142         extend-wrong-list.gschema.xml                   \
143         extending.gschema.xml                           \
144         from-docs.gschema.xml                           \
145         incomplete-list.gschema.xml                     \
146         inherit-gettext-domain.gschema.xml              \
147         invalid-path.gschema.xml                        \
148         key-in-list-indirect.gschema.xml                \
149         key-in-list.gschema.xml                         \
150         list-of-missing.gschema.xml                     \
151         missing-quotes.gschema.xml                      \
152         no-default.gschema.xml                          \
153         overflow.gschema.xml                            \
154         override-missing.gschema.xml                    \
155         override-range-error.gschema.xml                \
156         override-then-key.gschema.xml                   \
157         override-twice.gschema.xml                      \
158         override-type-error.gschema.xml                 \
159         override.gschema.xml                            \
160         range-badtype.gschema.xml                       \
161         range-default-high.gschema.xml                  \
162         range-default-low.gschema.xml                   \
163         range-high-default.gschema.xml                  \
164         range-low-default.gschema.xml                   \
165         range-missing-max.gschema.xml                   \
166         range-missing-min.gschema.xml                   \
167         range-parse-error.gschema.xml                   \
168         range-wrong-type.gschema.xml                    \
169         range.gschema.xml                               \
170         wrong-category.gschema.xml                      \
171         $(NULL)
172
173 test_programs += tls-certificate
174 tls_certificate_SOURCES = \
175         tls-certificate.c                       \
176         gtesttlsbackend.c                       \
177         gtesttlsbackend.h
178 dist_test_data += $(cert_data_files)
179 cert_data_files = $(addprefix cert-tests/,$(cert_tests))
180 cert_tests = \
181         cert1.pem       \
182         cert2.pem       \
183         cert3.pem       \
184         cert-key.pem    \
185         cert-list.pem   \
186         key8.pem        \
187         key-cert.pem    \
188         key.pem         \
189         nothing.pem     \
190         $(NULL)
191
192 uninstalled_test_extra_programs += socket-client
193 socket_client_SOURCES = \
194         socket-client.c                         \
195         gtlsconsoleinteraction.c                \
196         gtlsconsoleinteraction.h
197 EXTRA_DIST += socket-common.c
198
199 uninstalled_test_extra_programs += gdbus-daemon
200 nodist_gdbus_daemon_SOURCES = \
201         $(top_builddir)/gio/gdbus-daemon-generated.c
202 gdbus_daemon_SOURCES = \
203         gdbus-daemon.c                          \
204         $(top_srcdir)/gio/gdbusdaemon.c
205
206 # -----------------------------------------------------------------------------
207 #  Test programs buildable on UNIX only
208
209 if OS_UNIX
210 test_programs += \
211         live-g-file                             \
212         unix-fd                                 \
213         unix-streams                            \
214         basic-application                       \
215         socket-address                          \
216         gdbus-peer-object-manager               \
217         contenttype                             \
218         file                                    \
219         $(NULL)
220
221 # Uninstalled because of the check-for-executable logic in DesktopAppInfo unable to find the installed executable
222 uninstalled_test_programs += \
223         appinfo                                 \
224         desktop-app-info                        \
225         $(NULL)
226
227 dist_test_data += \
228         appinfo-test.desktop                    \
229         appinfo-test2.desktop                   \
230         appinfo-test-gnome.desktop              \
231         appinfo-test-notgnome.desktop           \
232         file.c                                  \
233         $(NULL)
234
235 test_extra_programs += \
236         appinfo-test                            \
237         $(NULL)
238
239 uninstalled_test_extra_programs += \
240         gdbus-example-unix-fd-client            \
241         $(NULL)
242
243 test_programs += mimeapps
244 clean-local: clean-mimeapps
245 clean-mimeapps:
246         rm -rf xdgdatadir xdgdatahome
247
248 uninstalled_test_programs += gsettings gschema-compile
249 gsettings_DEPENDENCIES = test.mo
250 CLEANFILES += test.mo de/LC_MESSAGES/test.mo
251 gsettings_CFLAGS = $(AM_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
252 test.mo: de.po
253         $(AM_V_GEN) $(MSGFMT) -o test.mo $(srcdir)/de.po; \
254         $(MKDIR_P) de/LC_MESSAGES; \
255         cp -f test.mo de/LC_MESSAGES
256 EXTRA_DIST += de.po
257 dist_uninstalled_test_data += \
258         org.gtk.test.gschema.xml                \
259         org.gtk.schemasourcecheck.gschema.xml   \
260         testenum.h                              \
261         enums.xml.template
262 # Generated while running the testcase itself...
263 CLEANFILES += \
264         org.gtk.test.enums.xml          \
265         gsettings.store                 \
266         gschemas.compiled               \
267         schema-source/gschemas.compiled
268
269 test_programs += gdbus-connection-flush
270 gdbus_connection_flush_SOURCES = \
271         gdbus-connection-flush.c                \
272         test-io-stream.c                        \
273         test-io-stream.h                        \
274         test-pipe-unix.c                        \
275         test-pipe-unix.h
276
277 test_programs += gdbus-non-socket
278 gdbus_non_socket_SOURCES = \
279         gdbus-non-socket.c                      \
280         gdbus-tests.c                           \
281         gdbus-tests.h                           \
282         test-io-stream.c                        \
283         test-io-stream.h                        \
284         test-pipe-unix.c                        \
285         test-pipe-unix.h
286
287 # These three are manual-run tests because they need a session bus but don't bring one up themselves
288 uninstalled_test_extra_programs += gdbus-example-objectmanager-client
289 gdbus_example_objectmanager_client_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
290
291 uninstalled_test_extra_programs += gdbus-example-objectmanager-server
292 gdbus_example_objectmanager_server_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
293
294 uninstalled_test_extra_programs += gdbus-test-fixture
295 gdbus_test_fixture_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
296
297 # This is peer to peer so it doesn't need a session bus (so we can run it normally)
298 test_programs += gdbus-peer
299 gdbus_peer_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
300
301 # This test is currently unreliable
302 test_extra_programs += gdbus-overflow
303
304 # -----------------------------------------------------------------------------
305 #  Test programs that need to bring up a session bus (requires dbus-daemon)
306
307 if HAVE_DBUS_DAEMON
308 gdbus_sessionbus_sources = gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
309
310 test_programs += \
311         gapplication                            \
312         actions                                 \
313         gdbus-auth                              \
314         gdbus-connection                        \
315         gdbus-bz627724                          \
316         gdbus-exit-on-close                     \
317         gdbus-connection-loss                   \
318         gdbus-connection-slow                   \
319         gdbus-names                             \
320         gdbus-proxy                             \
321         gdbus-proxy-threads                     \
322         gdbus-proxy-well-known-name             \
323         gdbus-introspection                     \
324         gdbus-threading                         \
325         gdbus-export                            \
326         gdbus-test-codegen                      \
327         gdbus-close-pending                     \
328         gdbus-error                             \
329         gmenumodel                              \
330         $(NULL)
331
332 gdbus_proxy_threads_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
333 gdbus_exit_on_close_SOURCES              = $(gdbus_sessionbus_sources) gdbus-exit-on-close.c
334 gapplication_SOURCES                     = $(gdbus_sessionbus_sources) gapplication.c
335 actions_SOURCES                          = $(gdbus_sessionbus_sources) actions.c
336 gdbus_auth_SOURCES                       = $(gdbus_sessionbus_sources) gdbus-auth.c
337 gdbus_connection_SOURCES                 = $(gdbus_sessionbus_sources) gdbus-connection.c
338 gdbus_bz627724_SOURCES                   = $(gdbus_sessionbus_sources) gdbus-bz627724.c
339 gdbus_connection_loss_SOURCES            = $(gdbus_sessionbus_sources) gdbus-connection-loss.c
340 gdbus_connection_slow_SOURCES            = $(gdbus_sessionbus_sources) gdbus-connection-slow.c
341 gdbus_names_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-names.c
342 gdbus_proxy_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-proxy.c
343 gdbus_proxy_threads_SOURCES              = $(gdbus_sessionbus_sources) gdbus-proxy-threads.c
344 gdbus_proxy_well_known_name_SOURCES      = $(gdbus_sessionbus_sources) gdbus-proxy-well-known-name.c
345 gdbus_introspection_SOURCES              = $(gdbus_sessionbus_sources) gdbus-introspection.c
346 gdbus_threading_SOURCES                  = $(gdbus_sessionbus_sources) gdbus-threading.c
347 gdbus_export_SOURCES                     = $(gdbus_sessionbus_sources) gdbus-export.c
348 gdbus_error_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-error.c
349 gmenumodel_SOURCES                       = $(gdbus_sessionbus_sources) gmenumodel.c
350 gdbus_close_pending_SOURCES              = $(gdbus_sessionbus_sources) gdbus-close-pending.c
351 gdbus_test_codegen_SOURCES               = $(gdbus_sessionbus_sources) gdbus-test-codegen.c
352 nodist_gdbus_test_codegen_SOURCES        = gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
353
354 gdbus-test-codegen.o: gdbus-test-codegen-generated.h
355 gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
356         $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
357                 UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
358                 $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
359                 --interface-prefix org.project. \
360                 --generate-c-code gdbus-test-codegen-generated \
361                 --c-generate-object-manager \
362                 --c-namespace Foo_iGen \
363                 --generate-docbook gdbus-test-codegen-generated-doc \
364                 --annotate "org.project.Bar" Key1 Value1 \
365                 --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
366                 --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
367                 --annotate "org.project.Bar::TestSignal" Key4 Value4 \
368                 --annotate "org.project.Bar:ay" Key5 Value5 \
369                 --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
370                 --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
371                 --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
372                 $(srcdir)/test-codegen.xml \
373                 $(NULL)
374
375 EXTRA_DIST += test-codegen.xml
376 CLEANFILES += gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml
377 endif # OS_UNIX
378 endif # HAVE_DBUS_DAEMON
379
380 # -----------------------------------------------------------------------------
381
382 if OS_WIN32
383 test_programs += win32-streams
384 endif
385
386 if PLATFORM_WIN32
387 no_undefined = -no-undefined
388 endif
389
390 if HAVE_DBUS1
391 test_programs += gdbus-serialization
392 gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
393 gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
394 gdbus_serialization_SOURCES = \
395         gdbus-serialization.c                   \
396         gdbus-tests.h                           \
397         gdbus-tests.c
398 endif
399
400 # -----------------------------------------------------------------------------
401 #  The resources test is a bit more complicated...
402
403 test_programs += resources
404 resources_SOURCES = resources.c
405 nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h
406 resources_DEPENDENCIES = test.gresource
407
408 test_ltlibraries += libresourceplugin.la
409 libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c
410 libresourceplugin_la_LDFLAGS = -avoid-version -module -export-dynamic $(no_undefined)
411 libresourceplugin_la_LIBADD = $(LDADD)
412
413 # libtool contains a bug whereby the created .la file doesn't contain the correct dlname='' in the case that
414 # you're building a library but not installing it.  This is apparently because the only considered use for an
415 # uninstalled library is as a convenience library for linking (despite the fact that we give -module).  The lack
416 # of dlname='' in the .la trips up libltdl and GModule as well.  We can trick libtool into believing that we
417 # will install the module by giving it a bogus -rpath for the uninstalled cases.
418 #
419 # See http://lists.gnu.org/archive/html/bug-libtool/2013-05/msg00009.html
420 if !ENABLE_INSTALLED_TESTS
421 libresourceplugin_la_LDFLAGS += -rpath /
422 endif
423
424 if CROSS_COMPILING
425   glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
426 else
427   glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
428 endif
429
430 resources.o: test_resources2.h
431 test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml)
432         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $<
433
434 test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml)
435         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $<
436
437 plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml)
438         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $<
439
440 test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml)
441         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
442
443 EXTRA_DIST += test.gresource.xml test1.txt test2.gresource.xml test2.txt test3.gresource.xml test3.txt test4.gresource.xml
444
445 CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource