summaryrefslogtreecommitdiff
path: root/tools/test-runner.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-04-01 10:07:00 -0700
committerMarcel Holtmann <marcel@holtmann.org>2015-04-01 10:07:00 -0700
commit4e8fc7499210287e6b4bf842d3de62f287bba801 (patch)
treeaa741e85b511b84c28ac3fe01d697e127c2c3bde /tools/test-runner.c
parentadbf8608a6494553b3d761a40d81bef84f5198e7 (diff)
downloadbluez-4e8fc7499210287e6b4bf842d3de62f287bba801.tar.gz
tools: Change into to current directory before running test
Diffstat (limited to 'tools/test-runner.c')
-rw-r--r--tools/test-runner.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 25ff52147..8caf35125 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -219,11 +219,7 @@ static void start_qemu(void)
else
snprintf(initcmd, sizeof(initcmd), "%s/%s", cwd, own_binary);
- if (test_argv[0][0] == '/')
- pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0]);
- else
- pos = snprintf(testargs, sizeof(testargs), "%s/%s",
- cwd, test_argv[0]);
+ pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0]);
for (i = 1; i < test_argc; i++) {
int len = sizeof(testargs) - pos;
@@ -293,6 +289,12 @@ static void run_command(char *cmdname, char *home)
}
if (pid == 0) {
+ if (home) {
+ printf("Changing into directory %s\n", home + 5);
+ if (chdir(home + 5) < 0)
+ perror("Failed to change directory");
+ }
+
execve(argv[0], argv, envp);
exit(EXIT_SUCCESS);
}