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