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.
This commit is contained in:
Ryan Lortie 2010-05-18 17:25:43 -04:00
parent 6067f9f794
commit 719e2dcb3b

View File

@ -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 (" ");