From e9c0d43c5b6fc5065ac2e22e162b7d7476f5097d Mon Sep 17 00:00:00 2001 From: mlugg Date: Sat, 13 Sep 2025 17:40:42 +0100 Subject: [PATCH] test-error-traces: skip some more optimized traces --- test/error_traces.zig | 25 +++++++++++++++++++------ test/src/ErrorTrace.zig | 4 ++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/test/error_traces.zig b/test/error_traces.zig index ea84f14ce5..d30a1b6e58 100644 --- a/test/error_traces.zig +++ b/test/error_traces.zig @@ -37,6 +37,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); cases.addCase(.{ @@ -86,12 +88,6 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { \\ return error.UnrelatedError; \\ ^ , - .disable_trace_optimized = &.{ - .{ .x86_64, .linux }, - .{ .x86, .linux }, - .{ .x86_64, .windows }, - .{ .x86, .windows }, - }, }); cases.addCase(.{ @@ -121,6 +117,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -172,6 +170,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -242,6 +242,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -282,6 +284,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -317,6 +321,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -352,6 +358,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -392,6 +400,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); @@ -423,8 +433,11 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void { .disable_trace_optimized = &.{ .{ .x86_64, .linux }, .{ .x86, .linux }, + .{ .aarch64, .linux }, .{ .x86_64, .windows }, .{ .x86, .windows }, + .{ .x86_64, .macos }, + .{ .aarch64, .macos }, }, }); } diff --git a/test/src/ErrorTrace.zig b/test/src/ErrorTrace.zig index ca726eaea3..d8ff380332 100644 --- a/test/src/ErrorTrace.zig +++ b/test/src/ErrorTrace.zig @@ -13,6 +13,9 @@ pub const Case = struct { /// On these arch/OS pairs we will not test the error trace on optimized LLVM builds because the /// optimizations break the error trace. We will test the binary with error tracing disabled, /// just to ensure that the expected error is still returned from `main`. + /// + /// LLVM ReleaseSmall builds always have the trace disabled regardless of this field, because it + /// seems that LLVM is particularly good at optimizing traces away in those. disable_trace_optimized: []const DisableConfig = &.{}, pub const DisableConfig = struct { std.Target.Cpu.Arch, std.Target.Os.Tag }; @@ -58,6 +61,7 @@ fn addCaseConfig( const error_tracing: bool = tracing: { if (optimize == .Debug) break :tracing true; if (backend != .llvm) break :tracing true; + if (optimize == .ReleaseSmall) break :tracing false; for (case.disable_trace_optimized) |disable| { const d_arch, const d_os = disable; if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) {