[glib] Bug 619031 - method-calls-in-thread test failing
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Bug 619031 - method-calls-in-thread test failing
- Date: Tue, 18 May 2010 21:29:22 +0000 (UTC)
commit 719e2dcb3b35dbab9cfaa7d0f711b0949b57ad35
Author: Ryan Lortie <desrt desrt ca>
Date: Tue May 18 17:25:43 2010 -0400
Bug 619031 - method-calls-in-thread test failing
The test was assuming that g_timeout_add() waited for at least the amount of
time given to it before running the function. This is not the case -- the
function can be run as much as 1ms early. Make the lower time bound asserted
in the test more permissive to account for this.
gio/tests/gdbus-threading.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c
index 3fe0f7b..6bfda51 100644
--- a/gio/tests/gdbus-threading.c
+++ b/gio/tests/gdbus-threading.c
@@ -364,6 +364,11 @@ on_proxy_appeared (GDBusConnection *connection,
* a number of times. We do this so each set of calls add up to 4000
* milliseconds.
*
+ * The dbus test server that this code calls into uses glib timeouts
+ * to do the sleeping which have only a granularity of 1ms. It is
+ * therefore possible to lose as much as 40ms; the test could finish
+ * in slightly less than 4 seconds.
+ *
* We run this test twice - first with async calls in each thread, then
* again with sync calls
*/
@@ -438,8 +443,8 @@ on_proxy_appeared (GDBusConnection *connection,
//g_debug ("Elapsed time for %s = %d msec", n == 0 ? "async" : "sync", elapsed_msec);
- /* elapsed_msec should be 4000 msec + change for overhead */
- g_assert_cmpint (elapsed_msec, >=, 4000);
+ /* elapsed_msec should be 4000 msec +/- change for overhead/inaccuracy */
+ g_assert_cmpint (elapsed_msec, >=, 3950);
g_assert_cmpint (elapsed_msec, <, 5000);
g_print (" ");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]