gio/tests: gsettings is a developer-only test
[platform/upstream/glib.git] / gio / tests / Makefile.am
1
2 NULL =
3 BUILT_SOURCES =
4
5 include $(top_srcdir)/Makefile.decl
6
7 insttestdir = $(pkglibexecdir)/installed-tests
8
9 SUBDIRS = gdbus-object-manager-example services
10
11 AM_CPPFLAGS =                           \
12         -DG_LOG_DOMAIN=\"GLib-GIO\"     \
13         $(gio_INCLUDES)                 \
14         $(GLIB_DEBUG_FLAGS)             \
15         -I$(top_builddir)/gio           \
16         -I$(top_srcdir)/gio             \
17         $(DBUS1_CFLAGS)                 \
18         -DSRCDIR=\""$(srcdir)"\"        \
19         -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\"
20
21 AM_CFLAGS = $(GLIB_WARN_CFLAGS)
22
23 noinst_PROGRAMS = $(TEST_PROGS) $(SAMPLE_PROGS)
24 noinst_DATA = $(MISC_STUFF)
25
26 LDADD     =                                     \
27         $(top_builddir)/glib/libglib-2.0.la             \
28         $(top_builddir)/gthread/libgthread-2.0.la       \
29         $(top_builddir)/gobject/libgobject-2.0.la       \
30         $(top_builddir)/gmodule/libgmodule-2.0.la       \
31         $(top_builddir)/gio/libgio-2.0.la
32
33 test_progs =                    \
34         io-stream               \
35         memory-input-stream     \
36         memory-output-stream    \
37         readwrite               \
38         g-file                  \
39         g-file-info             \
40         converter-stream        \
41         data-input-stream       \
42         data-output-stream      \
43         g-icon                  \
44         buffered-input-stream   \
45         buffered-output-stream  \
46         sleepy-stream           \
47         filter-streams          \
48         volumemonitor           \
49         simple-async-result     \
50         srvtarget               \
51         contexts                \
52         gsettings               \
53         gschema-compile         \
54         async-close-output-stream \
55         gdbus-addresses         \
56         network-address         \
57         gdbus-message           \
58         socket                  \
59         pollable                \
60         tls-certificate         \
61         tls-interaction         \
62         cancellable             \
63         vfs                     \
64         network-monitor         \
65         fileattributematcher    \
66         resources               \
67         proxy-test              \
68         simple-proxy            \
69         inet-address            \
70         permission              \
71         task                    \
72         credentials             \
73         $(NULL)
74
75 if HAVE_DBUS_DAEMON
76 test_progs +=                   \
77         actions                 \
78         gdbus-connection        \
79         gdbus-connection-loss   \
80         gdbus-connection-slow   \
81         gdbus-names             \
82         gdbus-proxy             \
83         gdbus-proxy-threads     \
84         gdbus-proxy-well-known-name \
85         gdbus-introspection     \
86         gdbus-threading         \
87         gdbus-export            \
88         gdbus-error             \
89         gdbus-bz627724          \
90         gmenumodel              \
91         $(NULL)
92 endif
93
94 if OS_UNIX
95 test_progs +=                   \
96         gdbus-close-pending     \
97         gdbus-connection-flush  \
98         gdbus-peer              \
99         gdbus-exit-on-close     \
100         gdbus-non-socket        \
101         gdbus-peer-object-manager \
102         appinfo                 \
103         contenttype             \
104         mimeapps                \
105         file                    \
106         $(NULL)
107 endif
108
109 SAMPLE_PROGS =                          \
110         resolver                        \
111         socket-server                   \
112         socket-client                   \
113         echo-server                     \
114         httpd                           \
115         send-data                       \
116         filter-cat                      \
117         gdbus-example-export            \
118         gdbus-example-own-name          \
119         gdbus-example-watch-name        \
120         gdbus-example-watch-proxy       \
121         gdbus-example-server            \
122         gdbus-example-subtree           \
123         gdbus-example-peer              \
124         gdbus-example-proxy-subclass    \
125         proxy                           \
126         gapplication-example-open       \
127         gapplication-example-cmdline    \
128         gapplication-example-cmdline2   \
129         gapplication-example-cmdline3   \
130         gapplication-example-actions    \
131         gapplication-example-dbushooks  \
132         gdbus-daemon                    \
133         $(NULL)
134
135 other_progs =                           \
136         gdbus-testserver                \
137         gdbus-connection-flush-helper   \
138         $(NULL)
139
140 if OS_UNIX
141 test_progs +=                   \
142         live-g-file             \
143         desktop-app-info        \
144         unix-fd                 \
145         unix-streams            \
146         gapplication            \
147         basic-application       \
148         gdbus-test-codegen      \
149         socket-address          \
150         $(NULL)
151
152 other_progs +=                                  \
153         appinfo-test                            \
154         $(NULL)
155
156 SAMPLE_PROGS +=                                 \
157         gdbus-example-unix-fd-client            \
158         gdbus-example-objectmanager-server      \
159         gdbus-example-objectmanager-client      \
160         gdbus-test-fixture                      \
161         $(NULL)
162 endif
163
164 if OS_WIN32
165 TEST_PROGS += win32-streams
166 endif
167
168 if PLATFORM_WIN32
169 no_undefined = -no-undefined
170 endif
171
172 actions_SOURCES   = actions.c gdbus-sessionbus.c gdbus-sessionbus.h
173
174 unix_streams_LDADD       = $(LDADD) \
175         $(top_builddir)/gthread/libgthread-2.0.la
176
177 win32_streams_LDADD      = $(LDADD) \
178         $(top_builddir)/gthread/libgthread-2.0.la
179
180 resolver_LDADD            = $(LDADD) \
181         $(top_builddir)/gthread/libgthread-2.0.la
182
183 socket_server_LDADD       = $(LDADD) \
184         $(top_builddir)/gthread/libgthread-2.0.la
185
186 socket_client_SOURCES     = socket-client.c \
187                             gtlsconsoleinteraction.c \
188                             gtlsconsoleinteraction.h
189 socket_client_LDADD       = $(LDADD) \
190         $(top_builddir)/gthread/libgthread-2.0.la
191
192 echo_server_LDADD         = $(LDADD) \
193         $(top_builddir)/gthread/libgthread-2.0.la
194
195 httpd_LDADD               = $(LDADD) \
196         $(top_builddir)/gthread/libgthread-2.0.la
197
198 send_data_LDADD           = $(LDADD) \
199         $(top_builddir)/gthread/libgthread-2.0.la
200
201 contexts_LDADD            = $(LDADD) \
202         $(top_builddir)/gthread/libgthread-2.0.la
203
204 gdbus_daemon_SOURCES = gdbus-daemon.c $(top_srcdir)/gio/gdbusdaemon.c $(top_builddir)/gio/gdbus-daemon-generated.c
205
206 gdbus_testserver_SOURCES = gdbus-testserver.c
207
208 if HAVE_DBUS1
209 test_progs += gdbus-serialization
210 gdbus_serialization_SOURCES = gdbus-serialization.c gdbus-tests.h gdbus-tests.c
211 gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
212 gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
213 endif
214
215 test_progs += gdbus-auth
216 gdbus_auth_SOURCES = gdbus-auth.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
217 gdbus_auth_LDADD = $(LDADD)
218
219 gdbus_bz627724_SOURCES = gdbus-bz627724.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
220
221 gdbus_close_pending_SOURCES = gdbus-close-pending.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
222
223 if OS_UNIX
224 gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
225         $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
226                 UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
227                 $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
228                 --interface-prefix org.project. \
229                 --generate-c-code gdbus-test-codegen-generated \
230                 --c-generate-object-manager \
231                 --c-namespace Foo_iGen \
232                 --generate-docbook gdbus-test-codegen-generated-doc \
233                 --annotate "org.project.Bar" Key1 Value1 \
234                 --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
235                 --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
236                 --annotate "org.project.Bar::TestSignal" Key4 Value4 \
237                 --annotate "org.project.Bar:ay" Key5 Value5 \
238                 --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
239                 --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
240                 --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
241                 $(srcdir)/test-codegen.xml \
242                 $(NULL)
243
244 BUILT_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
245
246 gdbus_test_codegen_SOURCES  = gdbus-test-codegen.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
247 gdbus_test_codegen_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
248
249 endif # OS_UNIX
250
251 gdbus_connection_SOURCES = gdbus-connection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
252
253 gdbus_connection_flush_SOURCES = \
254         gdbus-connection-flush.c \
255         test-io-stream.c \
256         test-io-stream.h \
257         test-pipe-unix.c \
258         test-pipe-unix.h \
259         $(NULL)
260
261 gdbus_connection_loss_SOURCES = gdbus-connection-loss.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
262
263 gdbus_connection_slow_SOURCES = gdbus-connection-slow.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
264
265 gdbus_names_SOURCES = gdbus-names.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
266
267 gdbus_proxy_SOURCES = gdbus-proxy.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
268
269 gdbus_proxy_threads_SOURCES = gdbus-proxy-threads.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
270
271 gdbus_proxy_well_known_name_SOURCES = gdbus-proxy-well-known-name.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
272
273 gdbus_introspection_SOURCES = gdbus-introspection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
274
275 gdbus_threading_SOURCES = gdbus-threading.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
276
277 gdbus_export_SOURCES = gdbus-export.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
278
279 gdbus_error_SOURCES = gdbus-error.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
280
281 gdbus_non_socket_SOURCES = \
282         gdbus-non-socket.c \
283         gdbus-tests.c \
284         gdbus-tests.h \
285         test-io-stream.c \
286         test-io-stream.h \
287         test-pipe-unix.c \
288         test-pipe-unix.h \
289         $(NULL)
290
291 gdbus_exit_on_close_SOURCES = gdbus-exit-on-close.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
292
293 resources_SOURCES = resources.c test_resources.c test_resources2.c test_resources2.h
294 resources_DEPENDENCIES = test.gresource
295
296 gapplication_SOURCES = gapplication.c gdbus-sessionbus.h gdbus-sessionbus.c gdbus-tests.h gdbus-tests.c
297
298 gmenumodel_SOURCES = gmenumodel.c gdbus-sessionbus.h gdbus-sessionbus.c
299
300 TEST_PROGS += $(test_progs)
301
302 TESTS_ENVIRONMENT = \
303         GLIB_MKENUMS=../../gobject/glib-mkenums \
304         GLIB_COMPILE_SCHEMAS=../glib-compile-schemas
305
306 schema_tests = \
307         array-default-not-in-choices.gschema.xml        \
308         bad-choice.gschema.xml                          \
309         bad-key.gschema.xml                             \
310         bad-key2.gschema.xml                            \
311         bad-key3.gschema.xml                            \
312         bad-key4.gschema.xml                            \
313         bad-type.gschema.xml                            \
314         bare-alias.gschema.xml                          \
315         choice-alias.gschema.xml                        \
316         choice-bad.gschema.xml                          \
317         choice-badtype.gschema.xml                      \
318         choice-invalid-alias.gschema.xml                \
319         choice-missing-value.gschema.xml                \
320         choice-shadowed-alias.gschema.xml               \
321         choice-upside-down.gschema.xml                  \
322         choice.gschema.xml                              \
323         choices-wrong-type.gschema.xml                  \
324         default-in-aliases.gschema.xml                  \
325         default-not-in-choices.gschema.xml              \
326         default-out-of-range.gschema.xml                \
327         empty-key.gschema.xml                           \
328         enum-with-aliases.gschema.xml                   \
329         enum-with-bad-default.gschema.xml               \
330         enum-with-chained-alias.gschema.xml             \
331         enum-with-choice.gschema.xml                    \
332         enum-with-invalid-alias.gschema.xml             \
333         enum-with-repeated-alias.gschema.xml            \
334         enum-with-repeated-nick.gschema.xml             \
335         enum-with-repeated-value.gschema.xml            \
336         enum-with-shadow-alias.gschema.xml              \
337         enum.gschema.xml                                \
338         flags-aliased-default.gschema.xml               \
339         flags-bad-default.gschema.xml                   \
340         flags-more-than-one-bit.gschema.xml             \
341         flags-with-enum-attr.gschema.xml                \
342         flags-with-enum-tag.gschema.xml                 \
343         extend-and-shadow-indirect.gschema.xml          \
344         extend-and-shadow.gschema.xml                   \
345         extend-missing.gschema.xml                      \
346         extend-nonlist.gschema.xml                      \
347         extend-self.gschema.xml                         \
348         extend-wrong-list-indirect.gschema.xml          \
349         extend-wrong-list.gschema.xml                   \
350         extending.gschema.xml                           \
351         from-docs.gschema.xml                           \
352         incomplete-list.gschema.xml                     \
353         inherit-gettext-domain.gschema.xml              \
354         invalid-path.gschema.xml                        \
355         key-in-list-indirect.gschema.xml                \
356         key-in-list.gschema.xml                         \
357         list-of-missing.gschema.xml                     \
358         missing-quotes.gschema.xml                              \
359         no-default.gschema.xml                          \
360         overflow.gschema.xml                            \
361         override-missing.gschema.xml                    \
362         override-range-error.gschema.xml                \
363         override-then-key.gschema.xml                   \
364         override-twice.gschema.xml                      \
365         override-type-error.gschema.xml                 \
366         override.gschema.xml                            \
367         range-badtype.gschema.xml                       \
368         range-default-high.gschema.xml                  \
369         range-default-low.gschema.xml                   \
370         range-high-default.gschema.xml                  \
371         range-low-default.gschema.xml                   \
372         range-missing-max.gschema.xml                   \
373         range-missing-min.gschema.xml                   \
374         range-parse-error.gschema.xml                   \
375         range-wrong-type.gschema.xml                    \
376         range.gschema.xml                               \
377         wrong-category.gschema.xml                      \
378         $(NULL)
379
380 schema_test_files = $(addprefix schema-tests/,$(schema_tests))
381
382 proxy_LDADD   = $(LDADD) \
383         $(top_builddir)/gthread/libgthread-2.0.la
384
385 tls_certificate_SOURCES = tls-certificate.c gtesttlsbackend.c gtesttlsbackend.h
386
387 cert_tests =                    \
388         cert1.pem               \
389         cert2.pem               \
390         cert3.pem               \
391         cert-key.pem            \
392         cert-list.pem           \
393         key8.pem                \
394         key-cert.pem            \
395         key.pem                 \
396         nothing.pem             \
397         $(NULL)
398
399 cert_test_files = $(addprefix cert-tests/,$(cert_tests))
400
401 # -----------------------------------------------------------------------------
402
403 if OS_UNIX
404 gdbus_example_objectmanager_server_CFLAGS   = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
405 gdbus_example_objectmanager_server_LDADD    = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
406
407 gdbus_example_objectmanager_client_CFLAGS   = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
408 gdbus_example_objectmanager_client_LDADD    = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
409
410 gdbus_peer_SOURCES = gdbus-peer.c gdbus-tests.h gdbus-tests.c
411 gdbus_peer_CFLAGS  = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
412 gdbus_peer_LDADD   = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
413
414 gdbus_test_fixture_SOURCES = gdbus-test-fixture.c
415 gdbus_test_fixture_CFLAGS  = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
416 gdbus_test_fixture_LDADD   = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
417
418 endif OS_UNIX
419
420 # -----------------------------------------------------------------------------
421
422 desktop_test_files = \
423         appinfo-test.desktop                    \
424         appinfo-test2.desktop                   \
425         appinfo-test-gnome.desktop              \
426         appinfo-test-notgnome.desktop           \
427         $(NULL)
428
429 EXTRA_DIST += \
430         socket-common.c                 \
431         org.gtk.test.gschema            \
432         org.gtk.test.gschema.xml        \
433         de.po                           \
434         $(schema_test_files)            \
435         test-codegen.xml                \
436         $(cert_test_files)              \
437         test.gresource.xml              \
438         test1.txt                       \
439         test2.gresource.xml             \
440         test2.txt                       \
441         test3.gresource.xml             \
442         test3.txt                       \
443         test4.gresource.xml             \
444         $(desktop_test_files)           \
445         $(NULL)
446
447 MISC_STUFF = test.mo test.gresource
448
449 test.mo: de.po
450         $(MSGFMT) -o test.mo $(srcdir)/de.po; \
451         $(MKDIR_P) de/LC_MESSAGES; \
452         cp -f test.mo de/LC_MESSAGES
453
454 if CROSS_COMPILING
455   glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
456 else
457   glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
458 endif
459
460 BUILT_SOURCES += test_resources.c test_resources2.c test_resources2.h
461 test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml)
462         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $<
463
464 test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml)
465         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $<
466
467 plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml)
468         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $<
469
470 test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml)
471         $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
472
473 if BUILDOPT_INSTALL_TESTS
474 insttest_LTLIBRARIES = libresourceplugin.la
475 else
476 noinst_LTLIBRARIES = libresourceplugin.la
477 endif
478
479 libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c
480 libresourceplugin_la_LDFLAGS = -avoid-version -module $(no_undefined) -rpath $(insttestdir)
481 libresourceplugin_la_LIBADD = $(LDADD)
482
483 CLEANFILES = gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml test_resources2.[ch] plugin_resources.c
484
485 DISTCLEANFILES = \
486         applications/mimeinfo.cache     \
487         org.gtk.test.enums.xml          \
488         de/LC_MESSAGES/test.mo          \
489         test.mo                         \
490         test.gresource                  \
491         test_resources.c                \
492         gsettings.store                 \
493         gschemas.compiled               \
494         schema-source/gschemas.compiled
495
496 distclean-local:
497         rm -rf xdgdatahome xdgdatadir
498
499 test_files =                                    \
500         contexts.c                              \
501         g-icon.c                                \
502         file.c                                  \
503         enums.xml.template                      \
504         testenum.h                              \
505         org.gtk.test.gschema.xml                \
506         org.gtk.schemasourcecheck.gschema.xml   \
507         test.gresource                          \
508         $(NULL)
509 EXTRA_DIST += $(test_files)
510
511 if BUILDOPT_INSTALL_TESTS
512 insttest_PROGRAMS = $(test_progs) $(other_progs)
513
514 schematestdir = $(insttestdir)/schema-tests
515 schematest_DATA = $(schema_test_files)
516
517 certtestdir = $(insttestdir)/cert-tests
518 certtest_DATA = $(cert_test_files)
519
520 testdatadir = $(insttestdir)
521 testdata_DATA = $(test_files)
522
523 testmetadir = $(datadir)/installed-tests/$(PACKAGE)
524 xfail_tests = desktop-app-info.test
525 developer_only_tests = gsettings.test
526 testmeta_DATA = $(filter-out $(xfail_tests) $(developer_only_tests),$(test_progs:=.test))
527
528 %.test: % Makefile
529         $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
530          echo 'Type=session' >> $@.tmp; \
531          echo 'Exec=env G_TEST_DATA=$(pkglibexecdir)/installed-tests $(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
532          mv $@.tmp $@)
533
534 %.desktop.insttest: %.desktop
535         sed -e s,Exec=./appinfo-test,Exec=$(insttestdir)/appinfo-test, < $< >$@.tmp && mv $@.tmp $@
536
537 installed_desktop_test_files = $(desktop_test_files:.desktop=.desktop.insttest)
538 install-data-local: $(installed_desktop_test_files)
539         for x in $(desktop_test_files); do \
540           install -m 0644 $${x}.insttest $(DESTDIR)$(testdatadir)/$$x; \
541         done
542         install -d -m 0755 $(DESTDIR)$(testdatadir)/schema-tests
543
544 endif