chore: configure kcov for test coverage
This commit is contained in:
parent
517eae1481
commit
d4546d58be
9 changed files with 20 additions and 2 deletions
18
build.zig
18
build.zig
|
|
@ -1,6 +1,8 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const use_llvm = true;
|
||||
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const mod = b.addModule("ink", .{
|
||||
|
|
@ -32,13 +34,29 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const mod_tests = b.addTest(.{
|
||||
.root_module = mod,
|
||||
.use_llvm = use_llvm,
|
||||
.use_lld = use_llvm,
|
||||
});
|
||||
const run_mod_tests = b.addRunArtifact(mod_tests);
|
||||
|
||||
const exe_tests = b.addTest(.{
|
||||
.root_module = exe.root_module,
|
||||
.use_llvm = use_llvm,
|
||||
.use_lld = use_llvm,
|
||||
});
|
||||
const run_exe_tests = b.addRunArtifact(exe_tests);
|
||||
|
||||
const test_step = b.step("test", "Run tests");
|
||||
test_step.dependOn(&run_mod_tests.step);
|
||||
test_step.dependOn(&run_exe_tests.step);
|
||||
|
||||
const run_cover = b.addSystemCommand(&.{
|
||||
"kcov",
|
||||
"--clean",
|
||||
"--include-pattern=src/",
|
||||
b.pathJoin(&.{ b.install_path, "cover" }),
|
||||
});
|
||||
run_cover.addArtifactArg(mod_tests);
|
||||
const cover_step = b.step("cover", "Generate test coverage report");
|
||||
cover_step.dependOn(&run_cover.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const std = @import("std");
|
||||
const fatal = std.process.fatal;
|
||||
const ink = @import("root.zig");
|
||||
const ink = @import("../root.zig");
|
||||
|
||||
const Options = struct {
|
||||
input_reader: *std.Io.Reader,
|
||||
|
|
@ -6,5 +6,5 @@ test {
|
|||
_ = tokenizer;
|
||||
_ = Ast;
|
||||
_ = Story;
|
||||
_ = @import("runtime_tests.zig");
|
||||
_ = @import("Story/runtime_tests.zig");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue