From f5520209f53b06459ac68b2f4deeffc4bcc37278 Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Thu, 2 Mar 2023 01:32:15 -0500 Subject: [PATCH] execve_test.com: fix run with landlock make. Cleanup execve/fexecve tests (#755) --- test/libc/calls/execve_test.c | 2 +- test/libc/calls/fexecve_test.c | 7 ++----- test/libc/calls/test.mk | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/libc/calls/execve_test.c b/test/libc/calls/execve_test.c index 6477ced0e..bdb595333 100644 --- a/test/libc/calls/execve_test.c +++ b/test/libc/calls/execve_test.c @@ -74,7 +74,7 @@ TEST(execve, ziposELF) { } TEST(execve, ziposAPE) { - if (!IsLinux()) { + if (!IsLinux() && !IsFreebsd()) { EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0})); return; diff --git a/test/libc/calls/fexecve_test.c b/test/libc/calls/fexecve_test.c index b25b8073e..69b4ba5fa 100644 --- a/test/libc/calls/fexecve_test.c +++ b/test/libc/calls/fexecve_test.c @@ -95,7 +95,6 @@ TEST(fexecve, APE) { SPAWN(fork); int fd = open("life-nomod.com", O_RDONLY); ASSERT_NE(-1, fd); - if (fd == -1 && errno == ENOSYS) _Exit(42); fexecve(fd, (char *const[]){0}, (char *const[]){0}); EXITS(42); } @@ -106,7 +105,6 @@ TEST(fexecve, APE_cloexec) { SPAWN(fork); int fd = open("life-nomod.com", O_RDONLY | O_CLOEXEC); ASSERT_NE(-1, fd); - if (fd == -1 && errno == ENOSYS) _Exit(42); fexecve(fd, (char *const[]){0}, (char *const[]){0}); EXITS(42); } @@ -114,8 +112,8 @@ TEST(fexecve, APE_cloexec) { TEST(fexecve, zipos) { if (!IsLinux() && !IsFreebsd()) return; int fd = open("/zip/life.elf", O_RDONLY); + ASSERT_NE(-1, fd); SPAWN(fork); - if (fd == -1 && errno == ENOSYS) _Exit(42); fexecve(fd, (char *const[]){0}, (char *const[]){0}); EXITS(42); close(fd); @@ -124,9 +122,8 @@ TEST(fexecve, zipos) { TEST(fexecve, ziposAPE) { if (!IsLinux() && !IsFreebsd()) return; int fd = open("/zip/life-nomod.com", O_RDONLY); - SPAWN(fork); ASSERT_NE(-1, fd); - if (fd == -1 && errno == ENOSYS) _Exit(42); + SPAWN(fork); fexecve(fd, (char *const[]){0}, (char *const[]){0}); EXITS(42); close(fd); diff --git a/test/libc/calls/test.mk b/test/libc/calls/test.mk index ddd542b07..3dbad448a 100644 --- a/test/libc/calls/test.mk +++ b/test/libc/calls/test.mk @@ -131,6 +131,9 @@ o/$(MODE)/test/libc/calls/openbsd_test.com.runs: \ o/$(MODE)/test/libc/calls/fexecve_test.com.runs: \ private .UNSANDBOXED = 1 # for memfd_create() +o/$(MODE)/test/libc/calls/execve_test.com.runs: \ + private .UNSANDBOXED = 1 # for memfd_create() + o/$(MODE)/test/libc/calls/read_test.com.runs: \ private .UNVEIL += /dev/zero