diff --git a/test/run-benchmarks.c b/test/run-benchmarks.c index c49de8c4..e0dd71c4 100644 --- a/test/run-benchmarks.c +++ b/test/run-benchmarks.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) { task_entry_t *task; - platform_init(); + platform_init(argc, argv); if (argc > 1) { /* A specific process was requested. */ diff --git a/test/run-tests.c b/test/run-tests.c index d1f89971..aabb5707 100644 --- a/test/run-tests.c +++ b/test/run-tests.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) { int total, passed, failed; task_entry_t* task; - platform_init(); + platform_init(argc, argv); if (argc > 1) { /* A specific process was requested. */ diff --git a/test/runner-unix.c b/test/runner-unix.c index 075637eb..82aaffb3 100644 --- a/test/runner-unix.c +++ b/test/runner-unix.c @@ -48,8 +48,9 @@ static void get_executable_path() { uint32_t bufsize = sizeof(executable_path); _NSGetExecutablePath(executable_path, &bufsize); } -#else -/* Linux-only */ +#endif + +#ifdef __linux__ static void get_executable_path() { if (!executable_path[0]) { readlink("/proc/self/exe", executable_path, PATHMAX - 1); @@ -59,10 +60,15 @@ static void get_executable_path() { /* Do platform-specific initialization. */ -void platform_init() { +void platform_init(int argc, char **argv) { /* Disable stdio output buffering. */ setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); +#ifdef get_executable_path + get_executable_path(); +#else + strcpy(executable_path, argv[0]); +#endif } @@ -78,8 +84,6 @@ int process_start(char* name, process_info_t* p) { p->terminated = 0; p->status = 0; - get_executable_path(); - pid_t pid = vfork(); if (pid < 0) { diff --git a/test/runner-win.c b/test/runner-win.c index f706ee86..ab111bc9 100644 --- a/test/runner-win.c +++ b/test/runner-win.c @@ -39,7 +39,7 @@ /* Do platform-specific initialization. */ -void platform_init() { +void platform_init(int argc, char **argv) { /* Disable the "application crashed" popup. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);