From: Simon McVittie Date: Mon, 13 Feb 2017 17:01:04 +0000 (+0000) Subject: dbus-object-tree test: tolerate OOM in run_decompose_tests() X-Git-Tag: dbus-1.11.10~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b465212e5e4aba1dae9c29e7308fc6d776bc9e2;p=thirdparty%2Fdbus.git 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 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99758 Reviewed-by: Philip Withnall --- diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c index 77a42250e..ab5df39ba 100644 --- a/dbus/dbus-object-tree.c +++ b/dbus/dbus-object-tree.c @@ -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;