execve_test.com: fix run with landlock make. Cleanup execve/fexecve tests (#755)

This commit is contained in:
Gavin Hayes 2023-03-02 01:32:15 -05:00 committed by GitHub
parent ae365928c5
commit f5520209f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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