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