From e813502c5b2a9acd98842893a7e8815203ad6e2d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 13 Feb 2017 17:01:04 +0000 Subject: [PATCH] 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 --- dbus/dbus-object-tree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c index 77a42250..ab5df39b 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; -- 2.11.0