Commit c3d15a9e authored by Simon McVittie's avatar Simon McVittie

tests: Allow timeout to be multiplied by an arbitrary factor

Running tests under instrumentation (libasan) or emulation (qemu)
is not fast.

Inspired by the --timeout-factor option in
<https://salsa.debian.org/ci-team/autopkgtest>.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent d9de6ab2
......@@ -576,6 +576,8 @@ static void
set_timeout (guint factor)
{
static guint timeout = 0;
const gchar *env_factor_str;
guint64 env_factor = 1;
/* Prevent tests from hanging forever. This is intended to be long enough
* that any reasonable regression test on any reasonable hardware would
......@@ -588,6 +590,18 @@ set_timeout (guint factor)
if (RUNNING_ON_VALGRIND)
factor = factor * 10;
env_factor_str = g_getenv ("DBUS_TEST_TIMEOUT_MULTIPLIER");
if (env_factor_str != NULL)
{
env_factor = g_ascii_strtoull (env_factor_str, NULL, 10);
if (env_factor == 0)
g_error ("Invalid DBUS_TEST_TIMEOUT_MULTIPLIER %s", env_factor_str);
factor = factor * env_factor;
}
timeout = g_timeout_add_seconds (TIMEOUT * factor, time_out, NULL);
#ifdef G_OS_UNIX
/* The GLib main loop might not be running (we don't use it in every
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment