@@ -190,7 +190,8 @@ const StepBuilder = struct {
190190pub fn build (b : * std.Build ) void {
191191 const target = b .standardTargetOptions (.{});
192192 const optimize = b .standardOptimizeOption (.{});
193- const coverage = b .option (bool , "coverage" , "Generate a coverage report with kcov" );
193+ const test_coverage = b .option (bool , "coverage" , "Generate a coverage report with kcov" );
194+ const test_focus_on_rule = b .option ([]const u8 , "test_focus_on_rule" , "Only run integration tests for this rule" );
194195
195196 const zlinter_lib_module = b .addModule ("zlinter" , .{
196197 .root_source_file = b .path ("src/lib/zlinter.zig" ),
@@ -216,7 +217,7 @@ pub fn build(b: *std.Build) void {
216217
217218 const unit_tests_exe = b .addTest (.{
218219 .root_module = zlinter_lib_module ,
219- .use_llvm = coverage ,
220+ .use_llvm = test_coverage ,
220221 });
221222
222223 // --------------------------------------------------------------------
@@ -263,6 +264,9 @@ pub fn build(b: *std.Build) void {
263264 install_coverage .step .dependOn (& merge_coverage .step );
264265
265266 const run_integration_tests = b .addSystemCommand (&.{ b .graph .zig_exe , "build" , "test" });
267+ if (test_focus_on_rule ) | r | {
268+ run_integration_tests .addArg (b .fmt ("-Dtest_focus_on_rule={s}" , .{r }));
269+ }
266270 run_integration_tests .setCwd (b .path ("./integration_tests" ));
267271 run_integration_tests .has_side_effects = true ;
268272
@@ -297,7 +301,7 @@ pub fn build(b: *std.Build) void {
297301 integration_check_step .dependOn (& run_integration_check .step );
298302
299303 const unit_test_step = b .step ("unit-test" , "Run unit tests" );
300- if (coverage orelse false ) {
304+ if (test_coverage orelse false ) {
301305 const cover_run = std .Build .Step .Run .create (b , "Unit test coverage" );
302306 cover_run .addArgs (&.{ kcov_bin , "--clean" , "--collect-only" });
303307 cover_run .addPrefixedDirectoryArg ("--include-pattern=" , b .path ("src" ));
@@ -314,10 +318,10 @@ pub fn build(b: *std.Build) void {
314318 const test_rule_exe = b .addTest (.{
315319 .name = b .fmt ("{s}_unit_test_coverage" , .{rule_import .name }),
316320 .root_module = rule_import .module ,
317- .use_llvm = coverage ,
321+ .use_llvm = test_coverage ,
318322 });
319323
320- if (coverage orelse false ) {
324+ if (test_coverage orelse false ) {
321325 const cover_run = std .Build .Step .Run .create (b , "Unit test coverage" );
322326 cover_run .addArgs (&.{ kcov_bin , "--clean" , "--collect-only" });
323327 cover_run .addPrefixedDirectoryArg ("--include-pattern=" , b .path ("src" ));
0 commit comments