Repository navigation
PROF-16533: Merged test coverage across CI-tested Linux platforms and JVMs - #948
zhengyu123 wants to merge 25 commits into
Conversation
Run :ddprof-lib:coverageReport for each CI-tested libc/arch/JVM cell in a container and merge the results into one C++ and one Java report. - run-containers-tests.sh: --coverage-out=DIR runs the coverage report for one cell and exports reports, JaCoCo data, classes and cell.properties; clone mode works from a git worktree - coverageReport also writes a gcovr JSON tracefile - merge-coverage.sh merges cells built from one commit - hermetic tests for both scripts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Coverage test tasks do not fail on an empty -Ptests match, so a filter that matches only slow or only regular tests still reaches the reports - run-containers-tests.sh labels each JDK image with its base image ID and rebuilds it when the base image changed - test-coverage skill: memory preflight caps parallel cells at one per 8 GB, checks base images for gcovr, and counts a killed Gradle daemon as blocked instead of failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --coverage-out replaces the previous export, records the -Ptests filter, exits 70 when Gradle passed but the export failed, rejects an empty directory and creates it only for an accepted run - --rebuild-base again forces the JDK image rebuild - merge-coverage.sh replaces --out, rejects cells without a commit, marks per cell whether it is in the C++ and Java reports, flags filtered runs and checks the downloaded JaCoCo CLI against a pinned SHA-256 - tests run the container command with a stub Gradle and cover the new merge and image-reuse branches - test-coverage skill clears a cell before each attempt, checks RUN against colima's $HOME share, and reports cells missing from a report Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --coverage-out clears the previous export on the host before the run, so a run that dies before the export leaves no stale data, and rejects --tests patterns that would break the spliced container command - merge-coverage.sh refuses an --out that is not empty or an earlier merge, and marks a cell in the Java column only when it contributed .exec files to a report that was written - test-coverage skill: the $HOME check covers podman machine too, and the merge snippet sets the worktree it uses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- run-containers-tests.sh accepts only letters, digits and _ . * # , - in --tests, in every mode: the pattern is spliced unquoted into the host-side eval and the container shell, so other characters could run commands on the host or inject cell.properties keys - the host-side clearing of a previous export is best effort; with a rootful runtime the in-container export clears root-owned files - merge-coverage.sh marks its output directory, so a merge that failed midway can be rerun into the same --out, and links a report in summary.md only when it was written Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Scan-Build Report
Bug Summary
Filter Results by FileReports
|
|||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a545ac893
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Two of the most critical issues are a Git mount/clone path overlap that causes every worktree coverage cell to fail before testing, and an unescaped eval of the coverage output path that allows shell injection and silently redirects exports to the wrong location. A separate gcovr version mismatch between the preflight-checked host and the unpinned container image can abort coverage merging after the full matrix completes.
🤖 Bits Code Review · Commit 9a545ac
CI Test ResultsRun: #43103255998 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 32 | Failed: 0 Updated: 2026-11-12 14:26:00 UTC |
- run-containers-tests.sh: shell-escape mount paths with %q; reject a worktree git dir that overlaps a container path - ddprof-test: fail -Ptests runs where neither coverage task matched a test - merge-coverage.sh: reject uncommitted changes under ddprof-lib/src/main - test-coverage skill: recheck gcovr version on the final base images Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jacocoTestReport is skipped when no .exec file exists, so a guard in its actions never ran. Count executed tests from the result XML in checkCoverageTestFailures instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Clear old result XML before the coverage tasks (the musl runner never does), report deferred test failures before the no-match error, and count only tests that ran (not skipped). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Count skipped tests as matched when checking -Ptests, so a valid pattern gated off on one JVM does not fail the cell. - Mark cells without exported classes "unverified (no classes)". - Refuse a non-empty --coverage-out that is not an earlier export. - Resolve the git common dir without --path-format; reject --mount from a worktree. - Fetch all of origin before resolving the ref in the skill. - Reword the JDK note in CodeCoverage.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Re-mark "unverified (no classes)" cells when no cell exports classes. - Create cell.properties before the export copies, so a partial export is still recognized as an export by the --coverage-out guard. - Plant a valid earlier export in the script tests and test the guard. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pattern was spliced into a command that is evaluated twice, so --tests was restricted to a character allow-list that rejected valid filters such as Outer$Inner. Pass it as TESTS_FILTER and quote the expansion in the container; only a newline is still rejected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
The PR adds merged C++/Java coverage across Linux platforms and JVMs; post-build gcovr checks and intentional rejection of overlapping worktree paths address the earlier findings. One export-marker defect remains: incomplete exports can abort otherwise-valid merges, and interrupted rootful reruns can lose retry eligibility.
🤖 Bits Code Review · Commit 4689429
|
This comment will be updated automatically if new data arrives. 🔗 Commit SHA: ae6dca8 | Docs | View more details | Give us feedback! |
- Skip the -Ptests no-match check when no coverage test task ran, so a gtest failure is not masked; read only each result XML's header. - Merge Java coverage against the class tree most cells share. - Reject a colon in mounted paths, and tracked changes in the source tree, for a coverage cell. - Trust only the mounted git dirs in the container, not every path. - Warn on an unverified JACOCO_CLI; add timeouts and retries to the download. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
The PR merges Linux/JVM C++ and Java coverage, with earlier gcovr compatibility and worktree-path concerns addressed. Export-marker handling still lets incomplete cells abort merges and strands interrupted rootful retries; additionally, the new dirty-tree check rejects reruns when their own output is unignored inside the checkout.
🤖 Bits Code Review · Commit 4da17f3
cell.properties was both the marker that lets a run reuse a non-empty --coverage-out and the signal that a cell is ready to merge. A failed copy left an empty one behind, which the merge then rejected. A host cleanup could remove it while root-owned reports stayed, so the retry failed the guard. The host now creates .coverage-cell, which nothing removes. The export writes cell.properties last, through a rename, so it exists only after a complete export. The source-cleanliness check also ignores a --coverage-out directory inside the checkout, so a rerun can replace its own earlier export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The skill deleted the whole cell directory before a retry, which also removed .coverage-cell. On rootful Docker the root-owned export files stayed behind, so the retry failed the --coverage-out guard. The skill now removes only <cell>.exit, and the script clears the earlier export. The in-checkout exclusion compares physical paths, so a symlinked alias of the checkout is still recognised. The partial-export test is skipped as root, which can read a mode-000 file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
More details
The PR merges C++/Java coverage across Linux/JVM cells, with earlier gcovr and worktree-path concerns addressed. Both remaining findings are fixed: incomplete exports stay out of merges, rootful retries retain their ownership marker, and generated output no longer makes an otherwise clean checkout fail.
🤖 Bits Code Review · Commit f0b5575
One rejected tracefile aborted merge-coverage.sh under set -e. The Java report and summary.md were not written, and the error did not name the cell. On a failed gcovr merge the script now checks each tracefile on its own and leaves the rejected cells out of the C++ report. It then merges the rest, still writes the Java report and summary.md, and exits with 2. A cell whose Gradle was killed by a signal (gradle_exit >= 128) still exported partial data, and the merge counted it. merge-coverage.sh now leaves such cells out of both reports. The skill merges only passed and failed cells, because a daemon that disappears exits with 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When gcovr rejects every tracefile, merge-coverage.sh now blames the host gcovr, not each cell, and stops early when gcovr is missing. The per-cell check uses the merge's function mode. When no single tracefile is rejected, the merge is not run a second time. The closing line lists only the reports that exist. The skill records each cell's status in <cell>.status and merges the passed and failed cells from those files, not from a hand-written list. The docs describe exit 2 as an incomplete C++ report, with the reason per cell in summary.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A missing gcovr stopped merge-coverage.sh before the Java report. It now marks the C++ column "gcovr not found", still writes the Java report and summary.md, and exits with 2. A rejected tracefile always names its cell. The host-gcovr hint appears only when more than one tracefile was probed and all were rejected. The skill's merge snippet lists status files with find, which works in bash and zsh, and warns on an unknown status. The docs say when there is no C++ report at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kaahos
left a comment
There was a problem hiding this comment.
Looks good to me, nothing blocking! I left 1 improvement suggestion.
What does this PR do?:
Adds a merged C++ and Java coverage report across the Linux platforms and JVMs that CI tests.
utils/run-containers-tests.sh --coverage-out=DIRruns:ddprof-lib:coverageReport -PenableCoveragefor one container cell. It exports the reports, the JaCoCo.execfiles, the classes they were recorded against and acell.propertiesfile (libc, arch, jdk, tests filter, commit, Gradle exit code).coverageReportalso writes a gcovr JSON tracefile,reports/coverage/cpp/coverage.json.utils/merge-coverage.shmerges cells built from one commit into one gcovr report and one JaCoCo report, plussummary.md.test-coverageagent skill runs the CI matrix (test_workflow.yml): one worktree and one subagent per libc×arch, capped by container memory, then the merge.Other changes to
run-containers-tests.sh:.gitnames a gitdir in the main repository; the script mounts that git dir read-onlyjava-profiler.base-idlabel and are rebuilt when the base image changes--rebuild-baseon another JDK--testsaccepts only letters, digits and_ . * # , -, in every modeeval; a quote in it could run commands on the hostWith
-Ptests, the coverage test tasks no longer fail on an empty match (ddprof-test/build.gradle.kts). A pattern usually matches tests of only one oftestCoverageandtestSlowCoverage.Motivation:
One
coverageReportrun covers one libc, one architecture and one test JVM. Code that only runs elsewhere (aarch64 stack walking, musl paths, OpenJ9 and GraalVM support) shows as not covered. A merged report shows what the CI-tested matrix actually executes.Additional Notes:
--testsnow rejects patterns with other characters, e.g. spaces,$or;. Such patterns could not work reliably before.base-idlabel, so each is rebuilt once on first use.8-orcland8-ibm(no container image) and macOS. The C++ report covers the-O0 -DDEBUGbuild only (seedoc/building/CodeCoverage.md)./code-reviewthen re-reviewed each fix commit; the last pass was clean. Declined findings:safe.directory "*"in worktree mode"*"applies only inside the throwaway container--rebuild-baseshould not force a JDK image rebuildcoverage.jsonand the empty-match filterHow to test the change?:
bash utils/tests/test_coverage_scripts.shhas 103 tests and runs in CI withutils/tests/*.sh. Stubpodman,gcovr,javaandcurlprograms record their arguments. The container command itself runs on the host against a stub Gradle and checks exit codes,cell.propertiesand the export.tests=JavaProfilerTest: 9 glibc (HotSpot 17/21/25, OpenJ9 8/11/17, GraalVM 17/21/25) and 5 musl (8–25). All passed and merged into one report.0825b2dcb; the review fixes after it are covered by the hermetic tests only.For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.🤖 Generated with Claude Code