coverage: restore the scripts .gitignore swallowed - #9486
Open
cdecker wants to merge 4 commits into
Open
Conversation
The entry is unanchored, so it matches contrib/coverage/ as well as the coverage/ build output directory it was meant for. That is how 4b9cffe came to add the coverage documentation, the Makefile targets, the pyln-testing plumbing and the nightly workflow while silently leaving the scripts they all call out of the commit. Changelog-None Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGKo3ccLpkH2xFeEXUzEBK
None of these are new: 4b9cffe wrote the documentation and the callers for them, but .gitignore swallowed the directory itself, so master ships a coverage feature whose every entry point is a missing file. - Makefile's coverage-clang-collect and coverage-clang-report call collect-coverage.sh and generate-coverage-report.sh - .github/workflows/coverage-nightly.yaml calls the same two, and has failed at "Merge coverage data" every night since - doc/COVERAGE.md documents those two plus per-test-coverage.sh, per-test-coverage-html.sh and cleanup-corrupt-profraw.sh - doc/contribute-to-core-lightning/contributor-workflow.md points at clang-coverage-report.sh, which the same commit deleted from contrib/ after re-pointing the doc at contrib/coverage/ The files are restored unmodified; clang-coverage-report.sh is byte-identical to the one removed from contrib/. Changelog-None Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGKo3ccLpkH2xFeEXUzEBK
llvm-cov can emit lcov from the profile and binary list the script has already assembled, so this costs one more invocation and gives the report a machine-readable form. The nightly needs it: it currently hands Codecov coverage/merged.profdata, which Codecov cannot parse. It is also what GitLab's coverage visualization wants, via lcov_cobertura. Paths are rewritten relative to the repository root, since both consumers match the report against the repository tree. Changelog-None Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGKo3ccLpkH2xFeEXUzEBK
Three things stand between the restored scripts and a nightly that finishes: pyln-testing sets CLN_TEST_NAME for every test, so the profiles land in $CLN_COVERAGE_DIR/<test-name>/ and never directly in $CLN_COVERAGE_DIR. The coverage-raw/*.profraw upload glob therefore matches nothing, under if-no-files-found: error. A local three-test run produced 515 profiles, all of them in subdirectories. Both jobs now hand the directory to collect-coverage.sh, which walks it and drops what crashed tests left half-written; that also retires the flattening cp, which could collide on <pid>-<signature>.profraw between matrix cells. The build uses the runner's default clang while the report job installed LLVM 18 and symlinked llvm-profdata to it. There are no compatibility guarantees for the raw profile format across LLVM releases, so the two have to come from the same one. Codecov cannot read a .profdata; it gets the lcov export instead. Changelog-None Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGKo3ccLpkH2xFeEXUzEBK
cdecker
force-pushed
the
2026w37-restore-coverage-scripts
branch
from
September 8, 2026 19:52
7023e0c to
a4b5738
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
4b9cffe183landed the coverage documentation, thecoverage-clang-*Makefiletargets, the
LLVM_PROFILE_FILEplumbing inpyln-testingand the nightlyworkflow — but not
contrib/coverage/itself. The reason is.gitignore:That entry is unanchored, so it matches
contrib/coverage/just as well as thecoverage/build output directory it was meant for, andgit addskipped thewhole directory without a word. First commit anchors it to
/coverage.Everything that calls those scripts is broken on
mastertoday:Makefilecoverage-clang-collect/coverage-clang-report.github/workflows/coverage-nightly.yaml— the nightly fails at"Merge coverage data" every night
doc/COVERAGE.md, which additionally documentsper-test-coverage.sh,per-test-coverage-html.shandcleanup-corrupt-profraw.shdoc/contribute-to-core-lightning/contributor-workflow.md, which points atcontrib/coverage/clang-coverage-report.sh— the same commit deletedcontrib/clang-coverage-report.shand re-pointed the doc at the new pathSo the second commit restores all six, unmodified: two of them are the files
reviewed in #8885, and
clang-coverage-report.shis byte-identical to the one4b9cffe183removed fromcontrib/.The rest of the series fixes the three things that break the nightly after
the scripts exist:
generate-coverage-report.shgains onellvm-cov export -format=lcovwritingcoverage/coverage.lcovbeside theHTML report and the summary; the profile and binary list are already built
there. The nightly currently hands Codecov
coverage/merged.profdata, whichCodecov cannot parse — it now gets the lcov.
pyln-testingsetsCLN_TEST_NAMEfor every test, soprofiles land in
$CLN_COVERAGE_DIR/<test-name>/, never directly in$CLN_COVERAGE_DIR. Thecoverage-raw/*.profrawupload glob thereforematches nothing, under
if-no-files-found: error. Both jobs now hand thedirectory to
collect-coverage.sh, which already walks it and drops theprofiles that crashed tests left half-written. That also removes the
flattening
cp, which could collide on<pid>-<signature>.profrawbetweenmatrix cells.
clangwhile thereport job installed LLVM 18 and symlinked
llvm-profdatato it. Theclang docs are explicit that "there are no backwards or forwards
compatibility guarantees for the raw profile format", so the two have to come
from the same release — the distro default in both cases.
Verified locally
./configure --enable-debugbuild --enable-coverage CC=clang && make, then athree-test
pytestrun withCLN_COVERAGE_DIRset, thenmake coverage-clang.The run produced 515 profiles, all of them under per-test subdirectories and
none at the top level, confirming the glob above. clang 14 with matching
llvm-profdata 14.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HGKo3ccLpkH2xFeEXUzEBK