From 3c39a23a7eb4f7d6421272ca573049437034c6ff Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 13 Feb 2024 08:50:24 +0000 Subject: [PATCH] tests: Speed up threaded toggle notify test unless -m slow is passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a fast laptop, this test currently takes about 7s to run, which is a significant portion of the overall test suite time. On a slower CI machine, especially running the test under valgrind, the test can time out. There’s no need to always run so many iterations: we run the tests under CI so often that it’s likely a failure will eventually be hit (if there is a bug) even with fewer iterations. We also now run the tests once a week with `-m slow`, so the original iteration count will also still be used then. Signed-off-by: Philip Withnall --- gobject/tests/threadtests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c index ea5d6e3ca..9b923f3fd 100644 --- a/gobject/tests/threadtests.c +++ b/gobject/tests/threadtests.c @@ -480,6 +480,7 @@ test_threaded_toggle_notify (void) ToggleNotifyThreadData data = { object, FALSE, 0 }; GThread *threads[3]; gsize i; + const int n_iterations = g_test_thorough () ? 1000000 : 100000; g_test_bug ("https://gitlab.gnome.org/GNOME/glib/issues/2394"); g_test_summary ("Test that toggle reference notifications can be changed " @@ -498,7 +499,7 @@ test_threaded_toggle_notify (void) * race to happen, so we wait for an high number of toggle changes to be met * so that we can be consistent on each platform. */ - while (g_atomic_int_get (&data.toggles) < 1000000) + while (g_atomic_int_get (&data.toggles) < n_iterations) ; g_atomic_int_set (&data.done, TRUE);