summaryrefslogtreecommitdiff
path: root/dbus/dbus-hash.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-11-14 14:17:53 +0000
committerSimon McVittie <smcv@collabora.com>2017-11-15 12:12:15 +0000
commit3d2300efc3584d9b5aabe2b9c2130b0eedd381bc (patch)
treec093fca50866c31a30850b92cd5528be9e633887 /dbus/dbus-hash.c
parent2edee28f152be8ae0882417604f5c580c32ee1ac (diff)
downloaddbus-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-hash.c')
-rw-r--r--dbus/dbus-hash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c
index d60f6cb0..1192c6c4 100644
--- a/dbus/dbus-hash.c
+++ b/dbus/dbus-hash.c
@@ -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);