Skip to content

Commit b1af0a2

Browse files
committed
std: re-enable most of setrlimit test on macos
- skip only RLIMIT_STACK test on macos closes #18395
1 parent 256c593 commit b1af0a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/std/os/test.zig

+7-5
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,6 @@ test "fsync" {
773773
}
774774

775775
test "getrlimit and setrlimit" {
776-
if (builtin.target.os.tag == .macos) {
777-
// https://github.com/ziglang/zig/issues/18395
778-
return error.SkipZigTest;
779-
}
780-
781776
if (!@hasDecl(os.system, "rlimit")) {
782777
return error.SkipZigTest;
783778
}
@@ -786,6 +781,13 @@ test "getrlimit and setrlimit" {
786781
const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
787782
const limit = try os.getrlimit(resource);
788783

784+
// XNU kernel does not support RLIMIT_STACK if a custom stack is active,
785+
// which looks to always be the case. EINVAL is returned.
786+
// See https://github.com/apple-oss-distributions/xnu/blob/5e3eaea39dcf651e66cb99ba7d70e32cc4a99587/bsd/kern/kern_resource.c#L1173
787+
if (builtin.os.tag.isDarwin() and resource == .STACK) {
788+
continue;
789+
}
790+
789791
// On 32 bit MIPS musl includes a fix which changes limits greater than -1UL/2 to RLIM_INFINITY.
790792
// See http://git.musl-libc.org/cgit/musl/commit/src/misc/getrlimit.c?id=8258014fd1e34e942a549c88c7e022a00445c352
791793
//

0 commit comments

Comments
 (0)