Commit 3d2300ef authored by Simon McVittie's avatar Simon McVittie

Prefer to use _dbus_test_fatal() for assertion failures in tests

This is a little more self-documenting - it justifies why it's
acceptable to fail hard on out-of-memory conditions. _dbus_test_fatal()
isn't compiled unless we are compiling embedded tests, so compiling
with embedded tests disabled provides reasonable confidence that we
aren't using _dbus_test_fatal() inappropriately.
Reviewed-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
parent 2edee28f
......@@ -39,6 +39,7 @@
#include <dbus/dbus-spawn.h>
#include <dbus/dbus-timeout.h>
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-test-tap.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
......@@ -2577,7 +2578,7 @@ do_test (const char *description, dbus_bool_t oom_test, CheckData *data)
err = !check_func (data);
if (err)
_dbus_assert_not_reached ("Test failed");
_dbus_test_fatal ("Test failed");
return TRUE;
}
......@@ -2698,7 +2699,7 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
/* Do normal tests */
if (!init_service_reload_test (&directory))
_dbus_assert_not_reached ("could not initiate service reload test");
_dbus_test_fatal ("could not initiate service reload test");
if (!do_service_reload_test (test_data_dir, &directory, FALSE))
{
......@@ -2710,7 +2711,7 @@ bus_activation_service_reload_test (const DBusString *test_data_dir)
/* Do OOM tests */
if (!init_service_reload_test (&directory))
_dbus_assert_not_reached ("could not initiate service reload test");
_dbus_test_fatal ("could not initiate service reload test");
if (!do_service_reload_test (test_data_dir, &directory, TRUE))
{
......
......@@ -544,20 +544,20 @@ process_test_valid_subdir (const DBusString *test_base_dir,
dir = NULL;
if (!_dbus_string_init (&test_directory))
_dbus_assert_not_reached ("didn't allocate test_directory");
_dbus_test_fatal ("didn't allocate test_directory");
_dbus_string_init_const (&filename, subdir);
if (!_dbus_string_copy (test_base_dir, 0,
&test_directory, 0))
_dbus_assert_not_reached ("couldn't copy test_base_dir to test_directory");
_dbus_test_fatal ("couldn't copy test_base_dir to test_directory");
if (!_dbus_concat_dir_and_file (&test_directory, &filename))
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_test_fatal ("couldn't allocate full path");
_dbus_string_free (&filename);
if (!_dbus_string_init (&filename))
_dbus_assert_not_reached ("didn't allocate filename string");
_dbus_test_fatal ("didn't allocate filename string");
dbus_error_init (&error);
dir = _dbus_directory_open (&test_directory, &error);
......@@ -584,13 +584,13 @@ process_test_valid_subdir (const DBusString *test_base_dir,
LoaderOomData d;
if (!_dbus_string_init (&full_path))
_dbus_assert_not_reached ("couldn't init string");
_dbus_test_fatal ("couldn't init string");
if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
_dbus_assert_not_reached ("couldn't copy dir to full_path");
_dbus_test_fatal ("couldn't copy dir to full_path");
if (!_dbus_concat_dir_and_file (&full_path, &filename))
_dbus_assert_not_reached ("couldn't concat file to dir");
_dbus_test_fatal ("couldn't concat file to dir");
if (!_dbus_string_ends_with_c_str (&full_path, ".conf"))
{
......@@ -616,8 +616,8 @@ process_test_valid_subdir (const DBusString *test_base_dir,
*/
/* if (!_dbus_test_oom_handling ("config-loader", check_loader_oom_func, &d)) */
if (!check_loader_oom_func (&d))
_dbus_assert_not_reached ("test failed");
_dbus_test_fatal ("test failed");
_dbus_string_free (&full_path);
}
......
......@@ -3077,9 +3077,9 @@ do_check_own_rules (BusPolicy *policy)
dbus_bool_t ret;
if (!_dbus_string_init (&service_name))
_dbus_assert_not_reached ("couldn't init string");
_dbus_test_fatal ("couldn't init string");
if (!_dbus_string_append (&service_name, checks[i].name))
_dbus_assert_not_reached ("couldn't append string");
_dbus_test_fatal ("couldn't append string");
ret = bus_policy_check_can_own (policy, &service_name);
_dbus_test_diag (" Check name %s: %s", checks[i].name,
......@@ -3190,20 +3190,20 @@ process_test_valid_subdir (const DBusString *test_base_dir,
dir = NULL;
if (!_dbus_string_init (&test_directory))
_dbus_assert_not_reached ("didn't allocate test_directory");
_dbus_test_fatal ("didn't allocate test_directory");
_dbus_string_init_const (&filename, subdir);
if (!_dbus_string_copy (test_base_dir, 0,
&test_directory, 0))
_dbus_assert_not_reached ("couldn't copy test_base_dir to test_directory");
_dbus_test_fatal ("couldn't copy test_base_dir to test_directory");
if (!_dbus_concat_dir_and_file (&test_directory, &filename))
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_test_fatal ("couldn't allocate full path");
_dbus_string_free (&filename);
if (!_dbus_string_init (&filename))
_dbus_assert_not_reached ("didn't allocate filename string");
_dbus_test_fatal ("didn't allocate filename string");
dbus_error_init (&error);
dir = _dbus_directory_open (&test_directory, &error);
......@@ -3230,13 +3230,13 @@ process_test_valid_subdir (const DBusString *test_base_dir,
LoaderOomData d;
if (!_dbus_string_init (&full_path))
_dbus_assert_not_reached ("couldn't init string");
_dbus_test_fatal ("couldn't init string");
if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
_dbus_assert_not_reached ("couldn't copy dir to full_path");
_dbus_test_fatal ("couldn't copy dir to full_path");
if (!_dbus_concat_dir_and_file (&full_path, &filename))
_dbus_assert_not_reached ("couldn't concat file to dir");
_dbus_test_fatal ("couldn't concat file to dir");
if (!_dbus_string_ends_with_c_str (&full_path, ".conf"))
{
......@@ -3264,8 +3264,8 @@ process_test_valid_subdir (const DBusString *test_base_dir,
*/
/* if (!_dbus_test_oom_handling ("config-loader", check_loader_oom_func, &d)) */
if (!check_loader_oom_func (&d))
_dbus_assert_not_reached ("test failed");
_dbus_test_fatal ("test failed");
_dbus_string_free (&full_path);
}
......@@ -3525,7 +3525,7 @@ all_are_equiv (const DBusString *target_directory)
retval = FALSE;
if (!_dbus_string_init (&filename))
_dbus_assert_not_reached ("didn't allocate filename string");
_dbus_test_fatal ("didn't allocate filename string");
dbus_error_init (&error);
dir = _dbus_directory_open (target_directory, &error);
......@@ -3546,13 +3546,13 @@ all_are_equiv (const DBusString *target_directory)
DBusString full_path;
if (!_dbus_string_init (&full_path))
_dbus_assert_not_reached ("couldn't init string");
_dbus_test_fatal ("couldn't init string");
if (!_dbus_string_copy (target_directory, 0, &full_path, 0))
_dbus_assert_not_reached ("couldn't copy dir to full_path");
_dbus_test_fatal ("couldn't copy dir to full_path");
if (!_dbus_concat_dir_and_file (&full_path, &filename))
_dbus_assert_not_reached ("couldn't concat file to dir");
_dbus_test_fatal ("couldn't concat file to dir");
if (!_dbus_string_ends_with_c_str (&full_path, ".conf"))
{
......@@ -3618,20 +3618,20 @@ process_test_equiv_subdir (const DBusString *test_base_dir,
retval = FALSE;
if (!_dbus_string_init (&test_directory))
_dbus_assert_not_reached ("didn't allocate test_directory");
_dbus_test_fatal ("didn't allocate test_directory");
_dbus_string_init_const (&filename, subdir);
if (!_dbus_string_copy (test_base_dir, 0,
&test_directory, 0))
_dbus_assert_not_reached ("couldn't copy test_base_dir to test_directory");
_dbus_test_fatal ("couldn't copy test_base_dir to test_directory");
if (!_dbus_concat_dir_and_file (&test_directory, &filename))
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_test_fatal ("couldn't allocate full path");
_dbus_string_free (&filename);
if (!_dbus_string_init (&filename))
_dbus_assert_not_reached ("didn't allocate filename string");
_dbus_test_fatal ("didn't allocate filename string");
dbus_error_init (&error);
dir = _dbus_directory_open (&test_directory, &error);
......@@ -3653,14 +3653,14 @@ process_test_equiv_subdir (const DBusString *test_base_dir,
continue;
if (!_dbus_string_init (&full_path))
_dbus_assert_not_reached ("couldn't init string");
_dbus_test_fatal ("couldn't init string");
if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
_dbus_assert_not_reached ("couldn't copy dir to full_path");
_dbus_test_fatal ("couldn't copy dir to full_path");
if (!_dbus_concat_dir_and_file (&full_path, &filename))
_dbus_assert_not_reached ("couldn't concat file to dir");
_dbus_test_fatal ("couldn't concat file to dir");
equal = all_are_equiv (&full_path);
_dbus_string_free (&full_path);
......@@ -3732,21 +3732,21 @@ test_default_session_servicedirs (const DBusString *test_base_dir)
!_dbus_string_init (&data_home_based) ||
!_dbus_string_init (&data_dirs_based) ||
!_dbus_string_init (&data_dirs_based2))
_dbus_assert_not_reached ("OOM allocating strings");
_dbus_test_fatal ("OOM allocating strings");
if (!_dbus_string_copy (test_base_dir, 0,
&full_path, 0))
_dbus_assert_not_reached ("couldn't copy test_base_dir to full_path");
_dbus_test_fatal ("couldn't copy test_base_dir to full_path");
_dbus_string_init_const (&tmp, "valid-config-files");
if (!_dbus_concat_dir_and_file (&full_path, &tmp))
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_test_fatal ("couldn't allocate full path");
_dbus_string_init_const (&tmp, "standard-session-dirs.conf");
if (!_dbus_concat_dir_and_file (&full_path, &tmp))
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_test_fatal ("couldn't allocate full path");
#ifdef DBUS_WIN
if (!_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
......@@ -3793,21 +3793,21 @@ test_default_session_servicedirs (const DBusString *test_base_dir)
!_dbus_string_append (&runtime_dir_based, xdg_runtime_dir) ||
!_dbus_string_append (&data_home_based, xdg_data_home) ||
!_dbus_string_append (&data_home_based, "/dbus-1/services"))
_dbus_assert_not_reached ("out of memory");
_dbus_test_fatal ("out of memory");
if (!_dbus_ensure_directory (&runtime_dir_based, NULL))
_dbus_assert_not_reached ("Unable to create fake XDG_RUNTIME_DIR");
_dbus_test_fatal ("Unable to create fake XDG_RUNTIME_DIR");
if (!_dbus_string_append (&runtime_dir_based, "/dbus-1/services"))
_dbus_assert_not_reached ("out of memory");
_dbus_test_fatal ("out of memory");
/* Sanity check: the Makefile sets this up. We assume that if this is
* right, the XDG_DATA_DIRS will be too. */
if (!_dbus_string_starts_with_c_str (&data_home_based, dbus_test_builddir))
_dbus_assert_not_reached ("$XDG_DATA_HOME should start with $DBUS_TEST_BUILDDIR");
_dbus_test_fatal ("$XDG_DATA_HOME should start with $DBUS_TEST_BUILDDIR");
if (!_dbus_string_starts_with_c_str (&runtime_dir_based, dbus_test_builddir))
_dbus_assert_not_reached ("$XDG_RUNTIME_DIR should start with $DBUS_TEST_BUILDDIR");
_dbus_test_fatal ("$XDG_RUNTIME_DIR should start with $DBUS_TEST_BUILDDIR");
test_session_service_dir_matches[0] = _dbus_string_get_const_data (
&runtime_dir_based);
......@@ -3822,7 +3822,7 @@ test_default_session_servicedirs (const DBusString *test_base_dir)
parser = bus_config_load (&full_path, TRUE, NULL, &error);
if (parser == NULL)
_dbus_assert_not_reached (error.message);
_dbus_test_fatal ("%s", error.message);
dirs = bus_config_parser_get_service_dirs (parser);
......@@ -3872,7 +3872,7 @@ test_default_session_servicedirs (const DBusString *test_base_dir)
}
if (!bus_config_parser_get_watched_dirs (parser, &watched_dirs))
_dbus_assert_not_reached ("out of memory");
_dbus_test_fatal ("out of memory");
#ifdef DBUS_WIN
/* We expect all directories to be watched (not that it matters on Windows,
......@@ -3952,7 +3952,7 @@ test_default_system_servicedirs (void)
dirs = NULL;
if (!_dbus_get_standard_system_servicedirs (&dirs))
_dbus_assert_not_reached ("couldn't get stardard dirs");
_dbus_test_fatal ("couldn't get stardard dirs");
/* make sure we read and parse the env variable correctly */
i = 0;
......
......@@ -824,7 +824,7 @@ kill_client_connection (BusContext *context,
/* Run disconnect handler in test.c */
if (bus_connection_dispatch_one_message (connection))
_dbus_assert_not_reached ("something received on connection being killed other than the disconnect");
_dbus_test_fatal ("something received on connection being killed other than the disconnect");
_dbus_assert (!dbus_connection_get_is_connected (connection));
dbus_connection_unref (connection);
......@@ -843,10 +843,10 @@ kill_client_connection (BusContext *context,
dbus_free (base_service);
if (socd.failed)
_dbus_assert_not_reached ("didn't get the expected NameOwnerChanged (deletion) messages");
_dbus_test_fatal ("didn't get the expected NameOwnerChanged (deletion) messages");
if (!check_no_leftovers (context))
_dbus_assert_not_reached ("stuff left in message queues after disconnecting a client");
_dbus_test_fatal ("stuff left in message queues after disconnecting a client");
}
static void
......@@ -861,7 +861,7 @@ kill_client_connection_unchecked (DBusConnection *connection)
dbus_connection_close (connection);
/* dispatching disconnect handler will unref once */
if (bus_connection_dispatch_one_message (connection))
_dbus_assert_not_reached ("message other than disconnect dispatched after failure to register");
_dbus_test_fatal ("message other than disconnect dispatched after failure to register");
_dbus_assert (!bus_test_client_listed (connection));
dbus_connection_unref (connection);
......@@ -4399,7 +4399,7 @@ check1_try_iterations (BusContext *context,
if (!_dbus_test_oom_handling (description, check_oom_check1_func,
&d))
_dbus_assert_not_reached ("test failed");
_dbus_test_fatal ("test failed");
}
static dbus_bool_t
......@@ -4834,7 +4834,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
/* save the config name for the activation helper */
if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename))
_dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
_dbus_test_fatal ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
dbus_error_init (&error);
......@@ -4844,72 +4844,72 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (foo))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, foo);
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_double_hello_message (context, foo))
_dbus_assert_not_reached ("double hello message failed");
_dbus_test_fatal ("double hello message failed");
if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (bar == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (bar))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, bar);
if (!check_hello_message (context, bar))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_add_match (context, bar, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
baz = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (baz == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (baz))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, baz);
if (!check_hello_message (context, baz))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_add_match (context, baz, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
if (!check_add_match (context, baz, "interface='com.example'"))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
#ifdef DBUS_ENABLE_STATS
if (!check_get_all_match_rules (context, baz))
_dbus_assert_not_reached ("GetAllMatchRules message failed");
_dbus_test_fatal ("GetAllMatchRules message failed");
#endif
if (!check_get_connection_unix_user (context, baz))
_dbus_assert_not_reached ("GetConnectionUnixUser message failed");
_dbus_test_fatal ("GetConnectionUnixUser message failed");
#ifdef DBUS_WIN_FIXME
_dbus_verbose("TODO: testing of GetConnectionUnixProcessID message skipped for now\n");
#else
if (!check_get_connection_unix_process_id (context, baz))
_dbus_assert_not_reached ("GetConnectionUnixProcessID message failed");
_dbus_test_fatal ("GetConnectionUnixProcessID message failed");
#endif
if (!check_list_services (context, baz))
_dbus_assert_not_reached ("ListActivatableNames message failed");
_dbus_test_fatal ("ListActivatableNames message failed");
if (!check_no_leftovers (context))
_dbus_test_fatal ("Messages were left over after setting up initial connections");
......@@ -4940,7 +4940,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
/* specific to launcher */
if (use_launcher)
if (!check_launch_service_file_missing (context, foo))
_dbus_assert_not_reached ("did not get service file not found error");
_dbus_test_fatal ("did not get service file not found error");
#if 0
/* Note: need to resolve some issues with the testing code in order to run
......@@ -4952,10 +4952,10 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
#endif
if (!check_existent_service_auto_start (context, foo))
_dbus_assert_not_reached ("existent service auto start failed");
_dbus_test_fatal ("existent service auto start failed");
if (!check_shell_service_success_auto_start (context, foo))
_dbus_assert_not_reached ("shell success service auto start failed");
_dbus_test_fatal ("shell success service auto start failed");
_dbus_verbose ("Disconnecting foo, bar, and baz\n");
......@@ -4979,7 +4979,7 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir,
/* save the config name for the activation helper */
if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename))
_dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
_dbus_test_fatal ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
dbus_error_init (&error);
......@@ -4989,33 +4989,33 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir,
foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (foo))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, foo);
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_double_hello_message (context, foo))
_dbus_assert_not_reached ("double hello message failed");
_dbus_test_fatal ("double hello message failed");
if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
/* this only tests the activation.c user check */
if (!check_launch_service_user_missing (context, foo))
_dbus_assert_not_reached ("user missing did not trigger error");
_dbus_test_fatal ("user missing did not trigger error");
/* this only tests the desktop.c exec check */
if (!check_launch_service_exec_missing (context, foo))
_dbus_assert_not_reached ("exec missing did not trigger error");
_dbus_test_fatal ("exec missing did not trigger error");
/* this only tests the desktop.c service check */
if (!check_launch_service_service_missing (context, foo))
_dbus_assert_not_reached ("service missing did not trigger error");
_dbus_test_fatal ("service missing did not trigger error");
_dbus_verbose ("Disconnecting foo\n");
......@@ -5071,18 +5071,18 @@ bus_dispatch_sha1_test (const DBusString *test_data_dir)
foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (foo))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, foo);
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("addmatch message failed");
_dbus_test_fatal ("addmatch message failed");
if (!check_no_leftovers (context))
_dbus_test_fatal ("Messages were left over after setting up initial SHA-1 connection");
......@@ -5114,67 +5114,67 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir)
context = bus_context_new_test (test_data_dir, "valid-config-files/debug-allow-all.conf");
if (context == NULL)
_dbus_assert_not_reached ("could not alloc context");
_dbus_test_fatal ("could not alloc context");
foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (foo == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (foo))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, foo);
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
if (bar == NULL)
_dbus_assert_not_reached ("could not alloc connection");
_dbus_test_fatal ("could not alloc connection");
if (!bus_setup_debug_client (bar))
_dbus_assert_not_reached ("could not set up connection");
_dbus_test_fatal ("could not set up connection");
spin_connection_until_authenticated (context, bar);
if (!check_hello_message (context, bar))
_dbus_assert_not_reached ("hello message failed");
_dbus_test_fatal ("hello message failed");
if (!check_add_match (context, bar, ""))
_dbus_assert_not_reached ("AddMatch message failed");
_dbus_test_fatal ("AddMatch message failed");
if (!(m = dbus_message_new_signal("/", "a.b.c", "d")))
_dbus_assert_not_reached ("could not alloc message");
_dbus_test_fatal ("could not alloc message");
if (!(_dbus_socketpair (one, one+1, TRUE, &error)))
_dbus_assert_not_reached("Failed to allocate pipe #1");
_dbus_test_fatal ("Failed to allocate pipe #1");
if (!(_dbus_socketpair (two, two+1, TRUE, &error)))
_dbus_assert_not_reached("Failed to allocate pipe #2");
_dbus_test_fatal ("Failed to allocate pipe #2");
if (!dbus_message_append_args(m,
DBUS_TYPE_UNIX_FD, one,
DBUS_TYPE_UNIX_FD, two,
DBUS_TYPE_UNIX_FD, two,
DBUS_TYPE_INVALID))
_dbus_assert_not_reached("Failed to attach fds.");
_dbus_test_fatal ("Failed to attach fds.");
if (!_dbus_close_socket (one[0], &error))
_dbus_assert_not_reached("Failed to close pipe #1 ");
_dbus_test_fatal ("Failed to close pipe #1 ");
if (!_dbus_close_socket (two[0], &error))
_dbus_assert_not_reached("Failed to close pipe #2 ");
_dbus_test_fatal ("Failed to close pipe #2 ");
if (!(dbus_connection_can_send_type(foo, DBUS_TYPE_UNIX_FD)))
_dbus_assert_not_reached("Connection cannot do fd passing");
_dbus_test_fatal ("Connection cannot do fd passing");
if (!(dbus_connection_can_send_type(bar, DBUS_TYPE_UNIX_FD)))
_dbus_assert_not_reached("Connection cannot do fd passing");
_dbus_test_fatal ("Connection cannot do fd passing");
if (!dbus_connection_send (foo, m, NULL))
_dbus_assert_not_reached("Failed to send fds");
_dbus_test_fatal ("Failed to send fds");
dbus_message_unref(m);
......@@ -5185,20 +5185,20 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir)
block_connection_until_message_from_bus (context, foo, "unix fd reception on foo");
if (!(m = pop_message_waiting_for_memory (foo)))
_dbus_assert_not_reached("Failed to receive msg");
_dbus_test_fatal ("Failed to receive msg");
if (!dbus_message_is_signal(m, "a.b.c", "d"))
_dbus_assert_not_reached("bogus message received");
_dbus_test_fatal ("bogus message received");
dbus_message_unref(m);
block_connection_until_message_from_bus (context, bar, "unix fd reception on bar");
if (!(m = pop_message_waiting_for_memory (bar)))
_dbus_assert_not_reached("Failed to receive msg");
_dbus_test_fatal ("Failed to receive msg");
if (!dbus_message_is_signal(m, "a.b.c", "d"))
_dbus_assert_not_reached("bogus message received");
_dbus_test_fatal ("bogus message received");
if (!dbus_message_get_args(m,
&error,
......@@ -5206,35 +5206,35 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir)
DBUS_TYPE_UNIX_FD, &y,
DBUS_TYPE_UNIX_FD, &z,
DBUS_TYPE_INVALID))
_dbus_assert_not_reached("Failed to parse