Skip to content

Commit f52533d

Browse files
committed
update test script: extend coverage generation to include libraries alongside executables
1 parent e810acf commit f52533d

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

scripts/run_tests.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,32 @@ def generate_coverage(self, llvm_version="20"):
243243
if result.returncode != 0:
244244
raise Exception("Failed to merge coverage profiles")
245245

246-
# Find executables
247-
executables = []
246+
# Find executables and libraries with coverage
247+
objects = []
248+
249+
# Add all executables from bin directory
248250
for f in self.work_dir.iterdir():
249251
if f.is_file() and os.access(f, os.X_OK) and not f.suffix == ".txt":
250-
executables.append(str(f))
251-
252-
if not executables:
253-
raise Exception("No executables found in bin directory")
254-
255-
print(f"Found {len(executables)} executables")
252+
objects.append(str(f))
253+
254+
# Add all static libraries from arch directory
255+
arch_dir = build_dir / "arch"
256+
if arch_dir.exists():
257+
for f in arch_dir.glob("*.a"):
258+
objects.append(str(f))
259+
260+
# Add all shared libraries from lib directory
261+
lib_dir = build_dir / "lib"
262+
if lib_dir.exists():
263+
for f in lib_dir.glob("*.so"):
264+
objects.append(str(f))
265+
for f in lib_dir.glob("*.dylib"):
266+
objects.append(str(f))
267+
268+
if not objects:
269+
raise Exception("No executables or libraries found")
270+
271+
print(f"Found {len(objects)} executables and libraries")
256272

257273
# Get project root
258274
project_root = build_dir.parent
@@ -261,7 +277,7 @@ def generate_coverage(self, llvm_version="20"):
261277
lcov_file = output_dir / "coverage.lcov"
262278
cmd = (
263279
[llvm_cov, "export"]
264-
+ executables
280+
+ objects
265281
+ [
266282
"--format=lcov",
267283
"--ignore-filename-regex=.*3rdparty/.*|/usr/.*|.*tasks/.*/tests/.*|"
@@ -292,7 +308,7 @@ def generate_coverage(self, llvm_version="20"):
292308
html_dir = output_dir / "html"
293309
cmd = (
294310
[llvm_cov, "show"]
295-
+ executables
311+
+ objects
296312
+ [
297313
"--format=html",
298314
f"--output-dir={html_dir}",
@@ -315,7 +331,7 @@ def generate_coverage(self, llvm_version="20"):
315331
# Generate summary
316332
cmd = (
317333
[llvm_cov, "report"]
318-
+ executables
334+
+ objects
319335
+ [
320336
f"--instr-profile={profdata_file}",
321337
"--ignore-filename-regex=.*3rdparty/.*|/usr/.*|.*tasks/.*/tests/.*|"

0 commit comments

Comments
 (0)