From e8a6e58f9d02657415ea2bb65364f38c9c6558cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sun, 11 Jan 2026 03:05:44 +0100 Subject: [PATCH] std.process: fix some page size assumptions in lockMemory/protectMemory tests Makes the tests work on hexagon and loongarch. --- lib/std/process.zig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/std/process.zig b/lib/std/process.zig index 8a3d20f776..64badc1cba 100644 --- 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; }