]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-object-tree test: tolerate OOM in run_decompose_tests()
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 13 Feb 2017 17:01:04 +0000 (17:01 +0000)
committerSimon McVittie <smcv@debian.org>
Tue, 14 Feb 2017 08:53:12 +0000 (08:53 +0000)
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>
dbus/dbus-object-tree.c

index 77a42250e761e24921fa82753d2430c89706be0a..ab5df39bab6043cce52e3dcb0907bc3d39fbbacc 100644 (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;