[PATCH BlueZ v2 6/9] shared/tester: run test with given name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add option for running a single test with given name.  Useful when some
test names have a common prefix, so that neither -s or -p can
distinguish them.
---
 src/shared/tester.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/shared/tester.c b/src/shared/tester.c
index a1ee5b687..280f509b9 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -112,6 +112,7 @@ static gboolean option_monitor = FALSE;
 static gboolean option_list = FALSE;
 static const char *option_prefix = NULL;
 static const char *option_string = NULL;
+static const char *option_name = NULL;
 
 struct monitor_hdr {
 	uint16_t opcode;
@@ -285,6 +286,12 @@ void tester_add_full(const char *name, const void *test_data,
 	if (!test_func)
 		return;
 
+	if (option_name && strcmp(name, option_name)) {
+		if (destroy)
+			destroy(user_data);
+		return;
+	}
+
 	if (option_prefix && !g_str_has_prefix(name, option_prefix)) {
 		if (destroy)
 			destroy(user_data);
@@ -829,6 +836,8 @@ static GOptionEntry options[] = {
 				"Enable monitor output" },
 	{ "list", 'l', 0, G_OPTION_ARG_NONE, &option_list,
 				"Only list the tests to be run" },
+	{ "name", 'n', 0, G_OPTION_ARG_STRING, &option_name,
+				"Run test with given name" },
 	{ "prefix", 'p', 0, G_OPTION_ARG_STRING, &option_prefix,
 				"Run tests matching provided prefix" },
 	{ "string", 's', 0, G_OPTION_ARG_STRING, &option_string,
-- 
2.44.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux