diff mbox series

[BlueZ] test-runner: Add dedicated option to start D-Bus

Message ID 20220416001853.1240822-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ] test-runner: Add dedicated option to start D-Bus | expand

Commit Message

Luiz Augusto von Dentz April 16, 2022, 12:18 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds a dedicated option to start D-Bus alone which can be useful
when testing the bluetoothd with the likes of valgrind.
---
 tools/test-runner.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

Comments

patchwork-bot+bluetooth@kernel.org April 19, 2022, midnight UTC | #1
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 15 Apr 2022 17:18:53 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds a dedicated option to start D-Bus alone which can be useful
> when testing the bluetoothd with the likes of valgrind.
> ---
>  tools/test-runner.c | 38 +++++++++++++++++++++++++++-----------
>  1 file changed, 27 insertions(+), 11 deletions(-)

Here is the summary with links:
  - [BlueZ] test-runner: Add dedicated option to start D-Bus
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fb4997fb09fa

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/test-runner.c b/tools/test-runner.c
index fd7b3b1b7..1f1a8c36f 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -47,6 +47,7 @@  static int test_argc;
 
 static bool run_auto = false;
 static bool start_dbus = false;
+static bool start_daemon = false;
 static bool start_emulator = false;
 static bool start_monitor = false;
 static int num_devs = 0;
@@ -249,11 +250,12 @@  static void start_qemu(void)
 				"rootflags=trans=virtio,version=9p2000.L "
 				"acpi=off pci=noacpi noapic quiet ro init=%s "
 				"bluetooth.enable_ecred=1"
-				"TESTHOME=%s TESTDBUS=%u TESTMONITOR=%u "
-				"TESTEMULATOR=%u TESTDEVS=%d TESTAUTO=%u "
-				"TESTARGS=\'%s\'",
-				initcmd, cwd, start_dbus, start_monitor,
-				start_emulator, num_devs, run_auto, testargs);
+				"TESTHOME=%s TESTDBUS=%u TESTDAEMON=%u "
+				"TESTMONITOR=%u TESTEMULATOR=%u TESTDEVS=%d "
+				"TESTAUTO=%u TESTARGS=\'%s\'",
+				initcmd, cwd, start_dbus, start_daemon,
+				start_monitor, start_emulator, num_devs,
+				run_auto, testargs);
 
 	argv = alloca(sizeof(qemu_argv) +
 				(sizeof(char *) * (4 + (num_devs * 4))));
@@ -683,11 +685,13 @@  static void run_command(char *cmdname, char *home)
 	if (start_dbus) {
 		create_dbus_system_conf();
 		dbus_pid = start_dbus_daemon();
-		daemon_pid = start_bluetooth_daemon(home);
-	} else {
+	} else
 		dbus_pid = -1;
+
+	if (start_daemon)
+		daemon_pid = start_bluetooth_daemon(home);
+	else
 		daemon_pid = -1;
-	}
 
 	if (start_monitor)
 		monitor_pid = start_btmon(home);
@@ -874,6 +878,12 @@  static void run_tests(void)
 		start_dbus = true;
 	}
 
+	ptr = strstr(cmdline, "TESTDAEMON=1");
+	if (ptr) {
+		printf("bluetoothd requested\n");
+		start_daemon = true;
+	}
+
 	ptr = strstr(cmdline, "TESTMONITOR=1");
 	if (ptr) {
 		printf("Monitor requested\n");
@@ -904,7 +914,8 @@  static void usage(void)
 	printf("\ttest-runner [options] [--] <command> [args]\n");
 	printf("Options:\n"
 		"\t-a, --auto             Find tests and run them\n"
-		"\t-d, --dbus             Start D-Bus daemon\n"
+		"\t-b, --dbus             Start D-Bus daemon\n"
+		"\t-d, --daemon           Start bluetoothd\n"
 		"\t-m, --monitor          Start btmon\n"
 		"\t-l, --emulator         Start btvirt\n"
 		"\t-u, --unix [path]      Provide serial device\n"
@@ -916,8 +927,9 @@  static void usage(void)
 static const struct option main_options[] = {
 	{ "all",     no_argument,       NULL, 'a' },
 	{ "auto",    no_argument,       NULL, 'a' },
+	{ "dbus",    no_argument,       NULL, 'b' },
 	{ "unix",    no_argument,       NULL, 'u' },
-	{ "dbus",    no_argument,       NULL, 'd' },
+	{ "daemon",  no_argument,       NULL, 'd' },
 	{ "emulator", no_argument,      NULL, 'l' },
 	{ "monitor", no_argument,       NULL, 'm' },
 	{ "qemu",    required_argument, NULL, 'q' },
@@ -941,7 +953,7 @@  int main(int argc, char *argv[])
 	for (;;) {
 		int opt;
 
-		opt = getopt_long(argc, argv, "audlmq:k:vh", main_options,
+		opt = getopt_long(argc, argv, "aubdlmq:k:vh", main_options,
 								NULL);
 		if (opt < 0)
 			break;
@@ -953,8 +965,12 @@  int main(int argc, char *argv[])
 		case 'u':
 			num_devs = 1;
 			break;
+		case 'b':
+			start_dbus = true;
+			break;
 		case 'd':
 			start_dbus = true;
+			start_daemon = true;
 			break;
 		case 'l':
 			start_emulator = true;