diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-01-11 23:48:36 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-01-12 00:29:11 +0200 |
commit | 45aa83e93529a20731803ce7d3a4c4d0b534a9fb (patch) | |
tree | 4e84f9b00a44f097762b9445b50036b0cf023257 /src/shared/tester.c | |
parent | 287c70014de1beb94005386a22d1c5c4df4e8128 (diff) | |
download | bluez-45aa83e93529a20731803ce7d3a4c4d0b534a9fb.tar.gz |
tester: Add -p option to filter which test to be executed
Diffstat (limited to 'src/shared/tester.c')
-rw-r--r-- | src/shared/tester.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/shared/tester.c b/src/shared/tester.c index 8906ba652..440bf109d 100644 --- a/src/shared/tester.c +++ b/src/shared/tester.c @@ -95,6 +95,11 @@ static GList *test_list; static GList *test_current; static GTimer *test_timer; +static gboolean option_version = FALSE; +static gboolean option_quiet = FALSE; +static gboolean option_debug = FALSE; +static const char *option_prefix = NULL; + static void test_destroy(gpointer data) { struct test_case *test = data; @@ -164,6 +169,12 @@ void tester_add_full(const char *name, const void *test_data, if (!test_func) return; + if (option_prefix && !g_str_has_prefix(name, option_prefix)) { + if (destroy) + destroy(user_data); + return; + } + test = g_new0(struct test_case, 1); test->name = g_strdup(name); @@ -648,10 +659,6 @@ static guint setup_signalfd(void) return source; } -static gboolean option_version = FALSE; -static gboolean option_quiet = FALSE; -static gboolean option_debug = FALSE; - bool tester_use_quiet(void) { return option_quiet == TRUE ? true : false; @@ -669,6 +676,8 @@ static GOptionEntry options[] = { "Run tests without logging" }, { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug, "Run tests with debug output" }, + { "prefix", 'p', 0, G_OPTION_ARG_STRING, &option_prefix, + "Run tests matching provided prefix" }, { NULL }, }; |