build: Give internal libraries higher precedence
[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         basic-application                       \
237         contenttype                             \
238         file                                    \
239         gdbus-peer-object-manager               \
240         live-g-file                             \
241         socket-address                          \
242         unix-fd                                 \
243         unix-streams                            \
244         $(NULL)
245
246 # Uninstalled because of the check-for-executable logic in DesktopAppInfo unable to find the installed executable
247 uninstalled_test_programs += \
248         appinfo                                 \
249         desktop-app-info                        \
250         $(NULL)
251
252 home_desktop_files = \
253         epiphany-weather-for-toronto-island-9c6a4e022b17686306243dada811d550d25eb1fb.desktop    \
254         eog.desktop
255
256 usr_desktop_files = \
257         baobab.desktop                          \
258         cheese.desktop                          \
259         dconf-editor.desktop                    \
260         eog.desktop                             \
261         evince-previewer.desktop                \
262         evince.desktop                          \
263         file-roller.desktop                     \
264         gcr-prompter.desktop                    \
265         gcr-viewer.desktop                      \
266         gedit.desktop                           \
267         glade.desktop                           \
268         gnome-clocks.desktop                    \
269         gnome-contacts.desktop                  \
270         gnome-font-viewer.desktop               \
271         gnome-music.desktop                     \
272         gnome-terminal.desktop                  \
273         gucharmap.desktop                       \
274         kde4/dolphin.desktop                    \
275         kde4/kate.desktop                       \
276         kde4/konqbrowser.desktop                \
277         kde4/okular.desktop                     \
278         nautilus-autorun-software.desktop       \
279         nautilus-classic.desktop                \
280         nautilus-connect-server.desktop         \
281         nautilus.desktop                        \
282         totem.desktop                           \
283         yelp.desktop
284
285 dist_test_data += \
286         $(addprefix desktop-files/usr/applications/,$(usr_desktop_files))       \
287         $(addprefix desktop-files/home/applications/,$(home_desktop_files))
288
289 dist_test_data += \
290         appinfo-test-actions.desktop            \
291         appinfo-test-gnome.desktop              \
292         appinfo-test-notgnome.desktop           \
293         appinfo-test.desktop                    \
294         appinfo-test2.desktop                   \
295         file.c                                  \
296         org.gtk.test.dbusappinfo.desktop        \
297         $(NULL)
298
299 test_extra_programs += \
300         appinfo-test                            \
301         apps                                    \
302         $(NULL)
303
304 uninstalled_test_extra_programs += \
305         gdbus-example-unix-fd-client            \
306         $(NULL)
307
308 test_programs += mimeapps
309 clean-local: clean-mimeapps
310 clean-mimeapps:
311         rm -rf xdgdatadir xdgdatahome
312
313 uninstalled_test_programs += gsettings gschema-compile
314 gsettings_DEPENDENCIES = test.mo
315 CLEANFILES += test.mo de/LC_MESSAGES/test.mo
316 gsettings_CFLAGS = $(AM_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
317 test.mo: de.po
318         $(AM_V_GEN) $(MSGFMT) -o test.mo $(srcdir)/de.po; \
319         $(MKDIR_P) de/LC_MESSAGES; \
320         cp -f test.mo de/LC_MESSAGES
321 EXTRA_DIST += de.po
322 dist_uninstalled_test_data += \
323         org.gtk.test.gschema.xml.orig           \
324         org.gtk.schemasourcecheck.gschema.xml   \
325         testenum.h                              \
326         enums.xml.template
327 # Generated while running the testcase itself...
328 CLEANFILES += \
329         org.gtk.test.gschema.xml        \
330         org.gtk.test.enums.xml          \
331         gsettings.store                 \
332         gschemas.compiled               \
333         schema-source/gschemas.compiled
334
335 test_programs += gdbus-connection-flush
336 gdbus_connection_flush_SOURCES = \
337         gdbus-connection-flush.c                \
338         test-io-stream.c                        \
339         test-io-stream.h                        \
340         test-pipe-unix.c                        \
341         test-pipe-unix.h
342
343 test_programs += gdbus-non-socket
344 gdbus_non_socket_SOURCES = \
345         gdbus-non-socket.c                      \
346         gdbus-tests.c                           \
347         gdbus-tests.h                           \
348         test-io-stream.c                        \
349         test-io-stream.h                        \
350         test-pipe-unix.c                        \
351         test-pipe-unix.h
352
353 # These three are manual-run tests because they need a session bus but don't bring one up themselves
354 uninstalled_test_extra_programs += gdbus-example-objectmanager-client
355 gdbus_example_objectmanager_client_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
356
357 test_extra_programs += gsubprocess-testprog
358
359 uninstalled_test_extra_programs += gdbus-test-fixture
360 gdbus_test_fixture_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
361
362 # This is peer to peer so it doesn't need a session bus (so we can run it normally)
363 test_programs += gdbus-peer
364 gdbus_peer_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
365
366 # This test is currently unreliable
367 test_extra_programs += gdbus-overflow
368
369 # -----------------------------------------------------------------------------
370 #  Test programs that need to bring up a session bus (requires dbus-daemon)
371
372 if HAVE_DBUS_DAEMON
373 gdbus_sessionbus_sources = gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
374
375 test_programs += \
376         actions                                 \
377         dbus-appinfo                            \
378         gapplication                            \
379         gdbus-auth                              \
380         gdbus-bz627724                          \
381         gdbus-close-pending                     \
382         gdbus-connection                        \
383         gdbus-connection-loss                   \
384         gdbus-connection-slow                   \
385         gdbus-error                             \
386         gdbus-exit-on-close                     \
387         gdbus-export                            \
388         gdbus-introspection                     \
389         gdbus-names                             \
390         gdbus-proxy                             \
391         gdbus-proxy-threads                     \
392         gdbus-proxy-well-known-name             \
393         gdbus-test-codegen                      \
394         gdbus-test-codegen-old                  \
395         gdbus-threading                         \
396         gmenumodel                              \
397         $(NULL)
398
399 gdbus_proxy_threads_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
400 actions_SOURCES                          = $(gdbus_sessionbus_sources) actions.c
401 dbus_appinfo_SOURCES                     = $(gdbus_sessionbus_sources) dbus-appinfo.c
402 gapplication_SOURCES                     = $(gdbus_sessionbus_sources) gapplication.c
403 gdbus_auth_SOURCES                       = $(gdbus_sessionbus_sources) gdbus-auth.c
404 gdbus_bz627724_SOURCES                   = $(gdbus_sessionbus_sources) gdbus-bz627724.c
405 gdbus_close_pending_SOURCES              = $(gdbus_sessionbus_sources) gdbus-close-pending.c
406 gdbus_connection_SOURCES                 = $(gdbus_sessionbus_sources) gdbus-connection.c
407 gdbus_connection_loss_SOURCES            = $(gdbus_sessionbus_sources) gdbus-connection-loss.c
408 gdbus_connection_slow_SOURCES            = $(gdbus_sessionbus_sources) gdbus-connection-slow.c
409 gdbus_error_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-error.c
410 gdbus_exit_on_close_SOURCES              = $(gdbus_sessionbus_sources) gdbus-exit-on-close.c
411 gdbus_export_SOURCES                     = $(gdbus_sessionbus_sources) gdbus-export.c
412 gdbus_introspection_SOURCES              = $(gdbus_sessionbus_sources) gdbus-introspection.c
413 gdbus_names_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-names.c
414 gdbus_proxy_SOURCES                      = $(gdbus_sessionbus_sources) gdbus-proxy.c
415 gdbus_proxy_threads_SOURCES              = $(gdbus_sessionbus_sources) gdbus-proxy-threads.c
416 gdbus_proxy_well_known_name_SOURCES      = $(gdbus_sessionbus_sources) gdbus-proxy-well-known-name.c
417 gdbus_test_codegen_SOURCES               = $(gdbus_sessionbus_sources) gdbus-test-codegen.c
418 nodist_gdbus_test_codegen_SOURCES        = gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
419 gdbus_test_codegen_old_SOURCES           = $(gdbus_sessionbus_sources) gdbus-test-codegen.c
420 nodist_gdbus_test_codegen_old_SOURCES    = gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
421 gdbus_test_codegen_old_CPPFLAGS          = $(AM_CPPFLAGS) -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36
422 gdbus_threading_SOURCES                  = $(gdbus_sessionbus_sources) gdbus-threading.c
423 gmenumodel_SOURCES                       = $(gdbus_sessionbus_sources) gmenumodel.c
424
425 gdbus-test-codegen.o: gdbus-test-codegen-generated.h
426 gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
427         $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
428                 UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
429                 $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
430                 --interface-prefix org.project. \
431                 --generate-c-code gdbus-test-codegen-generated \
432                 --c-generate-object-manager \
433                 --c-namespace Foo_iGen \
434                 --generate-docbook gdbus-test-codegen-generated-doc \
435                 --annotate "org.project.Bar" Key1 Value1 \
436                 --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
437                 --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
438                 --annotate "org.project.Bar::TestSignal" Key4 Value4 \
439                 --annotate "org.project.Bar:ay" Key5 Value5 \
440                 --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
441                 --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
442                 --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
443                 $(srcdir)/test-codegen.xml \
444                 $(NULL)
445
446 EXTRA_DIST += test-codegen.xml
447 CLEANFILES += gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml
448 endif # OS_UNIX
449 endif # HAVE_DBUS_DAEMON
450
451 tls_interaction_SOURCES = tls-interaction.c gtesttlsbackend.c gtesttlsbackend.h
452
453 # -----------------------------------------------------------------------------
454
455 if OS_WIN32
456 test_programs += win32-streams
457 endif
458
459 if PLATFORM_WIN32
460 no_undefined = -no-undefined
461 endif
462
463 if HAVE_DBUS1
464 test_programs += gdbus-serialization
465 gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
466 gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
467 gdbus_serialization_SOURCES = \
468         gdbus-serialization.c                   \
469         gdbus-tests.h                           \
470         gdbus-tests.c
471 endif
472
473 # -----------------------------------------------------------------------------
474 #  The resources test is a bit more complicated...
475
476 test_programs += resources
477 resources_SOURCES = resources.c
478 nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h
479 resources_DEPENDENCIES = test.gresource
480
481 test_ltlibraries += libresourceplugin.la
482 libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c
483 libresourceplugin_la_LDFLAGS = -avoid-version -module -export-dynamic $(no_undefined)
484 libresourceplugin_la_LIBADD = $(LDADD)
485
486 # libtool contains a bug whereby the created .la file doesn't contain the correct dlname='' in the case that
487 # you're building a library but not installing it.  This is apparently because the only considered use for an
488 # uninstalled library is as a convenience library for linking (despite the fact that we give -module).  The lack
489 # of dlname='' in the .la trips up libltdl and GModule as well.  We can trick libtool into believing that we
490 # will install the module by giving it a bogus -rpath for the uninstalled cases.
491 #
492 # See http://lists.gnu.org/archive/html/bug-libtool/2013-05/msg00009.html
493 if !ENABLE_INSTALLED_TESTS
494 libresourceplugin_la_LDFLAGS += -rpath /
495 endif
496
497 if CROSS_COMPILING
498   glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
499 else
500   glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
501 endif
502
503 resources.o: test_resources2.h
504 test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml)
505         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $<
506
507 test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml)
508         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $<
509
510 plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml)
511         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $<
512
513 test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml)
514         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
515
516 EXTRA_DIST += test.gresource.xml test1.txt test2.gresource.xml test2.txt test3.gresource.xml test3.txt test4.gresource.xml
517
518 CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource