Commit f60c045cef
Changed files (3)
test/tests.zig
@@ -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);
+ }
+}
tools/incr-check.zig
@@ -68,7 +68,9 @@ pub fn main() !void {
const debug_log_verbose = debug_zcu or debug_link;
for (case.targets) |target| {
- std.log.scoped(.status).info("target: '{s}-{s}'", .{ target.query, @tagName(target.backend) });
+ 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, &.{
build.zig
@@ -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 {