Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the error that Zig build system does not fail when a test fails #15078

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/init-exe/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
const exe_tests_run = b.addRunArtifact(exe_tests);

// Similar to creating the run step earlier, this exposes a `test` step to
// the `zig build --help` menu, providing a way for the user to request
// running the unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step);
test_step.dependOn(&exe_tests_run.step);
}
3 changes: 2 additions & 1 deletion lib/init-lib/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
const main_tests_run = b.addRunArtifact(main_tests);

// This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build test`
// This will evaluate the `test` step rather than the default, which is "install".
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
test_step.dependOn(&main_tests_run.step);
}