commit e8a6e58f9d02657415ea2bb65364f38c9c6558cc (tree)
parent 9acfd167fa80e14b7beb1eb29830cb0c7d50e586
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Sun, 11 Jan 2026 03:05:44 +0100
std.process: fix some page size assumptions in lockMemory/protectMemory tests
Makes the tests work on hexagon and loongarch.
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/std/process.zig b/lib/std/process.zig
@@ -1066,10 +1066,11 @@ pub fn protectMemory(
return error.UnsupportedOperation;
}
+var test_page: [std.heap.page_size_max]u8 align(std.heap.page_size_max) = undefined;
+
test lockMemory {
- var page: [std.heap.page_size_min]u8 align(std.heap.page_size_min) = undefined;
- lockMemory(&page, .{}) catch return error.SkipZigTest;
- unlockMemory(&page) catch return error.SkipZigTest;
+ lockMemory(&test_page, .{}) catch return error.SkipZigTest;
+ unlockMemory(&test_page) catch return error.SkipZigTest;
}
test lockMemoryAll {
@@ -1078,8 +1079,6 @@ test lockMemoryAll {
}
test protectMemory {
- if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; // TODO
- var page: [std.heap.page_size_min]u8 align(std.heap.page_size_min) = undefined;
- protectMemory(&page, .{}) catch return error.SkipZigTest;
- protectMemory(&page, .{ .read = true, .write = true }) catch return error.SkipZigTest;
+ protectMemory(&test_page, .{}) catch return error.SkipZigTest;
+ protectMemory(&test_page, .{ .read = true, .write = true }) catch return error.SkipZigTest;
}