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