Skip to content

std: re-enable most of setrlimit test on macos #19051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/std/os/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,6 @@ test "fsync" {
}

test "getrlimit and setrlimit" {
if (builtin.target.os.tag == .macos) {
// https://github.com/ziglang/zig/issues/18395
return error.SkipZigTest;
}

if (!@hasDecl(os.system, "rlimit")) {
return error.SkipZigTest;
}
Expand All @@ -786,6 +781,13 @@ test "getrlimit and setrlimit" {
const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
const limit = try os.getrlimit(resource);

// XNU kernel does not support RLIMIT_STACK if a custom stack is active,
// which looks to always be the case. EINVAL is returned.
// See https://github.com/apple-oss-distributions/xnu/blob/5e3eaea39dcf651e66cb99ba7d70e32cc4a99587/bsd/kern/kern_resource.c#L1173
if (builtin.os.tag.isDarwin() and resource == .STACK) {
continue;
}

// On 32 bit MIPS musl includes a fix which changes limits greater than -1UL/2 to RLIM_INFINITY.
// See http://git.musl-libc.org/cgit/musl/commit/src/misc/getrlimit.c?id=8258014fd1e34e942a549c88c7e022a00445c352
//
Expand Down