[glib/glib-2-32] /mainloop/timeouts test: Reduce race condition
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] /mainloop/timeouts test: Reduce race condition
- Date: Sat, 14 Jul 2012 23:22:30 +0000 (UTC)
commit 7f3295b3b3c8b00ff7ec007fe139da318cf043ab
Author: Martin Pitt <martinpitt gnome org>
Date: Wed Jun 27 11:46:28 2012 +0200
/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
glib/tests/mainloop.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index c2ca00c..98dfb40 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]