test-runner: Use src/main.conf if available
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 28 Jun 2021 20:43:03 +0000 (13:43 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
This makes use of src/main.conf as configuration file that way custom
options can be applied while running the daemon.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/test-runner.c

index 92f3642..923cf3d 100755 (executable)
@@ -467,8 +467,9 @@ static const char *daemon_table[] = {
 static pid_t start_bluetooth_daemon(const char *home)
 {
        const char *daemon = NULL;
-       char *argv[3], *envp[2];
+       char *argv[5], *envp[2];
        pid_t pid;
+       struct stat st;
        int i;
 
        if (chdir(home + 5) < 0) {
@@ -477,7 +478,6 @@ static pid_t start_bluetooth_daemon(const char *home)
        }
 
        for (i = 0; daemon_table[i]; i++) {
-               struct stat st;
 
                if (!stat(daemon_table[i], &st)) {
                        daemon = daemon_table[i];
@@ -496,6 +496,12 @@ static pid_t start_bluetooth_daemon(const char *home)
        argv[1] = "--nodetach";
        argv[2] = NULL;
 
+       if (!stat("src/main.conf", &st)) {
+               argv[2] = "-f";
+               argv[3] = "src/main.conf";
+               argv[4] = NULL;
+       }
+
        envp[0] = "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket";
        envp[1] = NULL;