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