dbus-object-tree test: tolerate OOM in run_decompose_tests()

This test is run repeatedly, with simulated out-of-memory conditions
at different points. If one of these was during run_decompose_tests(),
the test was recorded as failing. Before Philip fixed it, this was
masked by the failure not being reported correctly (CID: #54711).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99758
Reviewed-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Simon McVittie 2017-02-13 17:01:04 +00:00 committed by Simon McVittie
parent 72b18c54c6
commit 7b465212e5

View file

@ -1609,6 +1609,8 @@ static DecomposePathTest decompose_tests[] = {
{ "/foo/bar/this/is/longer", { "foo", "bar", "this", "is", "longer", NULL } }
};
/* Return TRUE on success, FALSE on OOM, die with an assertion failure
* on failure. */
static dbus_bool_t
run_decompose_tests (void)
{
@ -1668,6 +1670,8 @@ find_subtree_registered_or_unregistered (DBusObjectTree *tree,
return find_subtree_recurse (tree->root, path, FALSE, NULL, NULL);
}
/* Returns TRUE if the right thing happens, but the right thing might
* be OOM. */
static dbus_bool_t
object_tree_test_iteration (void *data)
{
@ -1693,7 +1697,7 @@ object_tree_test_iteration (void *data)
dbus_bool_t exact_match;
if (!run_decompose_tests ())
return FALSE;
return TRUE; /* OOM is OK */
tree = NULL;