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