Commit e9c0d43c5b
Changed files (2)
test
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) {
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 },
},
});
}