authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-11 03:05:44+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-11 03:07:45+01:00
loge8a6e58f9d02657415ea2bb65364f38c9c6558cc
tree4d00967324d1df9001d5979907b4ecf293c29f34
parent9acfd167fa80e14b7beb1eb29830cb0c7d50e586
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.process: fix some page size assumptions in lockMemory/protectMemory tests

Makes the tests work on hexagon and loongarch.

1 files changed, 6 insertions(+), 7 deletions(-)

lib/std/process.zig+6-7
......@@ -1066,10 +1066,11 @@ pub fn protectMemory(
10661066 return error.UnsupportedOperation;
10671067}
10681068
1069var test_page: [std.heap.page_size_max]u8 align(std.heap.page_size_max) = undefined;
1070
10691071test lockMemory {
1070 var page: [std.heap.page_size_min]u8 align(std.heap.page_size_min) = undefined;
1071 lockMemory(&page, .{}) catch return error.SkipZigTest;
1072 unlockMemory(&page) catch return error.SkipZigTest;
1072 lockMemory(&test_page, .{}) catch return error.SkipZigTest;
1073 unlockMemory(&test_page) catch return error.SkipZigTest;
10731074}
10741075
10751076test lockMemoryAll {
......@@ -1078,8 +1079,6 @@ test lockMemoryAll {
10781079}
10791080
10801081test protectMemory {
1081 if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; // TODO
1082 var page: [std.heap.page_size_min]u8 align(std.heap.page_size_min) = undefined;
1083 protectMemory(&page, .{}) catch return error.SkipZigTest;
1084 protectMemory(&page, .{ .read = true, .write = true }) catch return error.SkipZigTest;
1082 protectMemory(&test_page, .{}) catch return error.SkipZigTest;
1083 protectMemory(&test_page, .{ .read = true, .write = true }) catch return error.SkipZigTest;
10851084}