Diff between 287c70014de1beb94005386a22d1c5c4df4e8128 and 45aa83e93529a20731803ce7d3a4c4d0b534a9fb

Changed Files

File Additions Deletions Status
src/shared/tester.c +13 -4 modified

Full Patch

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 8906ba6..440bf10 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 },
 };