| author | |
| committer | |
| log | f60c045cef7bafdd3eac285f82d5a310daadaec5 |
| tree | b63da4d5dcf209b86350015efa0694a43c57c590 |
| parent | d23db9427b82d7dc798442accf34729c16e92f2d |
| signature |
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.3 files changed, 35 insertions(+), 1 deletions(-)
build.zig+4| ... | @@ -577,6 +577,10 @@ pub fn build(b: *std.Build) !void { | ... | @@ -577,6 +577,10 @@ pub fn build(b: *std.Build) !void { |
| 577 | } else { | 577 | } else { |
| 578 | update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step); | 578 | update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step); |
| 579 | } | 579 | } |
| 580 | |||
| 581 | const test_incremental_step = b.step("test-incremental", "Run the incremental compilation test cases"); | ||
| 582 | try tests.addIncrementalTests(b, test_incremental_step); | ||
| 583 | test_step.dependOn(test_incremental_step); | ||
| 580 | } | 584 | } |
| 581 | 585 | ||
| 582 | fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { | 586 | fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { |
test/tests.zig+28| ... | @@ -1509,3 +1509,31 @@ pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step | ... | @@ -1509,3 +1509,31 @@ pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step |
| 1509 | }); | 1509 | }); |
| 1510 | return step; | 1510 | return step; |
| 1511 | } | 1511 | } |
| 1512 | |||
| 1513 | pub fn addIncrementalTests(b: *std.Build, test_step: *Step) !void { | ||
| 1514 | const incr_check = b.addExecutable(.{ | ||
| 1515 | .name = "incr-check", | ||
| 1516 | .root_source_file = b.path("tools/incr-check.zig"), | ||
| 1517 | .target = b.graph.host, | ||
| 1518 | .optimize = .Debug, | ||
| 1519 | }); | ||
| 1520 | |||
| 1521 | var dir = try b.build_root.handle.openDir("test/incremental", .{ .iterate = true }); | ||
| 1522 | defer dir.close(); | ||
| 1523 | |||
| 1524 | var it = try dir.walk(b.graph.arena); | ||
| 1525 | while (try it.next()) |entry| { | ||
| 1526 | if (entry.kind != .file) continue; | ||
| 1527 | |||
| 1528 | const run = b.addRunArtifact(incr_check); | ||
| 1529 | run.setName(b.fmt("incr-check '{s}'", .{entry.basename})); | ||
| 1530 | |||
| 1531 | run.addArg(b.graph.zig_exe); | ||
| 1532 | run.addFileArg(b.path("test/incremental/").path(b, entry.path)); | ||
| 1533 | run.addArgs(&.{ "--zig-lib-dir", b.fmt("{}", .{b.graph.zig_lib_directory}) }); | ||
| 1534 | |||
| 1535 | run.addCheck(.{ .expect_term = .{ .Exited = 0 } }); | ||
| 1536 | |||
| 1537 | test_step.dependOn(&run.step); | ||
| 1538 | } | ||
| 1539 | } |
tools/incr-check.zig+3-1| ... | @@ -68,7 +68,9 @@ pub fn main() !void { | ... | @@ -68,7 +68,9 @@ pub fn main() !void { |
| 68 | const debug_log_verbose = debug_zcu or debug_link; | 68 | const debug_log_verbose = debug_zcu or debug_link; |
| 69 | 69 | ||
| 70 | for (case.targets) |target| { | 70 | for (case.targets) |target| { |
| 71 | std.log.scoped(.status).info("target: '{s}-{s}'", .{ target.query, @tagName(target.backend) }); | 71 | if (debug_log_verbose) { |
| 72 | std.log.scoped(.status).info("target: '{s}-{s}'", .{ target.query, @tagName(target.backend) }); | ||
| 73 | } | ||
| 72 | 74 | ||
| 73 | var child_args: std.ArrayListUnmanaged([]const u8) = .empty; | 75 | var child_args: std.ArrayListUnmanaged([]const u8) = .empty; |
| 74 | try child_args.appendSlice(arena, &.{ | 76 | try child_args.appendSlice(arena, &.{ |