Skip to contentSkip to conversation

testsuite: Smokey: Use argv[0] in favor of hard-coded paths

PATCH New Jan Kiszka 1 participant 1 message Jul 2, 2019

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 testsuite: Smokey: Use argv[0] in favor of hard-coded paths

From: Jan Kiszka <[email protected]>

Whenever possible (dlopen test excluded so far), use argv[0] when calling the smokey binary again or running it under gdb. This reduces the dependency on hard-coded paths and also supports invocation from the build folder.

---
 testsuite/smokey/gdb/gdb.c               | 3 +--
 testsuite/smokey/posix-fork/posix-fork.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
testsuite/smokey/gdb/gdb.c +1 -2
index 2fad3da19a..a6909d595b 100644
@@ -274,8 +274,7 @@ static int run_gdb(struct smokey_test *t, int argc, char *const argv[])
 			snprintf(run_param, sizeof(run_param), "--run=%d",
 				 t->__reserved.id);
 			execl("/usr/bin/gdb", "gdb", "--args",
-			      CONFIG_XENO_PREFIX "/bin/smokey", run_param,
-			      "run_target", NULL);
+			      argv[0], run_param, "run_target", NULL);
 			_exit(ESRCH);
 
 		default:
testsuite/smokey/posix-fork/posix-fork.c +1 -1
index 57909a67ce..3541a8a9ff 100644
@@ -32,5 +32,5 @@ static int run_posix_fork(struct smokey_test *t, int argc, char *const argv[])
 	 * Re-exec ourselves without running any test, this is
 	 * enough for creating a shadow context.
 	 */
-	return smokey_fork_exec(XENO_TEST_DIR "/smokey", "smokey");
+	return smokey_fork_exec(argv[0], "smokey");
 }
Signature · 1 line
2.16.4