Skip to content

tests: Add missing wakeup calls to gdbus-names test

Philip Withnall requested to merge wip/pwithnall/gdbus-names-livelock into main

The tests in gdbus-names.c use a mixture of GMainLoop and iterating a GMainContext directly. Some of the helper functions based around the OwnNameData struct use the loop GMainLoop even when called from tests like watch_with_different_context() which themselves use GMainContext directly.

Thus, it’s possible for the GMainLoop to not be running, while the test is iterating on g_main_context_iteration(). In this case, g_main_loop_quit() is a no-op and will not wake up the GMainContext. This causes the test to livelock in around 1 in 1200 test runs.

Fix this by adding an explicit g_main_context_wakeup() call after each g_main_loop_quit() call. A more comprehensive fix would be to port all the tests in this file to iterating GMainContext directly, and drop all the GMainLoop usage, but I don’t have time for that right now.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports