diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2015-03-09 15:46:47 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2015-03-09 15:46:47 +1300 |
commit | 0ef2e85c2ba9ed9ce56d7b00ff91ee94832bf1e9 (patch) | |
tree | 7a06d13a12d2b0628605c0adc834f13ba4092430 /tests | |
parent | 079ee59dcf44afc60558c35812afad3146c25356 (diff) | |
download | lightdm-0ef2e85c2ba9ed9ce56d7b00ff91ee94832bf1e9.tar.gz |
Allow a duration to be set for test waits
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/test-runner.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index e66dead8..721efec9 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -139,6 +139,7 @@ static GList *status_clients = NULL; static void ready (void); static void quit (int status); +static gboolean status_timeout_cb (gpointer data); static void check_status (const gchar *status); static AccountsUser *get_accounts_user_by_uid (guint uid); static AccountsUser *get_accounts_user_by_name (const gchar *username); @@ -522,11 +523,25 @@ handle_command (const gchar *command) } else if (strcmp (name, "WAIT") == 0) { + const gchar *v; + int duration; + + /* Stop status timeout */ + if (status_timeout) + g_source_remove (status_timeout); + /* Use a main loop so that our DBus functions are still responsive */ GMainLoop *loop = g_main_loop_new (NULL, FALSE); - g_timeout_add_seconds (1, stop_loop, loop); + v = g_hash_table_lookup (params, "DURATION"); + duration = v ? atoi (v) : 1; + if (duration < 1) + duration = 1; + g_timeout_add_seconds (duration, stop_loop, loop); g_main_loop_run (loop); g_main_loop_unref (loop); + + /* Restart status timeout */ + status_timeout = g_timeout_add (status_timeout_ms, status_timeout_cb, NULL); } else if (strcmp (name, "ADD-SEAT") == 0) { |