Merge branch '1515-gdbus-threading-timeout' into 'master'

tests: Bump the refcount timeout in gdbus-threading

See merge request GNOME/glib!1382
This commit is contained in:
Sebastian Dröge 2020-02-24 13:11:40 +00:00
commit 1b06461104

View File

@ -57,7 +57,7 @@ assert_connection_has_one_ref (GDBusConnection *connection,
if (g_atomic_int_get (&G_OBJECT (connection)->ref_count) == 1) if (g_atomic_int_get (&G_OBJECT (connection)->ref_count) == 1)
return; return;
timeout_source = g_timeout_source_new_seconds (1); timeout_source = g_timeout_source_new_seconds (3);
g_source_set_callback (timeout_source, timeout_cb, &data, NULL); g_source_set_callback (timeout_source, timeout_cb, &data, NULL);
g_source_attach (timeout_source, context); g_source_attach (timeout_source, context);
@ -406,7 +406,7 @@ test_sleep_in_thread_func (gpointer _data)
static void static void
test_method_calls_on_proxy (GDBusProxy *proxy) test_method_calls_on_proxy (GDBusProxy *proxy)
{ {
guint n; guint n, divisor;
/* /*
* Check that multiple threads can do calls without interferring with * Check that multiple threads can do calls without interferring with
@ -425,6 +425,11 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
* again with sync calls * again with sync calls
*/ */
if (g_test_thorough ())
divisor = 1;
else
divisor = 10;
for (n = 0; n < 2; n++) for (n = 0; n < 2; n++)
{ {
gboolean do_async; gboolean do_async;
@ -443,7 +448,7 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
data1.proxy = proxy; data1.proxy = proxy;
data1.msec = 40; data1.msec = 40;
data1.num = 100; data1.num = 100 / divisor;
data1.async = do_async; data1.async = do_async;
thread1 = g_thread_new ("sleep", thread1 = g_thread_new ("sleep",
test_sleep_in_thread_func, test_sleep_in_thread_func,
@ -451,7 +456,7 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
data2.proxy = proxy; data2.proxy = proxy;
data2.msec = 20; data2.msec = 20;
data2.num = 200; data2.num = 200 / divisor;
data2.async = do_async; data2.async = do_async;
thread2 = g_thread_new ("sleep2", thread2 = g_thread_new ("sleep2",
test_sleep_in_thread_func, test_sleep_in_thread_func,
@ -459,7 +464,7 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
data3.proxy = proxy; data3.proxy = proxy;
data3.msec = 100; data3.msec = 100;
data3.num = 40; data3.num = 40 / divisor;
data3.async = do_async; data3.async = do_async;
thread3 = g_thread_new ("sleep3", thread3 = g_thread_new ("sleep3",
test_sleep_in_thread_func, test_sleep_in_thread_func,
@ -476,8 +481,8 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
//g_debug ("Elapsed time for %s = %d msec", n == 0 ? "async" : "sync", elapsed_msec); //g_debug ("Elapsed time for %s = %d msec", n == 0 ? "async" : "sync", elapsed_msec);
/* elapsed_msec should be 4000 msec +/- change for overhead/inaccuracy */ /* elapsed_msec should be 4000 msec +/- change for overhead/inaccuracy */
g_assert_cmpint (elapsed_msec, >=, 3950); g_assert_cmpint (elapsed_msec, >=, 3950 / divisor);
g_assert_cmpint (elapsed_msec, <, 30000); g_assert_cmpint (elapsed_msec, <, 30000 / divisor);
if (g_test_verbose ()) if (g_test_verbose ())
g_printerr (" "); g_printerr (" ");
@ -575,7 +580,7 @@ test_threaded_singleton (void)
if (g_test_thorough ()) if (g_test_thorough ())
n = 100000; n = 100000;
else else
n = 5000; n = 1000;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {