mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI. This commit also includes some enhancements to the `incr-check` tool to make this work correctly.
This commit is contained in:
parent
d23db9427b
commit
f60c045cef
@ -577,6 +577,10 @@ pub fn build(b: *std.Build) !void {
|
||||
} else {
|
||||
update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step);
|
||||
}
|
||||
|
||||
const test_incremental_step = b.step("test-incremental", "Run the incremental compilation test cases");
|
||||
try tests.addIncrementalTests(b, test_incremental_step);
|
||||
test_step.dependOn(test_incremental_step);
|
||||
}
|
||||
|
||||
fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
|
||||
|
||||
@ -1509,3 +1509,31 @@ pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step
|
||||
});
|
||||
return step;
|
||||
}
|
||||
|
||||
pub fn addIncrementalTests(b: *std.Build, test_step: *Step) !void {
|
||||
const incr_check = b.addExecutable(.{
|
||||
.name = "incr-check",
|
||||
.root_source_file = b.path("tools/incr-check.zig"),
|
||||
.target = b.graph.host,
|
||||
.optimize = .Debug,
|
||||
});
|
||||
|
||||
var dir = try b.build_root.handle.openDir("test/incremental", .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
var it = try dir.walk(b.graph.arena);
|
||||
while (try it.next()) |entry| {
|
||||
if (entry.kind != .file) continue;
|
||||
|
||||
const run = b.addRunArtifact(incr_check);
|
||||
run.setName(b.fmt("incr-check '{s}'", .{entry.basename}));
|
||||
|
||||
run.addArg(b.graph.zig_exe);
|
||||
run.addFileArg(b.path("test/incremental/").path(b, entry.path));
|
||||
run.addArgs(&.{ "--zig-lib-dir", b.fmt("{}", .{b.graph.zig_lib_directory}) });
|
||||
|
||||
run.addCheck(.{ .expect_term = .{ .Exited = 0 } });
|
||||
|
||||
test_step.dependOn(&run.step);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,9 @@ pub fn main() !void {
|
||||
const debug_log_verbose = debug_zcu or debug_link;
|
||||
|
||||
for (case.targets) |target| {
|
||||
if (debug_log_verbose) {
|
||||
std.log.scoped(.status).info("target: '{s}-{s}'", .{ target.query, @tagName(target.backend) });
|
||||
}
|
||||
|
||||
var child_args: std.ArrayListUnmanaged([]const u8) = .empty;
|
||||
try child_args.appendSlice(arena, &.{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user