diff --git a/test/libc/calls/getprogramexecutablename_test.c b/test/libc/calls/getprogramexecutablename_test.c index 13f475163..274a5bd97 100644 --- a/test/libc/calls/getprogramexecutablename_test.c +++ b/test/libc/calls/getprogramexecutablename_test.c @@ -39,6 +39,12 @@ __attribute__((__constructor__)) static void Child(int argc, char *argv[]) { if (strcmp(argv[2], GetProgramExecutableName())) { exit(123); } + if (!IsXnuSilicon()) exit(0); + /* TODO(mrdomino): argv[0] tests only pass on XnuSilicon right now because + __sys_execve fails there, so the ape loader is used. + the correct check is "we have been invoked either as an + assimilated binary or via the ape loader, and not via a + raw __sys_execve." */ if (strcmp(argv[3], argv[0])) { exit(124); } @@ -51,14 +57,7 @@ TEST(GetProgramExecutableName, ofThisFile) { EXPECT_TRUE(!!strstr(self, "getprogramexecutablename_test")); } -/* TODO(mrdomino): these tests only pass on XnuSilicon right now because - __sys_execve fails there, so the ape loader is used. - the correct check here is "we have been invoked either - as an assimilated binary or via the ape loader, and not - via a raw __sys_execve." */ - TEST(GetProgramExecutableName, nullEnv) { - if (!IsXnuSilicon()) return; SPAWN(fork); execve(self, (char *[]){self, "Child", self, self, 0}, (char *[]){0}); abort(); @@ -66,7 +65,6 @@ TEST(GetProgramExecutableName, nullEnv) { } TEST(GetProramExecutableName, weirdArgv0NullEnv) { - if (!IsXnuSilicon()) return; SPAWN(fork); execve(self, (char *[]){"hello", "Child", self, "hello", 0}, (char *[]){0}); abort(); @@ -74,7 +72,6 @@ TEST(GetProramExecutableName, weirdArgv0NullEnv) { } TEST(GetProgramExecutableName, weirdArgv0CosmoVar) { - if (!IsXnuSilicon()) return; char buf[32 + PATH_MAX]; stpcpy(stpcpy(buf, "COSMOPOLITAN_PROGRAM_EXECUTABLE="), self); SPAWN(fork); @@ -85,7 +82,6 @@ TEST(GetProgramExecutableName, weirdArgv0CosmoVar) { } TEST(GetProgramExecutableName, weirdArgv0WrongCosmoVar) { - if (!IsXnuSilicon()) return; char *bad = "COSMOPOLITAN_PROGRAM_EXECUTABLE=hi"; SPAWN(fork); execve(self, (char *[]){"hello", "Child", self, "hello", 0}, @@ -95,7 +91,6 @@ TEST(GetProgramExecutableName, weirdArgv0WrongCosmoVar) { } TEST(GetProgramExecutableName, movedSelf) { - if (!IsXnuSilicon()) return; char buf[BUFSIZ]; ASSERT_SYS(0, 3, open(GetProgramExecutableName(), O_RDONLY)); ASSERT_SYS(0, 4, creat("test", 0755));