You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Document LLVM version mismatch issue and solution in coverage README
Added comprehensive troubleshooting section explaining:
- Root cause: LLVM version mismatch between clang compiler and llvm-profdata tools
- Symptoms: All profraw files marked as corrupt/incomplete
- Solution: Use consistent LLVM version (e.g., clang-18) across compilation and processing
- Implementation details in GitHub Actions workflow
- Updated build phase and local usage sections with warnings about version specificity
This helps users understand why profraw files may appear corrupt and how to fix it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Copy file name to clipboardExpand all lines: contrib/coverage/README.md
+67-4Lines changed: 67 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,12 +29,14 @@ This approach provides accurate, detailed coverage information across the entire
29
29
When building with `--enable-coverage`, CLN binaries are instrumented with LLVM coverage tracking:
30
30
31
31
```bash
32
-
./configure --enable-coverage CC=clang
32
+
./configure --enable-coverage CC=clang-18
33
33
make
34
34
```
35
35
36
36
This adds instrumentation that writes `.profraw` files when binaries execute.
37
37
38
+
**⚠️ IMPORTANT:** Always specify the LLVM version explicitly (e.g., `clang-18`) rather than using `CC=clang`. This ensures compatibility with the same-version `llvm-profdata` tools used for processing. See [LLVM Version Mismatch](#profile-data-is-malformed-or-no-valid-profraw-files-found) for details.
39
+
38
40
### Collection Phase
39
41
40
42
During test execution, the `LLVM_PROFILE_FILE` environment variable controls where `.profraw` files are written:
@@ -346,10 +348,12 @@ export CLN_TEST_NAME=test_connect # Creates subdir per test
346
348
347
349
1.**Build with coverage:**
348
350
```bash
349
-
./configure --enable-coverage CC=clang
351
+
./configure --enable-coverage CC=clang-18
350
352
make
351
353
```
352
354
355
+
**Note:** Use `CC=clang-18` (or whatever LLVM version you have installed) to ensure compatibility with your `llvm-profdata` tools. See [LLVM Version Mismatch](#profile-data-is-malformed-or-no-valid-profraw-files-found) troubleshooting section.
356
+
353
357
2.**Set coverage environment:**
354
358
```bash
355
359
export CLN_COVERAGE_DIR=/tmp/cln-coverage
@@ -414,14 +418,73 @@ To see which tests cover which code:
414
418
415
419
**Solution:**`collect-coverage.sh` handles this automatically via batched merging
416
420
417
-
### "Profile data is malformed"
421
+
### "Profile data is malformed" or "No valid .profraw files found"
418
422
419
-
**Cause:** Corrupt or incomplete `.profraw` files (often from crashed tests)
423
+
**Cause 1:** Corrupt or incomplete `.profraw` files (often from crashed tests)
420
424
421
425
**Solutions:**
422
426
- Run `cleanup-corrupt-profraw.sh` to identify and remove corrupt files
423
427
-`collect-coverage.sh` automatically filters these out
424
428
429
+
**Cause 2 (CRITICAL):** LLVM version mismatch between compilation and processing
430
+
431
+
**Symptoms:**
432
+
- All `.profraw` files marked as "corrupt/incomplete"
433
+
-`llvm-profdata` validation fails on all files
434
+
- Error: "No valid .profraw files found (all N files were corrupt/incomplete)"
435
+
- Files are actually valid, but compiled with different LLVM version than processing tools
436
+
437
+
**Root Cause:**
438
+
The code is compiled with one version of `clang` (e.g., clang-14 from system apt), but processed with a different version of `llvm-profdata` tools (e.g., llvm-profdata-18). The profraw file format is version-specific and incompatible across major LLVM versions.
0 commit comments