[gnome-desktop-testing] Avoid the ills of g_main_loop_quit()
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop-testing] Avoid the ills of g_main_loop_quit()
- Date: Tue, 28 May 2013 22:08:19 +0000 (UTC)
commit 16dd7866e92d772147c3906180802b7abc433db6
Author: Ryan Lortie <desrt desrt ca>
Date: Tue May 28 14:16:51 2013 -0400
Avoid the ills of g_main_loop_quit()
Instead of using GMainLoop and g_main_loop_quit() to stop running when
we run out of tests or have errors, encode the condition for continuing
to run directly in main().
This avoids hanging forever in the event that there are no installed
tests in a given directory.
src/gnome-desktop-testing-runner.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index da5e99b..5cb8eee 100755
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -44,8 +44,6 @@ typedef struct {
int ntests;
int n_skipped_tests;
int n_failed_tests;
-
- GMainLoop *loop;
} TestRunnerApp;
static TestRunnerApp *app;
@@ -310,8 +308,6 @@ reschedule_tests (GCancellable *cancellable)
app->pending_tests++;
app->test_index++;
}
- if (app->pending_tests == 0)
- g_main_loop_quit (app->loop);
}
static void
@@ -331,7 +327,6 @@ on_test_run_complete (GObject *object,
if (!app->test_error)
app->test_error = g_error_copy (local_error);
g_clear_error (&local_error);
- g_main_loop_quit (app->loop);
}
else
{
@@ -377,8 +372,6 @@ main (int argc, char **argv)
else
app->parallel = opt_parallel;
- app->loop = g_main_loop_new (NULL, TRUE);
-
app->tests = g_ptr_array_new_with_free_func (g_object_unref);
if (opt_dirs)
@@ -443,7 +436,10 @@ main (int argc, char **argv)
else
{
reschedule_tests (app->cancellable);
- g_main_loop_run (app->loop);
+
+ while (app->pending_tests && !app->test_error)
+ g_main_context_iteration (NULL, TRUE);
+
if (app->test_error)
g_propagate_error (error, app->test_error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]