diff options
author | Simon McVittie <smcv@collabora.com> | 2017-11-14 14:17:53 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-11-15 12:12:15 +0000 |
commit | 3d2300efc3584d9b5aabe2b9c2130b0eedd381bc (patch) | |
tree | c093fca50866c31a30850b92cd5528be9e633887 /dbus/dbus-dataslot.c | |
parent | 2edee28f152be8ae0882417604f5c580c32ee1ac (diff) | |
download | dbus-3d2300efc3584d9b5aabe2b9c2130b0eedd381bc.tar.gz |
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 <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Diffstat (limited to 'dbus/dbus-dataslot.c')
-rw-r--r-- | dbus/dbus-dataslot.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dbus/dbus-dataslot.c b/dbus/dbus-dataslot.c index a4b3bfc0..429a840b 100644 --- a/dbus/dbus-dataslot.c +++ b/dbus/dbus-dataslot.c @@ -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); |