mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 23:28:54 +02:00
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
This commit is contained in:
committed by
Simon McVittie
parent
7d5c738dba
commit
331f73c26d
@@ -74,11 +74,15 @@ test_methods (GDBusProxy *proxy)
|
|||||||
g_assert_cmpstr (error->message, ==, "Yo is not a proper greeting");
|
g_assert_cmpstr (error->message, ==, "Yo is not a proper greeting");
|
||||||
g_clear_error (&error);
|
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;
|
error = NULL;
|
||||||
result = g_dbus_proxy_call_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", 500 /* msec */),
|
g_variant_new ("(i)", 10000 /* msec */),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
100 /* msec */,
|
100 /* msec */,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -104,12 +108,14 @@ test_methods (GDBusProxy *proxy)
|
|||||||
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
|
||||||
g_variant_unref (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_dbus_proxy_set_default_timeout (proxy, 250);
|
||||||
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
|
g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
|
||||||
result = g_dbus_proxy_call_sync (proxy,
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
"Sleep",
|
"Sleep",
|
||||||
g_variant_new ("(i)", 500 /* msec */),
|
g_variant_new ("(i)", 10000 /* msec */),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* use proxy default (e.g. 250 msec) */
|
-1, /* use proxy default (e.g. 250 msec) */
|
||||||
NULL,
|
NULL,
|
||||||
|
Reference in New Issue
Block a user