Diff between 45aa83e93529a20731803ce7d3a4c4d0b534a9fb and f16337950b02b36aebdfb6f516b4decce62cd5ff

Changed Files

File Additions Deletions Status
src/shared/tester.c +15 -0 modified

Full Patch

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 440bf10..9e62ce8 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -98,6 +98,7 @@ static GTimer *test_timer;
 static gboolean option_version = FALSE;
 static gboolean option_quiet = FALSE;
 static gboolean option_debug = FALSE;
+static gboolean option_list = FALSE;
 static const char *option_prefix = NULL;
 
 static void test_destroy(gpointer data)
@@ -175,6 +176,13 @@ void tester_add_full(const char *name, const void *test_data,
 		return;
 	}
 
+	if (option_list) {
+		printf("%s\n", name);
+		if (destroy)
+			destroy(user_data);
+		return;
+	}
+
 	test = g_new0(struct test_case, 1);
 
 	test->name = g_strdup(name);
@@ -676,6 +684,8 @@ static GOptionEntry options[] = {
 				"Run tests without logging" },
 	{ "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug,
 				"Run tests with debug output" },
+	{ "list", 'l', 0, G_OPTION_ARG_NONE, &option_list,
+				"Only list the tests to be run" },
 	{ "prefix", 'p', 0, G_OPTION_ARG_STRING, &option_prefix,
 				"Run tests matching provided prefix" },
 	{ NULL },
@@ -718,6 +728,11 @@ int tester_run(void)
 	if (!main_loop)
 		return EXIT_FAILURE;
 
+	if (option_list) {
+		g_main_loop_unref(main_loop);
+		return EXIT_SUCCESS;
+	}
+
 	signal = setup_signalfd();
 
 	g_idle_add(start_tester, NULL);