Skip to content

Commit 36bdef9

Browse files
committed
update test script to improve .profraw file discovery and error resilience; adjust CI workflow for installation and updated coverage paths
1 parent bb9e3d9 commit 36bdef9

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

.github/workflows/ubuntu.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,13 @@ jobs:
349349
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
350350
-D CMAKE_BUILD_TYPE=RELEASE
351351
-D CMAKE_VERBOSE_MAKEFILE=ON -D USE_COVERAGE=ON
352+
-D CMAKE_INSTALL_PREFIX=install
352353
- name: Build project
353354
run: |
354355
cmake --build build --parallel
356+
- name: Install project
357+
run: |
358+
cmake --build build --target install
355359
- name: Run tests and generate coverage
356360
run: >
357361
python3 scripts/run_tests.py --running-type=processes_coverage
@@ -366,13 +370,13 @@ jobs:
366370
- name: Upload coverage reports to Codecov
367371
uses: codecov/[email protected]
368372
with:
369-
files: build/coverage/coverage.lcov
373+
files: install/coverage/coverage.lcov
370374
- name: Upload coverage report artifact
371375
id: upload-cov
372376
uses: actions/upload-artifact@v4
373377
with:
374378
name: cov-report
375-
path: 'build/coverage/html'
379+
path: 'install/coverage/html'
376380
- name: Comment coverage report link
377381
# TODO: Support PRs from forks and handle cases with insufficient write permissions
378382
continue-on-error: true

scripts/run_tests.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,27 @@ def generate_coverage(self, llvm_version="20"):
208208
output_dir = build_dir / "coverage"
209209
output_dir.mkdir(exist_ok=True)
210210

211+
print(f"Looking for .profraw files in: {build_dir}")
212+
print(f"Current working directory: {os.getcwd()}")
213+
211214
# Find all .profraw files
212-
profraw_files = list(build_dir.glob("**/*.profraw"))
215+
# First look in current directory (where tests are run)
216+
cwd = Path.cwd()
217+
profraw_files = list(cwd.glob("*.profraw"))
218+
# Also look in build directory if different
219+
if cwd != build_dir:
220+
profraw_files.extend(list(build_dir.glob("*.profraw")))
221+
# Look recursively if still nothing found
222+
if not profraw_files:
223+
profraw_files = list(build_dir.glob("**/*.profraw"))
213224
if not profraw_files:
214225
raise Exception(
215226
"No .profraw files found. Make sure to run tests with LLVM_PROFILE_FILE set."
216227
)
217228

218229
print(f"Found {len(profraw_files)} .profraw files")
230+
for f in profraw_files[:5]: # Show first 5 files
231+
print(f" - {f}")
219232

220233
# Merge profiles
221234
profdata_file = output_dir / "coverage.profdata"
@@ -328,8 +341,15 @@ def _execute(args_dict, env):
328341
runner.run_processes(args_dict["additional_mpi_args"])
329342
elif args_dict["running_type"] == "processes_coverage":
330343
# Run both threads and processes tests, then generate coverage
331-
runner.run_threads()
332-
runner.run_processes(args_dict["additional_mpi_args"])
344+
# Continue even if tests fail to generate coverage report
345+
try:
346+
runner.run_threads()
347+
except Exception as e:
348+
print(f"Warning: Thread tests failed: {e}")
349+
try:
350+
runner.run_processes(args_dict["additional_mpi_args"])
351+
except Exception as e:
352+
print(f"Warning: Process tests failed: {e}")
333353
# Generate coverage report
334354
runner.generate_coverage(args_dict.get("llvm_version", "20"))
335355
elif args_dict["running_type"] == "performance":

0 commit comments

Comments
 (0)