From f16337950b02b36aebdfb6f516b4decce62cd5ff Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 12 Jan 2013 00:12:25 +0200 Subject: [PATCH] tester: Add -l command line switch for listing test cases --- src/shared/tester.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/shared/tester.c b/src/shared/tester.c index 440bf109d..9e62ce8f7 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); -- 2.47.3