@@ -173,6 +173,18 @@ def run_group_tests(args):
173173
174174 crates = groups [args .group ] or []
175175 failed = []
176+ coverage = getattr (args , "coverage" , False )
177+
178+ if coverage :
179+ github_output ("crate_flags" , "," .join (crates ))
180+ github_group_start ("Cleaning coverage state" )
181+ try :
182+ subprocess .run (["cargo" , "llvm-cov" , "clean" , "--workspace" ], check = True )
183+ except subprocess .CalledProcessError as e :
184+ github_error (f"Failed to clean coverage state: { e } " )
185+ return 1
186+ finally :
187+ github_group_end ()
176188
177189 for crate in crates :
178190 # Skip dash-fuzz on Windows
@@ -182,7 +194,10 @@ def run_group_tests(args):
182194
183195 github_group_start (f"Testing { crate } " )
184196
185- cmd = ["cargo" , "test" , "-p" , crate , "--all-features" ]
197+ if coverage :
198+ cmd = ["cargo" , "llvm-cov" , "--no-report" , "-p" , crate , "--all-features" ]
199+ else :
200+ cmd = ["cargo" , "test" , "-p" , crate , "--all-features" ]
186201 result = subprocess .run (cmd )
187202
188203 github_group_end ()
@@ -225,6 +240,11 @@ def main():
225240 run_group_parser = subparsers .add_parser ("run-group" , help = "Run tests for a group" )
226241 run_group_parser .add_argument ("group" , help = "Group name" )
227242 run_group_parser .add_argument ("--os" , default = "ubuntu-latest" , help = "OS name" )
243+ run_group_parser .add_argument (
244+ "--coverage" ,
245+ action = "store_true" ,
246+ help = "Use cargo-llvm-cov for coverage collection" ,
247+ )
228248
229249 args = parser .parse_args ()
230250
0 commit comments