Instead of parsing the command line, which can contain a shell script,
run using /bin/sh so it allows more complex command line to be tested:
sudo tools/test-runner -l -d -k <pathto/bzImage> --
'client/bluetoothctl power on && sleep 2 && client/bluetoothctl power
off'
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
argv[0] = (char *) test_table[idx];
argv[1] = "-q";
argv[2] = NULL;
- } else {
- while (1) {
- char *ptr;
-
- ptr = strchr(cmdname, ' ');
- if (!ptr) {
- argv[pos++] = cmdname;
- break;
- }
-
- *ptr = '\0';
- argv[pos++] = cmdname;
- if (pos > 8)
- break;
-
- cmdname = ptr + 1;
- }
-
- argv[pos] = NULL;
+ cmdname = NULL;
}
pos = 0;
envp[pos++] = home;
envp[pos] = NULL;
- printf("Running command %s\n", argv[0]);
+ printf("Running command %s\n", cmdname ? cmdname : argv[0]);
pid = fork();
if (pid < 0) {
perror("Failed to change directory");
}
- execve(argv[0], argv, envp);
+ if (!cmdname)
+ execve(argv[0], argv, envp);
+ else
+ execl("/bin/sh", "sh", "-c", cmdname, NULL);
+
exit(EXIT_SUCCESS);
}