diff options
Diffstat (limited to 'gio/tests')
-rw-r--r-- | gio/tests/Makefile.am | 729 | ||||
-rw-r--r-- | gio/tests/gdbus-example-objectmanager-client.c | 2 | ||||
-rw-r--r-- | gio/tests/gdbus-example-objectmanager-server.c | 2 | ||||
-rw-r--r-- | gio/tests/gdbus-object-manager-example/Makefile.am | 37 | ||||
-rw-r--r-- | gio/tests/gdbus-peer.c | 2 | ||||
-rw-r--r-- | gio/tests/gdbus-test-fixture.c | 2 | ||||
-rw-r--r-- | gio/tests/gsettings.c | 61 |
7 files changed, 361 insertions, 474 deletions
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index 948be4659..116d9f261 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -1,310 +1,107 @@ - -NULL = -BUILT_SOURCES = - -include $(top_srcdir)/Makefile.decl - -insttestdir = $(pkglibexecdir)/installed-tests +include $(top_srcdir)/glib.mk +test_ltlibraries = SUBDIRS = gdbus-object-manager-example services -AM_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"GLib-GIO\" \ - $(gio_INCLUDES) \ - $(GLIB_DEBUG_FLAGS) \ - -I$(top_builddir)/gio \ - -I$(top_srcdir)/gio \ - $(DBUS1_CFLAGS) \ - -DSRCDIR=\""$(srcdir)"\" \ - -DBUILDDIR=\""$(abs_builddir)"\" \ - -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\" - -AM_CFLAGS = $(GLIB_WARN_CFLAGS) - -noinst_PROGRAMS = $(TEST_PROGS) $(SAMPLE_PROGS) -noinst_DATA = $(MISC_STUFF) - -LDADD = \ - $(top_builddir)/glib/libglib-2.0.la \ - $(top_builddir)/gthread/libgthread-2.0.la \ +LDADD = \ + $(top_builddir)/glib/libglib-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gmodule/libgmodule-2.0.la \ $(top_builddir)/gio/libgio-2.0.la +AM_CPPFLAGS = $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio +DEFS = -DG_LOG_DOMAIN=\"GLib-GIO\" -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\" +AM_CFLAGS = $(GLIB_WARN_CFLAGS) -test_progs = \ - io-stream \ - memory-input-stream \ - memory-output-stream \ - readwrite \ - g-file \ - g-file-info \ - converter-stream \ - data-input-stream \ - data-output-stream \ - g-icon \ - buffered-input-stream \ - buffered-output-stream \ - sleepy-stream \ - filter-streams \ - volumemonitor \ - simple-async-result \ - srvtarget \ - contexts \ - gsettings \ - gschema-compile \ - async-close-output-stream \ - gdbus-addresses \ - network-address \ - gdbus-message \ - socket \ - pollable \ - tls-certificate \ - tls-interaction \ - cancellable \ - vfs \ - network-monitor \ - fileattributematcher \ - resources \ - proxy-test \ - simple-proxy \ - inet-address \ - permission \ - task \ - credentials \ - $(NULL) - -if HAVE_DBUS_DAEMON -test_progs += \ - actions \ - gdbus-connection \ - gdbus-connection-loss \ - gdbus-connection-slow \ - gdbus-names \ - gdbus-proxy \ - gdbus-proxy-threads \ - gdbus-proxy-well-known-name \ - gdbus-introspection \ - gdbus-threading \ - gdbus-export \ - gdbus-error \ - gdbus-bz627724 \ - gmenumodel \ - $(NULL) -endif - -if OS_UNIX -test_progs += \ - gdbus-close-pending \ - gdbus-connection-flush \ - gdbus-peer \ - gdbus-exit-on-close \ - gdbus-non-socket \ - gdbus-peer-object-manager \ - appinfo \ - contenttype \ - mimeapps \ - file \ +# ----------------------------------------------------------------------------- +# Test programs buildable on all platforms + +test_programs = \ + io-stream \ + memory-input-stream \ + memory-output-stream \ + readwrite \ + g-file \ + g-file-info \ + converter-stream \ + data-input-stream \ + data-output-stream \ + g-icon \ + buffered-input-stream \ + buffered-output-stream \ + sleepy-stream \ + filter-streams \ + volumemonitor \ + simple-async-result \ + srvtarget \ + contexts \ + gschema-compile \ + async-close-output-stream \ + gdbus-addresses \ + network-address \ + gdbus-message \ + socket \ + pollable \ + tls-interaction \ + cancellable \ + vfs \ + network-monitor \ + fileattributematcher \ + proxy-test \ + simple-proxy \ + inet-address \ + permission \ + task \ + credentials \ $(NULL) -endif -SAMPLE_PROGS = \ - resolver \ - socket-server \ - socket-client \ - echo-server \ - httpd \ - send-data \ - filter-cat \ - gdbus-example-export \ - gdbus-example-own-name \ - gdbus-example-watch-name \ - gdbus-example-watch-proxy \ - gdbus-example-server \ - gdbus-example-subtree \ - gdbus-example-peer \ - gdbus-example-proxy-subclass \ - proxy \ - gapplication-example-open \ - gapplication-example-cmdline \ - gapplication-example-cmdline2 \ - gapplication-example-cmdline3 \ - gapplication-example-actions \ - gapplication-example-dbushooks \ - gdbus-daemon \ +uninstalled_test_programs = \ $(NULL) -other_progs = \ - gdbus-testserver \ - gdbus-connection-flush-helper \ +dist_test_data = \ + org.gtk.test.gschema.xml \ + org.gtk.schemasourcecheck.gschema.xml \ + testenum.h \ + enums.xml.template \ + contexts.c \ + g-icon.c \ $(NULL) -noinst_PROGRAMS += $(other_progs) -if OS_UNIX -test_progs += \ - live-g-file \ - desktop-app-info \ - unix-fd \ - unix-streams \ - gapplication \ - basic-application \ - gdbus-test-codegen \ - socket-address \ +test_data = \ + test.gresource \ $(NULL) -other_progs += \ - appinfo-test \ +uninstalled_test_extra_programs = \ + resolver \ + socket-server \ + echo-server \ + httpd \ + send-data \ + filter-cat \ + gdbus-example-export \ + gdbus-example-own-name \ + gdbus-example-watch-name \ + gdbus-example-watch-proxy \ + gdbus-example-server \ + gdbus-example-subtree \ + gdbus-example-peer \ + gdbus-example-proxy-subclass \ + proxy \ + gapplication-example-open \ + gapplication-example-cmdline \ + gapplication-example-cmdline2 \ + gapplication-example-cmdline3 \ + gapplication-example-actions \ + gapplication-example-dbushooks \ $(NULL) -SAMPLE_PROGS += \ - gdbus-example-unix-fd-client \ - gdbus-example-objectmanager-server \ - gdbus-example-objectmanager-client \ - gdbus-test-fixture \ +test_extra_programs = \ + gdbus-testserver \ + gdbus-connection-flush-helper \ $(NULL) -endif - -if OS_WIN32 -TEST_PROGS += win32-streams -endif - -if PLATFORM_WIN32 -no_undefined = -no-undefined -endif - -actions_SOURCES = actions.c gdbus-sessionbus.c gdbus-sessionbus.h - -unix_streams_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -win32_streams_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -resolver_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -socket_server_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -socket_client_SOURCES = socket-client.c \ - gtlsconsoleinteraction.c \ - gtlsconsoleinteraction.h -socket_client_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -echo_server_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -httpd_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -send_data_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -contexts_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -gdbus_daemon_SOURCES = gdbus-daemon.c $(top_srcdir)/gio/gdbusdaemon.c $(top_builddir)/gio/gdbus-daemon-generated.c - -gdbus_testserver_SOURCES = gdbus-testserver.c - -if HAVE_DBUS1 -test_progs += gdbus-serialization -gdbus_serialization_SOURCES = gdbus-serialization.c gdbus-tests.h gdbus-tests.c -gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS) -gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS) -endif - -test_progs += gdbus-auth -gdbus_auth_SOURCES = gdbus-auth.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c -gdbus_auth_LDADD = $(LDADD) - -gdbus_bz627724_SOURCES = gdbus-bz627724.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_close_pending_SOURCES = gdbus-close-pending.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -if OS_UNIX -gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen - $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \ - UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \ - $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \ - --interface-prefix org.project. \ - --generate-c-code gdbus-test-codegen-generated \ - --c-generate-object-manager \ - --c-namespace Foo_iGen \ - --generate-docbook gdbus-test-codegen-generated-doc \ - --annotate "org.project.Bar" Key1 Value1 \ - --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \ - --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \ - --annotate "org.project.Bar::TestSignal" Key4 Value4 \ - --annotate "org.project.Bar:ay" Key5 Value5 \ - --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \ - --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \ - --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \ - $(srcdir)/test-codegen.xml \ - $(NULL) - -BUILT_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h - -gdbus_test_codegen_SOURCES = gdbus-test-codegen.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c -gdbus_test_codegen_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h - -endif # OS_UNIX - -gdbus_connection_SOURCES = gdbus-connection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_connection_flush_SOURCES = \ - gdbus-connection-flush.c \ - test-io-stream.c \ - test-io-stream.h \ - test-pipe-unix.c \ - test-pipe-unix.h \ - $(NULL) - -gdbus_connection_loss_SOURCES = gdbus-connection-loss.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_connection_slow_SOURCES = gdbus-connection-slow.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_names_SOURCES = gdbus-names.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_proxy_SOURCES = gdbus-proxy.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_proxy_threads_SOURCES = gdbus-proxy-threads.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_proxy_well_known_name_SOURCES = gdbus-proxy-well-known-name.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_introspection_SOURCES = gdbus-introspection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_threading_SOURCES = gdbus-threading.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_export_SOURCES = gdbus-export.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_error_SOURCES = gdbus-error.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -gdbus_non_socket_SOURCES = \ - gdbus-non-socket.c \ - gdbus-tests.c \ - gdbus-tests.h \ - test-io-stream.c \ - test-io-stream.h \ - test-pipe-unix.c \ - test-pipe-unix.h \ - $(NULL) - -gdbus_exit_on_close_SOURCES = gdbus-exit-on-close.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c - -resources_SOURCES = resources.c test_resources.c test_resources2.c test_resources2.h -resources_DEPENDENCIES = test.gresource - -gapplication_SOURCES = gapplication.c gdbus-sessionbus.h gdbus-sessionbus.c gdbus-tests.h gdbus-tests.c - -gmenumodel_SOURCES = gmenumodel.c gdbus-sessionbus.h gdbus-sessionbus.c - -TEST_PROGS += $(test_progs) - -TESTS_ENVIRONMENT = \ - GLIB_MKENUMS=../../gobject/glib-mkenums \ - GLIB_COMPILE_SCHEMAS=../glib-compile-schemas +# We need this indirection in order to save automake from itself +dist_test_data += $(schema_data_files) +schema_data_files = $(addprefix schema-tests/,$(schema_tests)) schema_tests = \ array-default-not-in-choices.gschema.xml \ bad-choice.gschema.xml \ @@ -357,7 +154,7 @@ schema_tests = \ key-in-list-indirect.gschema.xml \ key-in-list.gschema.xml \ list-of-missing.gschema.xml \ - missing-quotes.gschema.xml \ + missing-quotes.gschema.xml \ no-default.gschema.xml \ overflow.gschema.xml \ override-missing.gschema.xml \ @@ -379,167 +176,269 @@ schema_tests = \ wrong-category.gschema.xml \ $(NULL) -schema_test_files = $(addprefix schema-tests/,$(schema_tests)) - -proxy_LDADD = $(LDADD) \ - $(top_builddir)/gthread/libgthread-2.0.la - -tls_certificate_SOURCES = tls-certificate.c gtesttlsbackend.c gtesttlsbackend.h - -cert_tests = \ - cert1.pem \ - cert2.pem \ - cert3.pem \ - cert-key.pem \ - cert-list.pem \ - key8.pem \ - key-cert.pem \ - key.pem \ - nothing.pem \ +test_programs += tls-certificate +tls_certificate_SOURCES = \ + tls-certificate.c \ + gtesttlsbackend.c \ + gtesttlsbackend.h +dist_test_data += $(cert_data_files) +cert_data_files = $(addprefix cert-tests/,$(cert_tests)) +cert_tests = \ + cert1.pem \ + cert2.pem \ + cert3.pem \ + cert-key.pem \ + cert-list.pem \ + key8.pem \ + key-cert.pem \ + key.pem \ + nothing.pem \ $(NULL) -cert_test_files = $(addprefix cert-tests/,$(cert_tests)) +uninstalled_test_extra_programs += socket-client +socket_client_SOURCES = \ + socket-client.c \ + gtlsconsoleinteraction.c \ + gtlsconsoleinteraction.h + +uninstalled_test_extra_programs += gdbus-daemon +nodist_gdbus_daemon_SOURCES = \ + $(top_builddir)/gio/gdbus-daemon-generated.c +gdbus_daemon_SOURCES = \ + gdbus-daemon.c \ + $(top_srcdir)/gio/gdbusdaemon.c + +test_programs += gsettings +gsettings_DEPENDENCIES = test.mo +CLEANFILES += test.mo de/LC_MESSAGES/test.mo +test.mo: de.po + $(AM_V_GEN) $(MSGFMT) -o test.mo $(srcdir)/de.po; \ + $(MKDIR_P) de/LC_MESSAGES; \ + cp -f test.mo de/LC_MESSAGES +# Generated while running the testcase itself... +CLEANFILES += \ + org.gtk.test.enums.xml \ + gsettings.store \ + gschemas.compiled \ + schema-source/gschemas.compiled # ----------------------------------------------------------------------------- +# Test programs buildable on UNIX only if OS_UNIX -gdbus_example_objectmanager_server_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example -gdbus_example_objectmanager_server_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) - -gdbus_example_objectmanager_client_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example -gdbus_example_objectmanager_client_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) - -gdbus_peer_SOURCES = gdbus-peer.c gdbus-tests.h gdbus-tests.c -gdbus_peer_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example -gdbus_peer_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) - -gdbus_test_fixture_SOURCES = gdbus-test-fixture.c -gdbus_test_fixture_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example -gdbus_test_fixture_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) - -endif OS_UNIX +test_programs += \ + live-g-file \ + unix-fd \ + unix-streams \ + basic-application \ + gdbus-test-codegen \ + socket-address \ + gdbus-peer-object-manager \ + contenttype \ + file \ + $(NULL) -# ----------------------------------------------------------------------------- +# Uninstalled because of the check-for-executable logic in DesktopAppInfo unable to find the installed executable +uninstalled_test_programs += \ + appinfo \ + desktop-app-info \ + $(NULL) -desktop_test_files = \ +test_data += \ appinfo-test.desktop \ appinfo-test2.desktop \ appinfo-test-gnome.desktop \ appinfo-test-notgnome.desktop \ + file.c \ $(NULL) -EXTRA_DIST += \ - socket-common.c \ - org.gtk.test.gschema.xml \ - de.po \ - $(schema_test_files) \ - test-codegen.xml \ - $(cert_test_files) \ - test.gresource.xml \ - test1.txt \ - test2.gresource.xml \ - test2.txt \ - test3.gresource.xml \ - test3.txt \ - test4.gresource.xml \ - $(desktop_test_files) \ +test_extra_programs += \ + appinfo-test \ $(NULL) -MISC_STUFF = test.mo test.gresource - -test.mo: de.po - $(MSGFMT) -o test.mo $(srcdir)/de.po; \ - $(MKDIR_P) de/LC_MESSAGES; \ - cp -f test.mo de/LC_MESSAGES +uninstalled_test_extra_programs += \ + gdbus-example-unix-fd-client \ + $(NULL) -if CROSS_COMPILING - glib_compile_resources=$(GLIB_COMPILE_RESOURCES) -else - glib_compile_resources=$(top_builddir)/gio/glib-compile-resources -endif +test_programs += mimeapps +clean-local: clean-mimeapps +clean-mimeapps: + rm -rf xdgdatadir xdgdatahome -BUILT_SOURCES += test_resources.c test_resources2.c test_resources2.h -test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml) - $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $< +test_programs += gdbus-connection-flush +gdbus_connection_flush_SOURCES = \ + gdbus-connection-flush.c \ + test-io-stream.c \ + test-io-stream.h \ + test-pipe-unix.c \ + test-pipe-unix.h -test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml) - $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $< +test_programs += gdbus-exit-on-close +gdbus_exit_on_close_SOURCES = gdbus-exit-on-close.c $(gdbus_tests_sources) $(gdbus_sessionbus_sources) -plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml) - $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $< +test_programs += gdbus-non-socket +gdbus_non_socket_SOURCES = \ + gdbus-non-socket.c \ + gdbus-tests.c \ + gdbus-tests.h \ + test-io-stream.c \ + test-io-stream.h \ + test-pipe-unix.c \ + test-pipe-unix.h -test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml) - $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $< +# These three are manual-run tests because they need a session bus but don't bring one up themselves +uninstalled_test_extra_programs += gdbus-example-objectmanager-client +gdbus_example_objectmanager_client_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) -if BUILDOPT_INSTALL_TESTS -insttest_LTLIBRARIES = libresourceplugin.la -else -noinst_LTLIBRARIES = libresourceplugin.la -endif +uninstalled_test_extra_programs += gdbus-example-objectmanager-server +gdbus_example_objectmanager_server_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) -libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c -libresourceplugin_la_LDFLAGS = -avoid-version -module $(no_undefined) -rpath $(insttestdir) -libresourceplugin_la_LIBADD = $(LDADD) +uninstalled_test_extra_programs += gdbus-test-fixture +gdbus_test_fixture_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) -CLEANFILES = gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml test_resources2.[ch] plugin_resources.c +# This is peer to peer so it doesn't need a session bus (so we can run it normally) +test_programs += gdbus-peer +gdbus_peer_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD) -DISTCLEANFILES = \ - applications/mimeinfo.cache \ - org.gtk.test.enums.xml \ - de/LC_MESSAGES/test.mo \ - test.mo \ - test.gresource \ - test_resources.c \ - gsettings.store \ - gschemas.compiled \ - schema-source/gschemas.compiled +endif # OS_UNIX -distclean-local: - rm -rf xdgdatahome xdgdatadir +# ----------------------------------------------------------------------------- +# Test programs that need to bring up a session bus (requires dbus-daemon) -test_files = \ - contexts.c \ - g-icon.c \ - file.c \ - enums.xml.template \ - testenum.h \ - org.gtk.test.gschema.xml \ - org.gtk.schemasourcecheck.gschema.xml \ - test.gresource \ +if HAVE_DBUS_DAEMON +gdbus_sessionbus_sources = gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c + +test_programs += \ + gapplication \ + actions \ + gdbus-auth \ + gdbus-connection \ + gdbus-close-pending \ + gdbus-bz627724 \ + gdbus-connection-loss \ + gdbus-connection-slow \ + gdbus-names \ + gdbus-proxy \ + gdbus-proxy-threads \ + gdbus-proxy-well-known-name \ + gdbus-introspection \ + gdbus-threading \ + gdbus-export \ + gdbus-error \ + gmenumodel \ $(NULL) -EXTRA_DIST += $(test_files) -if BUILDOPT_INSTALL_TESTS -insttest_PROGRAMS = $(test_progs) $(other_progs) +gdbus_proxy_threads_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS) +gapplication_SOURCES = $(gdbus_sessionbus_sources) gapplication.c +actions_SOURCES = $(gdbus_sessionbus_sources) actions.c +gdbus_auth_SOURCES = $(gdbus_sessionbus_sources) gdbus-auth.c +gdbus_connection_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection.c +gdbus_close_pending_SOURCES = $(gdbus_sessionbus_sources) gdbus-close-pending.c +gdbus_bz627724_SOURCES = $(gdbus_sessionbus_sources) gdbus-bz627724.c +gdbus_connection_loss_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection-loss.c +gdbus_connection_slow_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection-slow.c +gdbus_names_SOURCES = $(gdbus_sessionbus_sources) gdbus-names.c +gdbus_proxy_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy.c +gdbus_proxy_threads_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy-threads.c +gdbus_proxy_well_known_name_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy-well-known-name.c +gdbus_introspection_SOURCES = $(gdbus_sessionbus_sources) gdbus-introspection.c +gdbus_threading_SOURCES = $(gdbus_sessionbus_sources) gdbus-threading.c +gdbus_export_SOURCES = $(gdbus_sessionbus_sources) gdbus-export.c +gdbus_error_SOURCES = $(gdbus_sessionbus_sources) gdbus-error.c +gmenumodel_SOURCES = $(gdbus_sessionbus_sources) gmenumodel.c + +if OS_UNIX +gdbus_test_codegen_SOURCES = $(gdbus_sessionbus_sources) gdbus-test-codegen.c +nodist_gdbus_test_codegen_SOURCES = gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h + +gdbus-test-codegen.o: gdbus-test-codegen-generated.h +gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen + $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \ + UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \ + $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \ + --interface-prefix org.project. \ + --generate-c-code gdbus-test-codegen-generated \ + --c-generate-object-manager \ + --c-namespace Foo_iGen \ + --generate-docbook gdbus-test-codegen-generated-doc \ + --annotate "org.project.Bar" Key1 Value1 \ + --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \ + --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \ + --annotate "org.project.Bar::TestSignal" Key4 Value4 \ + --annotate "org.project.Bar:ay" Key5 Value5 \ + --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \ + --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \ + --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \ + $(srcdir)/test-codegen.xml \ + $(NULL) + +CLEANFILES += gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml +endif # OS_UNIX +endif # HAVE_DBUS_DAEMON -schematestdir = $(insttestdir)/schema-tests -schematest_DATA = $(schema_test_files) +# ----------------------------------------------------------------------------- -certtestdir = $(insttestdir)/cert-tests -certtest_DATA = $(cert_test_files) +if OS_WIN32 +test_programs += win32-streams +endif -testdatadir = $(insttestdir) -testdata_DATA = $(test_files) +if PLATFORM_WIN32 +no_undefined = -no-undefined +endif -testmetadir = $(datadir)/installed-tests/$(PACKAGE) -xfail_tests = desktop-app-info.test -developer_only_tests = gsettings.test -testmeta_DATA = $(filter-out $(xfail_tests) $(developer_only_tests),$(test_progs:=.test)) +if HAVE_DBUS1 +test_programs += gdbus-serialization +gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS) +gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS) +gdbus_serialization_SOURCES = \ + gdbus-serialization.c \ + gdbus-tests.h \ + gdbus-tests.c +endif -%.test: %$(EXEEXT) Makefile - $(AM_V_GEN) (echo '[Test]' > $@.tmp; \ - echo 'Type=session' >> $@.tmp; \ - echo 'Exec=$(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \ - mv $@.tmp $@) +# ----------------------------------------------------------------------------- +# The resources test is a bit more complicated... -%.desktop.insttest: %.desktop - sed -e s,Exec=./appinfo-test,Exec=$(insttestdir)/appinfo-test, < $< >$@.tmp && mv $@.tmp $@ +test_programs += resources +resources_SOURCES = resources.c +nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h +resources_DEPENDENCIES = test.gresource -installed_desktop_test_files = $(desktop_test_files:.desktop=.desktop.insttest) -install-data-local: $(installed_desktop_test_files) - for x in $(desktop_test_files); do \ - install -m 0644 $${x}.insttest $(DESTDIR)$(testdatadir)/$$x; \ - done - install -d -m 0755 $(DESTDIR)$(testdatadir)/schema-tests +test_ltlibraries += libresourceplugin.la +libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c +libresourceplugin_la_LDFLAGS = -avoid-version -module -export-dynamic $(no_undefined) +libresourceplugin_la_LIBADD = $(LDADD) +# libtool contains a bug whereby the created .la file doesn't contain the correct dlname='' in the case that +# you're building a library but not installing it. This is apparently because the only considered use for an +# uninstalled library is as a convenience library for linking (despite the fact that we give -module). The lack +# of dlname='' in the .la trips up libltdl and GModule as well. We can trick libtool into believing that we +# will install the module by giving it a bogus -rpath for the uninstalled cases. +# +# See http://lists.gnu.org/archive/html/bug-libtool/2013-05/msg00009.html +if !ENABLE_INSTALLED_TESTS +libresourceplugin_la_LDFLAGS += -rpath / endif + +if CROSS_COMPILING + glib_compile_resources=$(GLIB_COMPILE_RESOURCES) +else + glib_compile_resources=$(top_builddir)/gio/glib-compile-resources +endif + +resources.o: test_resources2.h +test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml) + $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $< + +test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml) + $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $< + +plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml) + $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $< + +test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml) + $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $< + +EXTRA_DIST += test.gresource.xml test1.txt test2.gresource.xml test2.txt test3.gresource.xml test3.txt test4.gresource.xml + +CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource diff --git a/gio/tests/gdbus-example-objectmanager-client.c b/gio/tests/gdbus-example-objectmanager-client.c index a99399665..b235ca140 100644 --- a/gio/tests/gdbus-example-objectmanager-client.c +++ b/gio/tests/gdbus-example-objectmanager-client.c @@ -1,5 +1,5 @@ -#include "gdbus-example-objectmanager-generated.h" +#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h" /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gdbus-example-objectmanager-server.c b/gio/tests/gdbus-example-objectmanager-server.c index 1233958b7..2a7bf63b6 100644 --- a/gio/tests/gdbus-example-objectmanager-server.c +++ b/gio/tests/gdbus-example-objectmanager-server.c @@ -1,5 +1,5 @@ -#include "gdbus-example-objectmanager-generated.h" +#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h" /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gdbus-object-manager-example/Makefile.am b/gio/tests/gdbus-object-manager-example/Makefile.am index 6875210a6..d6d141289 100644 --- a/gio/tests/gdbus-object-manager-example/Makefile.am +++ b/gio/tests/gdbus-object-manager-example/Makefile.am @@ -1,24 +1,14 @@ -NULL = -BUILT_SOURCES = -CLEANFILES = +include $(top_srcdir)/glib.mk -include $(top_srcdir)/Makefile.decl - -AM_CPPFLAGS = \ - -g \ - $(gio_INCLUDES) \ - $(GLIB_DEBUG_FLAGS) \ - -I$(top_builddir)/gio \ - -I$(top_srcdir)/gio \ - -DSRCDIR=\""$(srcdir)"\" +AM_CPPFLAGS = -g $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio # ------------------------------------------------------------------------ -GDBUS_GENERATED = \ - gdbus-example-objectmanager-generated.h \ - gdbus-example-objectmanager-generated.c \ +GDBUS_GENERATED = \ + gdbus-example-objectmanager-generated.h \ + gdbus-example-objectmanager-generated.c \ gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Animal.xml \ - gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \ + gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \ $(NULL) $(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen @@ -33,11 +23,19 @@ $(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gi $< \ $(NULL) +test_ltlibraries = libgdbus-example-objectmanager.la + +if ENABLE_GTK_DOC +# The docs pull these in, so we need them even if not doing 'make check' BUILT_SOURCES += $(GDBUS_GENERATED) +noinst_LTLIBRARIES += libgdbus-example-objectmanager.la +endif -noinst_LTLIBRARIES = libgdbus-example-objectmanager.la -libgdbus_example_objectmanager_la_SOURCES = gdbus-example-objectmanager-generated.h gdbus-example-objectmanager-generated.c -libgdbus_example_objectmanager_la_LIBADD = \ +nodist_libgdbus_example_objectmanager_la_SOURCES = \ + gdbus-example-objectmanager-generated.h \ + gdbus-example-objectmanager-generated.c + +libgdbus_example_objectmanager_la_LIBADD = \ $(top_builddir)/glib/libglib-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gmodule/libgmodule-2.0.la \ @@ -47,4 +45,3 @@ libgdbus_example_objectmanager_la_LIBADD = \ EXTRA_DIST += gdbus-example-objectmanager.xml CLEANFILES += $(GDBUS_GENERATED) - diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index 152c5884f..45731f8c2 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -54,7 +54,7 @@ #include "gdbus-tests.h" -#include "gdbus-example-objectmanager-generated.h" +#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h" #ifdef G_OS_UNIX static gboolean is_unix = TRUE; diff --git a/gio/tests/gdbus-test-fixture.c b/gio/tests/gdbus-test-fixture.c index a4403dd72..1e0a3223c 100644 --- a/gio/tests/gdbus-test-fixture.c +++ b/gio/tests/gdbus-test-fixture.c @@ -1,5 +1,5 @@ -#include "gdbus-example-objectmanager-generated.h" +#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h" /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index 922eea262..20967f463 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -660,14 +660,20 @@ test_l10n (void) str = NULL; setlocale (LC_MESSAGES, "de_DE"); - str = g_settings_get_string (settings, "error-message"); - setlocale (LC_MESSAGES, locale); + /* Only do the test if translation is actually working... */ + if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\"")) + { + str = g_settings_get_string (settings, "error-message"); - g_assert_cmpstr (str, ==, "Unbenannt"); - g_object_unref (settings); - g_free (str); - str = NULL; + g_assert_cmpstr (str, ==, "Unbenannt"); + g_object_unref (settings); + g_free (str); + str = NULL; + } + else + g_printerr ("warning: translation is not working... skipping test. "); + setlocale (LC_MESSAGES, locale); g_free (locale); } @@ -701,14 +707,20 @@ test_l10n_context (void) str = NULL; setlocale (LC_MESSAGES, "de_DE"); - g_settings_get (settings, "backspace", "s", &str); - setlocale (LC_MESSAGES, locale); + /* Only do the test if translation is actually working... */ + if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\"")) + { + g_settings_get (settings, "backspace", "s", &str); - g_assert_cmpstr (str, ==, "Löschen"); - g_object_unref (settings); - g_free (str); - str = NULL; + g_assert_cmpstr (str, ==, "Löschen"); + g_object_unref (settings); + g_free (str); + str = NULL; + } + else + g_printerr ("warning: translation is not working... skipping test. "); + setlocale (LC_MESSAGES, locale); g_free (locale); } @@ -1578,24 +1590,6 @@ test_child_schema (void) g_object_unref (settings); } -static gboolean -glib_translations_work (void) -{ - gboolean works; - gchar *locale; - gchar *orig = "Unnamed"; - - locale = g_strdup (setlocale (LC_MESSAGES, NULL)); - if (!setlocale (LC_MESSAGES, "de")) - works = FALSE; - else - works = dgettext ("glib20", orig) != orig; - setlocale (LC_MESSAGES, locale); - g_free (locale); - - return works; -} - #include "../strinfo.c" static void @@ -2316,11 +2310,8 @@ main (int argc, char *argv[]) g_test_add_func ("/gsettings/complex-types", test_complex_types); g_test_add_func ("/gsettings/changes", test_changes); - if (glib_translations_work ()) - { - g_test_add_func ("/gsettings/l10n", test_l10n); - g_test_add_func ("/gsettings/l10n-context", test_l10n_context); - } + g_test_add_func ("/gsettings/l10n", test_l10n); + g_test_add_func ("/gsettings/l10n-context", test_l10n_context); g_test_add_func ("/gsettings/delay-apply", test_delay_apply); g_test_add_func ("/gsettings/delay-revert", test_delay_revert); |