authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-30 18:50:38+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-01 03:25:13+02:00
logf049ae6d57341b4abd64fb6e65b6f9a05af1c226
treeae351f9deaa6f39f5ce208ad920fa0875db7e08a
parente5ebdf9e4199abc347c72d0ff00e211e858a200c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

libc-test: set a 1.6G max_rss for each test case

1.4G was the highest value I observed for any test case on x86_64-linux. This change should prevent OOM conditions in CI.

2 files changed, 5 insertions(+), 0 deletions(-)

build.zig+2
...@@ -609,6 +609,8 @@ pub fn build(b: *std.Build) !void {...@@ -609,6 +609,8 @@ pub fn build(b: *std.Build) !void {
609 .optimize_modes = optimization_modes,609 .optimize_modes = optimization_modes,
610 .test_filters = test_filters,610 .test_filters = test_filters,
611 .test_target_filters = test_target_filters,611 .test_target_filters = test_target_filters,
612 // Highest RSS observed in any test case was exactly 1465151488 on x86_64-linux CI.
613 .max_rss = 1758181785,
612 })) |test_libc_step| test_step.dependOn(test_libc_step);614 })) |test_libc_step| test_step.dependOn(test_libc_step);
613}615}
614616
test/src/Libc.zig+3
...@@ -10,6 +10,7 @@ pub const Options = struct {...@@ -10,6 +10,7 @@ pub const Options = struct {
10 optimize_modes: []const std.builtin.OptimizeMode,10 optimize_modes: []const std.builtin.OptimizeMode,
11 test_filters: []const []const u8,11 test_filters: []const []const u8,
12 test_target_filters: []const []const u8,12 test_target_filters: []const []const u8,
13 max_rss: usize,
13};14};
1415
15const TestCase = struct {16const TestCase = struct {
...@@ -100,6 +101,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {...@@ -100,6 +101,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
100 const exe = libc.b.addExecutable(.{101 const exe = libc.b.addExecutable(.{
101 .name = test_case.name,102 .name = test_case.name,
102 .root_module = mod,103 .root_module = mod,
104 .max_rss = libc.options.max_rss,
103 });105 });
104106
105 const run = libc.b.addRunArtifact(exe);107 const run = libc.b.addRunArtifact(exe);
...@@ -108,6 +110,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {...@@ -108,6 +110,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
108 run.expectStdErrEqual("");110 run.expectStdErrEqual("");
109 run.expectStdOutEqual("");111 run.expectStdOutEqual("");
110 run.expectExitCode(0);112 run.expectExitCode(0);
113 run.step.max_rss = libc.options.max_rss;
111114
112 libc.root_step.dependOn(&run.step);115 libc.root_step.dependOn(&run.step);
113 }116 }