commit 63ea3e172e2788856cfb69b2f6085930a1c69d5b (tree)
parent 119b2030f70de9ed900ce3594201de6f869b71c8
Author: Michael Dusan <michael.dusan@gmail.com>
Date: Fri, 23 Feb 2024 12:08:14 -0500
std: re-enable most of setrlimit test on macos
- skip only RLIMIT_STACK test on macos
closes #18395
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
@@ -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;
}
@@ -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
//