diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-01-04 17:44:23 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-01-04 17:44:23 +0000 |
commit | 5df8c3db12590edd68e968975a335da9d0415e5a (patch) | |
tree | df1452c78f549722ccc8d8c3b1b7ac047a494681 /test | |
parent | 5ec835dac93a084ff5f697a9b83b640689462e00 (diff) | |
download | dbus-5df8c3db12590edd68e968975a335da9d0415e5a.tar.gz |
Revert all changes since a36d4918a6f646e085
Someone seems to have merged part of master into 1.4. Again. Let's go
back to the "last known good" point (the branch-point of some 1.4
branches I had locally), then we can cherry-pick the changes that
should have gone in.
Diffstat (limited to 'test')
30 files changed, 214 insertions, 166 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 2eca473e..b890c638 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,29 +4,9 @@ SUBDIRS= . name-test DIST_SUBDIRS=name-test -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(GLIB_CFLAGS) \ - $(DBUS_GLIB_CFLAGS) \ - $(NULL) - -# improve backtraces from test stuff -AM_LDFLAGS = @R_DYNAMIC_LDFLAG@ +INCLUDES=-I$(top_srcdir) $(DBUS_TEST_CFLAGS) -static_cppflags = \ - $(AM_CPPFLAGS) \ - -DDBUS_STATIC_BUILD \ - $(NULL) - -libdbus_testutils_la_CPPFLAGS = \ - $(static_cppflags) -libdbus_testutils_la_SOURCES = \ - test-utils.c \ - test-utils.h \ - $(NULL) -libdbus_testutils_la_LIBADD = \ - $(top_builddir)/dbus/libdbus-internal.la \ - $(NULL) +libdbus_testutils_la_SOURCES = test-utils.h test-utils.c noinst_LTLIBRARIES = libdbus-testutils.la @@ -72,26 +52,58 @@ endif !DBUS_BUILD_TESTS noinst_PROGRAMS= $(TEST_BINARIES) -test_service_CPPFLAGS = $(static_cppflags) -test_service_LDADD = libdbus-testutils.la -test_names_CPPFLAGS = $(static_cppflags) -test_names_LDADD = libdbus-testutils.la -## break_loader_CPPFLAGS = $(static_cppflags) -## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la -test_shell_service_CPPFLAGS = $(static_cppflags) -test_shell_service_LDADD = libdbus-testutils.la -shell_test_CPPFLAGS = $(static_cppflags) -shell_test_LDADD = libdbus-testutils.la -spawn_test_CPPFLAGS = $(static_cppflags) -spawn_test_LDADD = $(top_builddir)/dbus/libdbus-internal.la +test_service_SOURCES= \ + test-service.c + +test_names_SOURCES= \ + test-names.c + +##break_loader_SOURCES= \ +## break-loader.c + +test_shell_service_SOURCES = \ + test-shell-service.c + +shell_test_SOURCES= \ + shell-test.c + +spawn_test_SOURCES= \ + spawn-test.c + +test_exit_SOURCES = \ + test-exit.c + +test_segfault_SOURCES = \ + test-segfault.c + +test_sleep_forever_SOURCES = \ + test-sleep-forever.c + +# This assumes that most tests will be linked to libdbus-internal; +# tests linked to only the public libdbus have their own CPPFLAGS. +AM_CPPFLAGS=-DDBUS_STATIC_BUILD +TEST_LIBS=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS) + +test_service_LDADD=libdbus-testutils.la $(TEST_LIBS) +test_service_LDFLAGS=@R_DYNAMIC_LDFLAG@ +test_names_LDADD=libdbus-testutils.la $(TEST_LIBS) +test_names_LDFLAGS=@R_DYNAMIC_LDFLAG@ +## break_loader_LDADD= $(TEST_LIBS) +## break_loader_LDFLAGS=@R_DYNAMIC_LDFLAG@ +test_shell_service_LDADD=libdbus-testutils.la $(TEST_LIBS) +test_shell_service_LDFLAGS=@R_DYNAMIC_LDFLAG@ +shell_test_LDADD=libdbus-testutils.la $(TEST_LIBS) +shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ +spawn_test_LDADD=$(TEST_LIBS) +spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ test_refs_SOURCES = internals/refs.c -test_refs_CPPFLAGS = $(static_cppflags) -test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) +test_refs_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) test_syslog_SOURCES = internals/syslog.c -test_syslog_CPPFLAGS = $(static_cppflags) -test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) +test_syslog_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS) +test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS) EXTRA_DIST = dbus-test-runner @@ -102,7 +114,6 @@ testexec_PROGRAMS = installable_tests = \ test-corrupt \ test-dbus-daemon \ - test-dbus-daemon-eavesdrop \ test-loopback \ test-marshal \ test-refs \ @@ -125,33 +136,36 @@ TESTS_ENVIRONMENT = \ $(NULL) test_corrupt_SOURCES = corrupt.c +test_corrupt_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) +test_corrupt_LDFLAGS = @R_DYNAMIC_LDFLAG@ test_corrupt_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(GLIB_LIBS) \ $(DBUS_GLIB_LIBS) test_loopback_SOURCES = loopback.c +test_loopback_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) +test_loopback_LDFLAGS = @R_DYNAMIC_LDFLAG@ test_loopback_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(GLIB_LIBS) \ $(DBUS_GLIB_LIBS) test_relay_SOURCES = relay.c +test_relay_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) +test_relay_LDFLAGS = @R_DYNAMIC_LDFLAG@ test_relay_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(GLIB_LIBS) \ $(DBUS_GLIB_LIBS) test_dbus_daemon_SOURCES = dbus-daemon.c +test_dbus_daemon_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) +test_dbus_daemon_LDFLAGS = @R_DYNAMIC_LDFLAG@ test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(GLIB_LIBS) \ $(DBUS_GLIB_LIBS) -test_dbus_daemon_eavesdrop_SOURCES = dbus-daemon-eavesdrop.c -test_dbus_daemon_eavesdrop_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) -test_dbus_daemon_eavesdrop_LDFLAGS = @R_DYNAMIC_LDFLAG@ -test_dbus_daemon_eavesdrop_LDADD = $(top_builddir)/dbus/libdbus-1.la \ - $(GLIB_LIBS) \ - $(DBUS_GLIB_LIBS) - test_marshal_SOURCES = marshal.c +test_marshal_CPPFLAGS = $(GLIB_CFLAGS) $(DBUS_GLIB_CFLAGS) +test_marshal_LDFLAGS = @R_DYNAMIC_LDFLAG@ test_marshal_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(GLIB_LIBS) \ $(DBUS_GLIB_LIBS) diff --git a/test/break-loader.c b/test/break-loader.c index 542f36ff..7bfa7227 100644 --- a/test/break-loader.c +++ b/test/break-loader.c @@ -446,7 +446,7 @@ randomly_change_one_type (const DBusString *orig_data, { int b; b = _dbus_string_get_byte (mutated, i); - if (dbus_type_is_valid (b)) + if (_dbus_type_is_valid (b)) { _dbus_string_set_byte (mutated, i, random_type ()); return; diff --git a/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in b/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in index 7822ffc4..16ace268 100644 --- a/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in +++ b/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in @@ -1,4 +1,4 @@ [D-BUS Service] -Exec=@DBUS_TEST_EXEC@/test-service@EXEEXT@ +Exec=@TEST_SERVICE_BINARY@ User=anyrandomuser diff --git a/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in b/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in index 691e0096..01b898cf 100644 --- a/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in +++ b/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteNoUser -Exec=@DBUS_TEST_EXEC@/test-service@EXEEXT@ +Exec=@TEST_SERVICE_BINARY@ + diff --git a/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake index 854bfe9c..0c73d8c9 100644 --- a/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake +++ b/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake @@ -6,7 +6,7 @@ <listen>@TEST_LISTEN@</listen> <type>system</type> <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper> - <servicedir>@DBUS_TEST_DATA@/invalid-service-files-system</servicedir> + <servicedir>@TEST_INVALID_SERVICE_SYSTEM_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-config-files-system/debug-allow-all-fail.conf.in b/test/data/valid-config-files-system/debug-allow-all-fail.conf.in index a61244b6..93a548ce 100644 --- a/test/data/valid-config-files-system/debug-allow-all-fail.conf.in +++ b/test/data/valid-config-files-system/debug-allow-all-fail.conf.in @@ -7,7 +7,7 @@ <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen> <type>system</type> <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper> - <servicedir>@DBUS_TEST_DATA@/invalid-service-files-system</servicedir> + <servicedir>@TEST_INVALID_SERVICE_SYSTEM_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake index 1ac5c205..d46ec184 100644 --- a/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake +++ b/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake @@ -6,7 +6,7 @@ <listen>@TEST_LISTEN@</listen> <type>system</type> <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper> - <servicedir>@DBUS_TEST_DATA@/valid-service-files-system</servicedir> + <servicedir>@TEST_VALID_SERVICE_SYSTEM_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-config-files-system/debug-allow-all-pass.conf.in b/test/data/valid-config-files-system/debug-allow-all-pass.conf.in index 6105d841..5b7ffd1a 100644 --- a/test/data/valid-config-files-system/debug-allow-all-pass.conf.in +++ b/test/data/valid-config-files-system/debug-allow-all-pass.conf.in @@ -7,7 +7,7 @@ <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen> <type>system</type> <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper> - <servicedir>@DBUS_TEST_DATA@/valid-service-files-system</servicedir> + <servicedir>@TEST_VALID_SERVICE_SYSTEM_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake b/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake index 0c66f2ae..416267c1 100644 --- a/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake +++ b/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake @@ -4,7 +4,7 @@ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <listen>@TEST_LISTEN@</listen> - <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir> + <servicedir>@TEST_VALID_SERVICE_DIR@</servicedir> <auth>DBUS_COOKIE_SHA1</auth> <policy context="default"> <allow send_interface="*"/> diff --git a/test/data/valid-config-files/debug-allow-all-sha1.conf.in b/test/data/valid-config-files/debug-allow-all-sha1.conf.in index ba68f453..34c50856 100644 --- a/test/data/valid-config-files/debug-allow-all-sha1.conf.in +++ b/test/data/valid-config-files/debug-allow-all-sha1.conf.in @@ -5,7 +5,7 @@ <busconfig> <listen>debug-pipe:name=test-server</listen> <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen> - <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir> + <servicedir>@TEST_VALID_SERVICE_DIR@</servicedir> <auth>DBUS_COOKIE_SHA1</auth> <policy context="default"> <allow send_interface="*"/> diff --git a/test/data/valid-config-files/debug-allow-all.conf.cmake b/test/data/valid-config-files/debug-allow-all.conf.cmake index adc3aa59..94bb21e7 100644 --- a/test/data/valid-config-files/debug-allow-all.conf.cmake +++ b/test/data/valid-config-files/debug-allow-all.conf.cmake @@ -4,7 +4,7 @@ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <listen>@TEST_LISTEN@</listen> - <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir> + <servicedir>@TEST_VALID_SERVICE_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-config-files/debug-allow-all.conf.in b/test/data/valid-config-files/debug-allow-all.conf.in index a086976b..3514296f 100644 --- a/test/data/valid-config-files/debug-allow-all.conf.in +++ b/test/data/valid-config-files/debug-allow-all.conf.in @@ -5,7 +5,7 @@ <busconfig> <listen>debug-pipe:name=test-server</listen> <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen> - <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir> + <servicedir>@TEST_VALID_SERVICE_DIR@</servicedir> <policy context="default"> <allow send_interface="*"/> <allow receive_interface="*"/> diff --git a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in index 3076f3bf..bd0e58e5 100644 --- a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in +++ b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in @@ -1,5 +1,5 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteEchoService -Exec=@DBUS_TEST_EXEC@/test-service@EXEEXT@ +Exec=@TEST_SERVICE_BINARY@ User=anyrandomuser diff --git a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in index 705d7148..18d16d1b 100644 --- a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in +++ b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in @@ -1,5 +1,5 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteSegfaultService -Exec=@DBUS_TEST_EXEC@/test-segfault@EXEEXT@ +Exec=@TEST_SEGFAULT_BINARY@ User=anyrandomuser diff --git a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in index 870835ea..9195e174 100644 --- a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in +++ b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in @@ -1,5 +1,5 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteShellEchoServiceFail -Exec=@DBUS_TEST_EXEC@/test-shell-service@EXEEXT@ "this should 'fail' because of an unterminated quote +Exec=@TEST_SHELL_SERVICE_BINARY@ "this should 'fail' because of an unterminated quote User=anyrandomuser diff --git a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in index 66472614..2236ce55 100644 --- a/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in +++ b/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in @@ -1,5 +1,5 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess -Exec=@DBUS_TEST_EXEC@/test-shell-service@EXEEXT@ -test "that" 'we get' back --what "we put in" +Exec=@TEST_SHELL_SERVICE_BINARY@ -test "that" 'we get' back --what "we put in" User=anyrandomuser diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in index 0fdfeade..2cbdaa8b 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuite.PrivServer -Exec=@DBUS_TEST_EXEC@/name-test/test-privserver@EXEEXT@ +Exec=@TEST_PRIVSERVER_BINARY@ diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in index a22a77d1..4202351d 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteEchoService -Exec=@DBUS_TEST_EXEC@/test-service@EXEEXT@ +Exec=@TEST_SERVICE_BINARY@ + diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in index 633862c7..49fcac39 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteForkingEchoService -Exec=@DBUS_TEST_EXEC@/test-service@EXEEXT@ org.freedesktop.DBus.TestSuiteForkingEchoService fork +Exec=@TEST_SERVICE_BINARY@ org.freedesktop.DBus.TestSuiteForkingEchoService fork diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in index 76254275..73c7b55b 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteSegfaultService -Exec=@DBUS_TEST_EXEC@/test-segfault@EXEEXT@ +Exec=@TEST_SEGFAULT_BINARY@ diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in index 8f5964a2..4404c78e 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteShellEchoServiceFail -Exec=@DBUS_TEST_EXEC@/test-shell-service@EXEEXT@ "this should 'fail' because of an unterminated quote +Exec=@TEST_SHELL_SERVICE_BINARY@ "this should 'fail' because of an unterminated quote + diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in index a52887e5..e5688462 100644 --- a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in +++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess -Exec=@DBUS_TEST_EXEC@/test-shell-service@EXEEXT@ -test "that" 'we get' back --what "we put in" +Exec=@TEST_SHELL_SERVICE_BINARY@ -test "that" 'we get' back --what "we put in" diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index cc871530..e192c68f 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -42,8 +42,6 @@ #endif typedef struct { - gboolean skip; - DBusError e; GError *ge; @@ -151,6 +149,8 @@ echo_filter (DBusConnection *connection, void *user_data) { DBusMessage *reply; + DBusError error = DBUS_ERROR_INIT; + int *sleep_ms = user_data; if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -168,63 +168,42 @@ echo_filter (DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } -typedef struct { - const char *bug_ref; - guint min_messages; - const char *config_file; -} Config; - static void setup (Fixture *f, - gconstpointer context) + gconstpointer context G_GNUC_UNUSED) { - const Config *config = context; gchar *dbus_daemon; - gchar *arg; + gchar *config; gchar *address; f->ge = NULL; dbus_error_init (&f->e); - if (config != NULL && config->config_file != NULL) - { - if (g_getenv ("DBUS_TEST_DATA") == NULL) - { - g_message ("SKIP: set DBUS_TEST_DATA to a directory containing %s", - config->config_file); - f->skip = TRUE; - return; - } + dbus_daemon = g_strdup (g_getenv ("DBUS_TEST_DAEMON")); - arg = g_strdup_printf ( - "--config-file=%s/%s", - g_getenv ("DBUS_TEST_DATA"), config->config_file); - } - else if (g_getenv ("DBUS_TEST_SYSCONFDIR") != NULL) + if (dbus_daemon == NULL) + dbus_daemon = g_strdup ("dbus-daemon"); + + if (g_getenv ("DBUS_TEST_SYSCONFDIR") != NULL) { - arg = g_strdup_printf ("--config-file=%s/dbus-1/session.conf", + config = g_strdup_printf ("--config-file=%s/dbus-1/session.conf", g_getenv ("DBUS_TEST_SYSCONFDIR")); } else if (g_getenv ("DBUS_TEST_DATA") != NULL) { - arg = g_strdup_printf ( + config = g_strdup_printf ( "--config-file=%s/valid-config-files/session.conf", g_getenv ("DBUS_TEST_DATA")); } else { - arg = g_strdup ("--session"); + config = g_strdup ("--session"); } - dbus_daemon = g_strdup (g_getenv ("DBUS_TEST_DAEMON")); - - if (dbus_daemon == NULL) - dbus_daemon = g_strdup ("dbus-daemon"); - - address = spawn_dbus_daemon (dbus_daemon, arg, &f->daemon_pid); + address = spawn_dbus_daemon (dbus_daemon, config, &f->daemon_pid); g_free (dbus_daemon); - g_free (arg); + g_free (config); f->left_conn = connect_to_bus (address); f->right_conn = connect_to_bus (address); @@ -251,26 +230,16 @@ pc_count (DBusPendingCall *pc, static void test_echo (Fixture *f, - gconstpointer context) + gconstpointer context G_GNUC_UNUSED) { - const Config *config = context; guint count = 2000; guint sent; guint received = 0; double elapsed; - if (f->skip) - return; - - if (config != NULL && config->bug_ref != NULL) - g_test_bug (config->bug_ref); - if (g_test_perf ()) count = 100000; - if (config != NULL) - count = MAX (config->min_messages, count); - add_echo_filter (f); g_test_timer_start (); @@ -336,23 +305,15 @@ teardown (Fixture *f, f->right_conn = NULL; } - if (f->daemon_pid != 0) - { #ifdef DBUS_WIN - TerminateProcess (f->daemon_pid, 1); + TerminateProcess (f->daemon_pid, 1); #else - kill (f->daemon_pid, SIGTERM); + kill (f->daemon_pid, SIGTERM); #endif - g_spawn_close_pid (f->daemon_pid); - f->daemon_pid = 0; - } + g_spawn_close_pid (f->daemon_pid); } -static Config limited_config = { - "34393", 10000, "valid-config-files/incoming-limit.conf" -}; - int main (int argc, char **argv) @@ -361,8 +322,6 @@ main (int argc, g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id="); g_test_add ("/echo/session", Fixture, NULL, setup, test_echo, teardown); - g_test_add ("/echo/limited", Fixture, &limited_config, - setup, test_echo, teardown); return g_test_run (); } diff --git a/test/internals/refs.c b/test/internals/refs.c index bc0884e3..3d21c894 100644 --- a/test/internals/refs.c +++ b/test/internals/refs.c @@ -181,6 +181,7 @@ new_conn_cb (DBusServer *server, void *data) { Fixture *f = data; + dbus_bool_t have_mem; g_assert (f->server_connection == NULL); f->server_connection = dbus_connection_ref (server_connection); diff --git a/test/marshal.c b/test/marshal.c index e9ac7e30..4cee9412 100644 --- a/test/marshal.c +++ b/test/marshal.c @@ -146,6 +146,7 @@ test_endian (Fixture *f, gconstpointer arg) { const gchar *blob = arg; + const gchar *native_blob; char *output; DBusMessage *m; int len; diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 6aaf1783..45c21d46 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -1,12 +1,4 @@ -# Everything in this directory is statically-linked to libdbus-internal -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -DDBUS_COMPILATION \ - -DDBUS_STATIC_BUILD \ - $(NULL) - -# if assertions are enabled, improve backtraces -AM_LDFLAGS = @R_DYNAMIC_LDFLAG@ +INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_CFLAGS) -DDBUS_COMPILATION ## note that TESTS has special meaning (stuff to use in make check) ## so if adding tests not to be run in make check, don't add them to @@ -26,14 +18,57 @@ if DBUS_BUILD_TESTS ## build even when not doing "make check" noinst_PROGRAMS=test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client test-autolaunch -test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-internal.la -test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-internal.la -test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-internal.la -test_ids_LDADD=$(top_builddir)/dbus/libdbus-internal.la +AM_CPPFLAGS = -DDBUS_STATIC_BUILD +test_pending_call_dispatch_SOURCES = \ + test-pending-call-dispatch.c + +test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS) +test_pending_call_dispatch_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_pending_call_timeout_SOURCES = \ + test-pending-call-timeout.c + +test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS) +test_pending_call_timeout_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_threads_init_SOURCES = \ + test-threads-init.c + +test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS) +test_threads_init_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_ids_SOURCES = \ + test-ids.c + +test_ids_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS) +test_ids_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_shutdown_SOURCES = \ + test-shutdown.c + +test_shutdown_CFLAGS= +test_shutdown_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) +test_shutdown_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_privserver_SOURCES = \ + test-privserver.c + +test_privserver_CFLAGS= +test_privserver_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) +test_privserver_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_privserver_client_SOURCES = \ + test-privserver-client.c + +test_privserver_client_CFLAGS= +test_privserver_client_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) +test_privserver_client_LDFLAGS=@R_DYNAMIC_LDFLAG@ + +test_autolaunch_SOURCES = \ + test-autolaunch.c -test_shutdown_LDADD=../libdbus-testutils.la -test_privserver_LDADD=../libdbus-testutils.la -test_privserver_client_LDADD=../libdbus-testutils.la -test_autolaunch_LDADD=../libdbus-testutils.la +test_autolaunch_CFLAGS= +test_autolaunch_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) +test_autolaunch_LDFLAGS=@R_DYNAMIC_LDFLAG@ endif diff --git a/test/name-test/test-privserver-client.c b/test/name-test/test-privserver-client.c index e7f48960..1c43faee 100644 --- a/test/name-test/test-privserver-client.c +++ b/test/name-test/test-privserver-client.c @@ -71,6 +71,7 @@ open_shutdown_private_connection (dbus_bool_t use_guid) DBusMessage *reply; DBusConnection *privconn; char *addr; + char *comma; dbus_bool_t service_died; dbus_bool_t private_conn_lost; diff --git a/test/test-service.c b/test/test-service.c index 7181fa38..6627ea75 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -477,14 +477,7 @@ main (int argc, dbus_error_free (&error); exit (1); } - - if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) - { - fprintf (stderr, "Unable to acquire service: code %d\n", result); - _dbus_verbose ("*** Failed to acquire service: %d\n", result); - exit (1); - } - + _dbus_verbose ("*** Test service entering main loop\n"); _dbus_loop_run (loop); diff --git a/test/test-shell-service.c b/test/test-shell-service.c index 32a88329..57c16123 100644 --- a/test/test-shell-service.c +++ b/test/test-shell-service.c @@ -176,13 +176,6 @@ main (int argc, exit (1); } - if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) - { - fprintf (stderr, "Unable to acquire service: code %d\n", result); - _dbus_verbose ("*** Failed to acquire service: %d\n", result); - exit (1); - } - _dbus_verbose ("*** Test service entering main loop\n"); _dbus_loop_run (loop); diff --git a/test/test-utils.c b/test/test-utils.c index 4fd84fe8..05cd7535 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -9,12 +9,23 @@ typedef struct } CData; static dbus_bool_t +connection_watch_callback (DBusWatch *watch, + unsigned int condition, + void *data) +{ + return dbus_watch_handle (watch, condition); +} + +static dbus_bool_t add_watch (DBusWatch *watch, void *data) { CData *cd = data; - return _dbus_loop_add_watch (cd->loop, watch); + return _dbus_loop_add_watch (cd->loop, + watch, + connection_watch_callback, + cd, NULL); } static void @@ -23,7 +34,16 @@ remove_watch (DBusWatch *watch, { CData *cd = data; - _dbus_loop_remove_watch (cd->loop, watch); + _dbus_loop_remove_watch (cd->loop, + watch, connection_watch_callback, cd); +} + +static void +connection_timeout_callback (DBusTimeout *timeout, + void *data) +{ + /* Can return FALSE on OOM but we just let it fire again later */ + dbus_timeout_handle (timeout); } static dbus_bool_t @@ -32,7 +52,8 @@ add_timeout (DBusTimeout *timeout, { CData *cd = data; - return _dbus_loop_add_timeout (cd->loop, timeout); + return _dbus_loop_add_timeout (cd->loop, + timeout, connection_timeout_callback, cd, NULL); } static void @@ -41,7 +62,8 @@ remove_timeout (DBusTimeout *timeout, { CData *cd = data; - _dbus_loop_remove_timeout (cd->loop, timeout); + _dbus_loop_remove_timeout (cd->loop, + timeout, connection_timeout_callback, cd); } static void @@ -204,12 +226,27 @@ serverdata_new (DBusLoop *loop, } static dbus_bool_t +server_watch_callback (DBusWatch *watch, + unsigned int condition, + void *data) +{ + /* FIXME this can be done in dbus-mainloop.c + * if the code in activation.c for the babysitter + * watch handler is fixed. + */ + + return dbus_watch_handle (watch, condition); +} + +static dbus_bool_t add_server_watch (DBusWatch *watch, void *data) { ServerData *context = data; - return _dbus_loop_add_watch (context->loop, watch); + return _dbus_loop_add_watch (context->loop, + watch, server_watch_callback, context, + NULL); } static void @@ -218,7 +255,16 @@ remove_server_watch (DBusWatch *watch, { ServerData *context = data; - _dbus_loop_remove_watch (context->loop, watch); + _dbus_loop_remove_watch (context->loop, + watch, server_watch_callback, context); +} + +static void +server_timeout_callback (DBusTimeout *timeout, + void *data) +{ + /* can return FALSE on OOM but we just let it fire again later */ + dbus_timeout_handle (timeout); } static dbus_bool_t @@ -227,7 +273,8 @@ add_server_timeout (DBusTimeout *timeout, { ServerData *context = data; - return _dbus_loop_add_timeout (context->loop, timeout); + return _dbus_loop_add_timeout (context->loop, + timeout, server_timeout_callback, context, NULL); } static void @@ -236,7 +283,8 @@ remove_server_timeout (DBusTimeout *timeout, { ServerData *context = data; - _dbus_loop_remove_timeout (context->loop, timeout); + _dbus_loop_remove_timeout (context->loop, + timeout, server_timeout_callback, context); } dbus_bool_t |