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;
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#include "test.h"
#include <dbus/dbus-internals.h>
#include <dbus/dbus-mainloop.h>
#include <dbus/dbus-test-tap.h>
#include <dbus/dbus-timeout.h>
struct BusExpireList
......@@ -362,7 +363,7 @@ bus_expire_list_test (const DBusString *test_data_dir)
item->item.added_tv_sec = tv_sec;
item->item.added_tv_usec = tv_usec;
if (!bus_expire_list_add (list, &item->item))
_dbus_assert_not_reached ("out of memory");
_dbus_test_fatal ("out of memory");
next_interval =
do_expiration_with_monotonic_time (list, tv_sec_not_expired,
......
......@@ -29,6 +29,7 @@
#include "services.h"
#include "utils.h"
#include <dbus/dbus-marshal-validate.h>
#include <dbus/dbus-test-tap.h>
struct BusMatchRule
{
......@@ -2739,7 +2740,7 @@ test_matching (void)
message1 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message1 != NULL);
if (!dbus_message_set_member (message1, "Frobated"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
v_STRING = "foobar";
v_INT32 = 3;
......@@ -2747,8 +2748,8 @@ test_matching (void)
DBUS_TYPE_STRING, &v_STRING,
DBUS_TYPE_INT32, &v_INT32,
NULL))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
check_matching (message1, 1,
should_match_message_1,
should_not_match_message_1);
......@@ -2758,14 +2759,14 @@ test_matching (void)
message2 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message2 != NULL);
if (!dbus_message_set_member (message2, "NameOwnerChanged"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
/* Obviously this isn't really a NameOwnerChanged signal. */
v_STRING = EXAMPLE_NAME;
if (!dbus_message_append_args (message2,
DBUS_TYPE_STRING, &v_STRING,
NULL))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
check_matching (message2, 2,
should_match_message_2,
......@@ -2814,12 +2815,12 @@ test_path_match (int type,
_dbus_assert (message != NULL);
if (!dbus_message_set_member (message, "Foo"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
if (!dbus_message_append_args (message,
type, &path,
NULL))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
matched = match_rule_matches (rule, NULL, NULL, message, 0);
......@@ -2924,22 +2925,22 @@ test_matching_path_namespace (void)
message1 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message1 != NULL);
if (!dbus_message_set_path (message1, "/foo/TheObjectManager"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
message2 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message2 != NULL);
if (!dbus_message_set_path (message2, "/foo/TheObjectManager/child_object"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
message3 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message3 != NULL);
if (!dbus_message_set_path (message3, "/foo/TheObjectManagerOther"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
message4 = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
_dbus_assert (message4 != NULL);
if (!dbus_message_set_path (message4, "/"))
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
check_matching (message1, 1,
path_namespace_should_match_message_1,
......@@ -2971,7 +2972,7 @@ bus_signals_test (const DBusString *test_data_dir)
bus_matchmaker_unref (matchmaker);
if (!_dbus_test_oom_handling ("parsing match rules", test_parsing, NULL))
_dbus_assert_not_reached ("Parsing match rules test failed");
_dbus_test_fatal ("Parsing match rules test failed");
test_equality ();
test_matching ();
......
......@@ -28,6 +28,7 @@
#include "dbus-list.h"
#include "dbus-string.h"
#include "dbus-protocol.h"
#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusAddressInternals Address parsing
......@@ -713,7 +714,7 @@ _dbus_address_test (void)
escaped = dbus_address_escape_value (test->unescaped);
if (escaped == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
if (strcmp (escaped, test->escaped) != 0)
{
......@@ -766,7 +767,7 @@ _dbus_address_test (void)
if (!dbus_parse_address ("unix:path=/tmp/foo;debug:name=test,sliff=sloff;",
&entries, &len, &error))
_dbus_assert_not_reached ("could not parse address");
_dbus_test_fatal ("could not parse address");
_dbus_assert (len == 2);
_dbus_assert (strcmp (dbus_address_entry_get_value (entries[0], "path"), "/tmp/foo") == 0);
_dbus_assert (strcmp (dbus_address_entry_get_value (entries[1], "name"), "test") == 0);
......@@ -776,47 +777,47 @@ _dbus_address_test (void)
/* Different possible errors */
if (dbus_parse_address ("", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:bar", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:bar,baz", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:bar=foo,baz", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:bar=foo;baz", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:=foo", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:foo=", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
if (dbus_parse_address ("foo:foo,bar=baz", &entries, &len, &error))
_dbus_assert_not_reached ("Parsed incorrect address.");
_dbus_test_fatal ("Parsed incorrect address.");
else
dbus_error_free (&error);
......
......@@ -226,17 +226,17 @@ auth_set_unix_credentials(DBusAuth *auth,
credentials = _dbus_credentials_new ();
if (credentials == NULL)
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
if (uid != DBUS_UID_UNSET)
{
if (!_dbus_credentials_add_unix_uid (credentials, uid))
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
}
if (pid != DBUS_PID_UNSET)
{
if (!_dbus_credentials_add_pid (credentials, pid))
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
}
_dbus_auth_set_credentials (auth, credentials);
......
......@@ -52,20 +52,20 @@ process_test_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");
dir = _dbus_directory_open (&test_directory, &error);
if (dir == NULL)
......@@ -85,13 +85,13 @@ process_test_subdir (const DBusString *test_base_dir,
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 (&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 (&filename, ".auth-script"))
{
......
......@@ -25,6 +25,7 @@
#include "dbus-internals.h"
#include "dbus-test.h"
#include "dbus-credentials.h"
#include <dbus/dbus-test-tap.h>
/**
* @addtogroup DBusCredentials
......@@ -90,7 +91,7 @@ _dbus_credentials_test (const char *test_data_dir)
creds = make_credentials (12, 511, SAMPLE_SID);
if (creds == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
/* test refcounting */
_dbus_credentials_ref (creds);
......@@ -110,7 +111,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Test copy */
creds2 = _dbus_credentials_copy (creds);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (_dbus_credentials_include (creds2, DBUS_CREDENTIAL_UNIX_USER_ID));
_dbus_assert (_dbus_credentials_include (creds2, DBUS_CREDENTIAL_UNIX_PROCESS_ID));
......@@ -127,7 +128,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Same user if both unix and windows are the same */
creds2 = make_credentials (12, DBUS_PID_UNSET, SAMPLE_SID);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (_dbus_credentials_same_user (creds, creds2));
......@@ -136,7 +137,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Not the same user if Windows is missing */
creds2 = make_credentials (12, DBUS_PID_UNSET, NULL);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (!_dbus_credentials_same_user (creds, creds2));
_dbus_assert (_dbus_credentials_are_superset (creds, creds2));
......@@ -146,7 +147,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Not the same user if Windows is different */
creds2 = make_credentials (12, DBUS_PID_UNSET, OTHER_SAMPLE_SID);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (!_dbus_credentials_same_user (creds, creds2));
_dbus_assert (!_dbus_credentials_are_superset (creds, creds2));
......@@ -156,7 +157,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Not the same user if Unix is missing */
creds2 = make_credentials (DBUS_UID_UNSET, DBUS_PID_UNSET, SAMPLE_SID);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (!_dbus_credentials_same_user (creds, creds2));
_dbus_assert (_dbus_credentials_are_superset (creds, creds2));
......@@ -166,7 +167,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Not the same user if Unix is different */
creds2 = make_credentials (15, DBUS_PID_UNSET, SAMPLE_SID);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (!_dbus_credentials_same_user (creds, creds2));
_dbus_assert (!_dbus_credentials_are_superset (creds, creds2));
......@@ -176,7 +177,7 @@ _dbus_credentials_test (const char *test_data_dir)
/* Not the same user if both are missing */
creds2 = make_credentials (DBUS_UID_UNSET, DBUS_PID_UNSET, NULL);
if (creds2 == NULL)
_dbus_assert_not_reached ("oom");
_dbus_test_fatal ("oom");
_dbus_assert (!_dbus_credentials_same_user (creds, creds2));
_dbus_assert (_dbus_credentials_are_superset (creds, creds2));
......
......@@ -24,6 +24,7 @@
#include <config.h>
#include "dbus-dataslot.h"
#include "dbus-threads-internal.h"
#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusDataSlot Data slots
......@@ -376,7 +377,7 @@ _dbus_data_slot_test (void)
void *old_data;
if (!_dbus_data_slot_allocator_init (&allocator, _DBUS_LOCK_server_slots))
_dbus_assert_not_reached ("no memory for allocator");
_dbus_test_fatal ("no memory for allocator");
_dbus_data_slot_list_init (&list);
......@@ -394,7 +395,7 @@ _dbus_data_slot_test (void)
_dbus_data_slot_allocator_alloc (&allocator, &tmp);
if (tmp != i)
_dbus_assert_not_reached ("did not allocate slots in numeric order");
_dbus_test_fatal ("did not allocate slots in numeric order");
++i;
}
......@@ -407,7 +408,7 @@ _dbus_data_slot_test (void)
_DBUS_INT_TO_POINTER (i),
test_free_slot_data_func,
&old_free_func, &old_data))
_dbus_assert_not_reached ("no memory to set data");
_dbus_test_fatal ("no memory to set data");
_dbus_assert (old_free_func == NULL);
_dbus_assert (old_data == NULL);
......@@ -427,7 +428,7 @@ _dbus_data_slot_test (void)
_DBUS_INT_TO_POINTER (i),
test_free_slot_data_func,
&old_free_func, &old_data))
_dbus_assert_not_reached ("no memory to set data");
_dbus_test_fatal ("no memory to set data");
_dbus_assert (old_free_func == test_free_slot_data_func);
_dbus_assert (_DBUS_POINTER_TO_INT (old_data) == i);
......
......@@ -1599,14 +1599,14 @@ _dbus_hash_test (void)
keys = dbus_new (char *, N_HASH_KEYS);
if (keys == NULL)
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
for (i = 0; i < N_HASH_KEYS; i++)
{
keys[i] = dbus_malloc (128);
if (keys[i] == NULL)
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
}
_dbus_test_diag ("Computing test hash keys...");
......@@ -1949,11 +1949,11 @@ _dbus_hash_test (void)
while (i >= 0)
{
if (!_dbus_hash_iter_lookup (table1, keys[i], FALSE, &iter))
_dbus_assert_not_reached ("hash entry should have existed");
_dbus_test_fatal ("hash entry should have existed");
_dbus_hash_iter_remove_entry (&iter);
if (!_dbus_hash_iter_lookup (table2, _DBUS_INT_TO_POINTER (i), FALSE, &iter))
_dbus_assert_not_reached ("hash entry should have existed");
_dbus_test_fatal ("hash entry should have existed");
_dbus_hash_iter_remove_entry (&iter);
_dbus_assert (count_entries (table1) == i);
......
......@@ -1064,9 +1064,9 @@ _dbus_keyring_test (void)
_dbus_assert (!_dbus_keyring_validate_context (&context));
if (!_dbus_string_init (&context))
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
if (!_dbus_string_append_byte (&context, '\0'))
_dbus_assert_not_reached ("no memory");
_dbus_test_fatal ("no memory");
_dbus_assert (!_dbus_keyring_validate_context (&context));
_dbus_string_free (&context);
......
......@@ -26,6 +26,7 @@
#include "dbus-list.h"
#include "dbus-mempool.h"
#include "dbus-threads-internal.h"
#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusList Linked list
......@@ -963,10 +964,10 @@ _dbus_list_test (void)
while (i < 10)
{
if (!_dbus_list_append (&list1, _DBUS_INT_TO_POINTER (i)))
_dbus_assert_not_reached ("could not allocate for append");
_dbus_test_fatal ("could not allocate for append");
if (!_dbus_list_prepend (&list2, _DBUS_INT_TO_POINTER (i)))
_dbus_assert_not_reached ("count not allocate for prepend");
_dbus_test_fatal ("count not allocate for prepend");