authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-09-13 17:40:42+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-09-30 13:44:54+01:00
loge9c0d43c5b6fc5065ac2e22e162b7d7476f5097d
tree6935edc5add7088088a8677a4812165d63275516
parent2fefe0e4b39ab6f86e5af423304b8a7b2da5fe72
signaturelock-open Commit is signed but in an unrecognized format.

test-error-traces: skip some more optimized traces


2 files changed, 23 insertions(+), 6 deletions(-)

test/error_traces.zig+19-6
...@@ -37,6 +37,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -37,6 +37,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
37 .disable_trace_optimized = &.{37 .disable_trace_optimized = &.{
38 .{ .x86_64, .windows },38 .{ .x86_64, .windows },
39 .{ .x86, .windows },39 .{ .x86, .windows },
40 .{ .x86_64, .macos },
41 .{ .aarch64, .macos },
40 },42 },
41 });43 });
42 cases.addCase(.{44 cases.addCase(.{
...@@ -86,12 +88,6 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -86,12 +88,6 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
86 \\ return error.UnrelatedError;88 \\ return error.UnrelatedError;
87 \\ ^89 \\ ^
88 ,90 ,
89 .disable_trace_optimized = &.{
90 .{ .x86_64, .linux },
91 .{ .x86, .linux },
92 .{ .x86_64, .windows },
93 .{ .x86, .windows },
94 },
95 });91 });
9692
97 cases.addCase(.{93 cases.addCase(.{
...@@ -121,6 +117,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -121,6 +117,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
121 .disable_trace_optimized = &.{117 .disable_trace_optimized = &.{
122 .{ .x86_64, .windows },118 .{ .x86_64, .windows },
123 .{ .x86, .windows },119 .{ .x86, .windows },
120 .{ .x86_64, .macos },
121 .{ .aarch64, .macos },
124 },122 },
125 });123 });
126124
...@@ -172,6 +170,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -172,6 +170,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
172 .disable_trace_optimized = &.{170 .disable_trace_optimized = &.{
173 .{ .x86_64, .windows },171 .{ .x86_64, .windows },
174 .{ .x86, .windows },172 .{ .x86, .windows },
173 .{ .x86_64, .macos },
174 .{ .aarch64, .macos },
175 },175 },
176 });176 });
177177
...@@ -242,6 +242,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -242,6 +242,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
242 .disable_trace_optimized = &.{242 .disable_trace_optimized = &.{
243 .{ .x86_64, .windows },243 .{ .x86_64, .windows },
244 .{ .x86, .windows },244 .{ .x86, .windows },
245 .{ .x86_64, .macos },
246 .{ .aarch64, .macos },
245 },247 },
246 });248 });
247249
...@@ -282,6 +284,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -282,6 +284,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
282 .disable_trace_optimized = &.{284 .disable_trace_optimized = &.{
283 .{ .x86_64, .windows },285 .{ .x86_64, .windows },
284 .{ .x86, .windows },286 .{ .x86, .windows },
287 .{ .x86_64, .macos },
288 .{ .aarch64, .macos },
285 },289 },
286 });290 });
287291
...@@ -317,6 +321,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -317,6 +321,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
317 .disable_trace_optimized = &.{321 .disable_trace_optimized = &.{
318 .{ .x86_64, .windows },322 .{ .x86_64, .windows },
319 .{ .x86, .windows },323 .{ .x86, .windows },
324 .{ .x86_64, .macos },
325 .{ .aarch64, .macos },
320 },326 },
321 });327 });
322328
...@@ -352,6 +358,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -352,6 +358,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
352 .disable_trace_optimized = &.{358 .disable_trace_optimized = &.{
353 .{ .x86_64, .windows },359 .{ .x86_64, .windows },
354 .{ .x86, .windows },360 .{ .x86, .windows },
361 .{ .x86_64, .macos },
362 .{ .aarch64, .macos },
355 },363 },
356 });364 });
357365
...@@ -392,6 +400,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -392,6 +400,8 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
392 .disable_trace_optimized = &.{400 .disable_trace_optimized = &.{
393 .{ .x86_64, .windows },401 .{ .x86_64, .windows },
394 .{ .x86, .windows },402 .{ .x86, .windows },
403 .{ .x86_64, .macos },
404 .{ .aarch64, .macos },
395 },405 },
396 });406 });
397407
...@@ -423,8 +433,11 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {...@@ -423,8 +433,11 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext) void {
423 .disable_trace_optimized = &.{433 .disable_trace_optimized = &.{
424 .{ .x86_64, .linux },434 .{ .x86_64, .linux },
425 .{ .x86, .linux },435 .{ .x86, .linux },
436 .{ .aarch64, .linux },
426 .{ .x86_64, .windows },437 .{ .x86_64, .windows },
427 .{ .x86, .windows },438 .{ .x86, .windows },
439 .{ .x86_64, .macos },
440 .{ .aarch64, .macos },
428 },441 },
429 });442 });
430}443}
test/src/ErrorTrace.zig+4
...@@ -13,6 +13,9 @@ pub const Case = struct {...@@ -13,6 +13,9 @@ pub const Case = struct {
13 /// On these arch/OS pairs we will not test the error trace on optimized LLVM builds because the13 /// On these arch/OS pairs we will not test the error trace on optimized LLVM builds because the
14 /// optimizations break the error trace. We will test the binary with error tracing disabled,14 /// optimizations break the error trace. We will test the binary with error tracing disabled,
15 /// just to ensure that the expected error is still returned from `main`.15 /// just to ensure that the expected error is still returned from `main`.
16 ///
17 /// LLVM ReleaseSmall builds always have the trace disabled regardless of this field, because it
18 /// seems that LLVM is particularly good at optimizing traces away in those.
16 disable_trace_optimized: []const DisableConfig = &.{},19 disable_trace_optimized: []const DisableConfig = &.{},
1720
18 pub const DisableConfig = struct { std.Target.Cpu.Arch, std.Target.Os.Tag };21 pub const DisableConfig = struct { std.Target.Cpu.Arch, std.Target.Os.Tag };
...@@ -58,6 +61,7 @@ fn addCaseConfig(...@@ -58,6 +61,7 @@ fn addCaseConfig(
58 const error_tracing: bool = tracing: {61 const error_tracing: bool = tracing: {
59 if (optimize == .Debug) break :tracing true;62 if (optimize == .Debug) break :tracing true;
60 if (backend != .llvm) break :tracing true;63 if (backend != .llvm) break :tracing true;
64 if (optimize == .ReleaseSmall) break :tracing false;
61 for (case.disable_trace_optimized) |disable| {65 for (case.disable_trace_optimized) |disable| {
62 const d_arch, const d_os = disable;66 const d_arch, const d_os = disable;
63 if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) {67 if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) {