[glib] gio/tests/gdbus-proxy: sleep longer when testing that we time out



commit 331f73c26d2ac0a87a4af78e5a72d5469ec91cb5
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Fri Aug 5 20:13:42 2016 +0100

    gio/tests/gdbus-proxy: sleep longer when testing that we time out
    
    On slow ARM machines doing parallel builds, there's no guarantee that
    we'll get scheduled in a window between (100ms|250ms) and 500ms.
    
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Reviewed-by: Philip Withnall <withnall endlessm com>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674

 gio/tests/gdbus-proxy.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c
index fff1f48..78a633b 100644
--- a/gio/tests/gdbus-proxy.c
+++ b/gio/tests/gdbus-proxy.c
@@ -74,11 +74,15 @@ test_methods (GDBusProxy *proxy)
   g_assert_cmpstr (error->message, ==, "Yo is not a proper greeting");
   g_clear_error (&error);
 
-  /* Check that we get a timeout if the method handling is taking longer than timeout */
+  /* Check that we get a timeout if the method handling is taking longer than
+   * timeout. We use such a long sleep because on slow machines, if the
+   * sleep isn't much longer than the timeout and we're doing a parallel
+   * build, there's no guarantee we'll be scheduled in the window between
+   * the timeout being hit and the sleep finishing. */
   error = NULL;
   result = g_dbus_proxy_call_sync (proxy,
                                    "Sleep",
-                                   g_variant_new ("(i)", 500 /* msec */),
+                                   g_variant_new ("(i)", 10000 /* msec */),
                                    G_DBUS_CALL_FLAGS_NONE,
                                    100 /* msec */,
                                    NULL,
@@ -104,12 +108,14 @@ test_methods (GDBusProxy *proxy)
   g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
   g_variant_unref (result);
 
-  /* now set the proxy-default timeout to 250 msec and try the 500 msec call - this should FAIL */
+  /* Now set the proxy-default timeout to 250 msec and try the 10000 msec
+   * call - this should FAIL. Again, we use such a long sleep because on slow
+   * machines there's no guarantee we'll be scheduled when we want to be. */
   g_dbus_proxy_set_default_timeout (proxy, 250);
   g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
   result = g_dbus_proxy_call_sync (proxy,
                                    "Sleep",
-                                   g_variant_new ("(i)", 500 /* msec */),
+                                   g_variant_new ("(i)", 10000 /* msec */),
                                    G_DBUS_CALL_FLAGS_NONE,
                                    -1, /* use proxy default (e.g. 250 msec) */
                                    NULL,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]