diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-08-20 18:09:23 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-10-05 20:52:25 +0100 |
| commit | f60c045cef7bafdd3eac285f82d5a310daadaec5 (patch) | |
| tree | b63da4d5dcf209b86350015efa0694a43c57c590 /test | |
| parent | d23db9427b82d7dc798442accf34729c16e92f2d (diff) | |
| download | zig-f60c045cef7bafdd3eac285f82d5a310daadaec5.tar.gz zig-f60c045cef7bafdd3eac285f82d5a310daadaec5.zip | |
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/tests.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/tests.zig b/test/tests.zig index 1e98a48489..017f9478a9 100644 --- a/test/tests.zig +++ b/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); + } +} |
