diff --git a/build.zig b/build.zig index 25e37ed..9679584 100644 --- a/build.zig +++ b/build.zig @@ -29,12 +29,16 @@ pub fn build(b: *std.Build) void { b.step("unit", "Run the unit tests").dependOn(&b.addRunArtifact(unit).step); // The shell suite of the old implementation, run against this binary. + // It and the differential run below run in the build root: their script + // paths are relative, and zig build may be started in a subdirectory. const suite = b.addSystemCommand(&.{ "bash", "-c", "TOOL_BIN=\"$0\" exec bash tests/test_eb_keep_logs.sh" }); suite.addArtifactArg(exe); + suite.setCwd(b.path(".")); suite.expectExitCode(0); // The same invocations through the shell implementation and this one. const diff = b.addSystemCommand(&.{ "bash", "-c", "TOOL_BIN=\"$0\" exec bash tests/differential.sh" }); diff.addArtifactArg(exe); + diff.setCwd(b.path(".")); diff.expectExitCode(0); const test_step = b.step("test", "Run the unit tests, the command-line suite and the differential run"); diff --git a/changelog.d/+suite-cwd.misc.md b/changelog.d/+suite-cwd.misc.md new file mode 100644 index 0000000..56811be --- /dev/null +++ b/changelog.d/+suite-cwd.misc.md @@ -0,0 +1 @@ +`zig build test` passes when started in a subdirectory such as `src/`: the command-line suite and the differential run start their scripts from the build root instead of from where `zig build` was started, where bash stopped with `tests/test_eb_keep_logs.sh: No such file or directory`.