summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-06-27 11:46:28 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-06-27 15:32:38 +0200
commit95f29687e14423ca541cac1c00137375b935168d (patch)
treea5e33b78ae3a1ff2494910359bfe3e5f0bd75325
parent240ef2b9e830f2aa92356368902bec813f3c1ef8 (diff)
/mainloop/timeouts test: Reduce race condition
Due to load, particular traits of the architecture, or other circumstances, the /mainloop/timeouts sometimes manages to call the "every 100 ms" timer loop only 9 times in 1050 ms. This is an inherent race-condition in the test; allow it some slack and accept 9 times as well. https://bugzilla.gnome.org/show_bug.cgi?id=678959
-rw-r--r--glib/tests/mainloop.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 3f0bcee11..d064492d4 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -179,7 +179,10 @@ test_timeouts (void)
g_main_loop_run (loop);
- g_assert_cmpint (a, ==, 10);
+ /* this is a race condition; under some circumstances we might not get 10
+ * 100ms runs in 1050 ms, so consider 9 as "close enough" */
+ g_assert_cmpint (a, >=, 9);
+ g_assert_cmpint (a, <=, 10);
g_assert_cmpint (b, ==, 4);
g_assert_cmpint (c, ==, 3);