test-stack-traces: migrate from deprecated std.Build APIs

This commit is contained in:
mlugg 2024-12-16 15:20:39 +00:00 committed by Eric Joldasov
parent 6d4e2a9171
commit 11b9933970
No known key found for this signature in database
GPG Key ID: 5C9C69060686B588

View File

@ -44,9 +44,9 @@ fn addExpect(
for (mode_config.exclude_os) |tag| if (tag == builtin.os.tag) return;
const b = self.b;
const annotated_case_name = fmt.allocPrint(b.allocator, "check {s} ({s})", .{
const annotated_case_name = b.fmt("check {s} ({s})", .{
name, @tagName(optimize_mode),
}) catch @panic("OOM");
});
for (self.test_filters) |test_filter| {
if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
} else if (self.test_filters.len > 0) return;
@ -55,10 +55,12 @@ fn addExpect(
const source_zig = write_files.add("source.zig", source);
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = source_zig,
.optimize = optimize_mode,
.target = b.graph.host,
.error_tracing = mode_config.error_tracing,
.root_module = b.createModule(.{
.root_source_file = source_zig,
.optimize = optimize_mode,
.target = b.graph.host,
.error_tracing = mode_config.error_tracing,
}),
});
const run = b.addRunArtifact(exe);
@ -83,5 +85,4 @@ const std = @import("std");
const builtin = @import("builtin");
const Step = std.Build.Step;
const OptimizeMode = std.builtin.OptimizeMode;
const fmt = std.fmt;
const mem = std.mem;