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