[AIROCMLIR-601] [CI] Exclude test sources from Jenkins coverage reports#2379
Open
bogdan-petkovic wants to merge 7 commits into
Open
[AIROCMLIR-601] [CI] Exclude test sources from Jenkins coverage reports#2379bogdan-petkovic wants to merge 7 commits into
bogdan-petkovic wants to merge 7 commits into
Conversation
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Jenkins coverage collection step so Codecov metrics reflect coverage of production code only, excluding MLIR test sources that are currently being instrumented and reported.
Changes:
- Expand
llvm-cov’s--ignore-filename-regexto excludemlir/test/andmlir/unittests/. - Apply the same filter consistently across the
llvm-cov report,llvm-cov export(LCOV), andllvm-cov show(HTML) invocations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
[CI] Fix chronic timeouts in Jenkins Code coverage stage
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2379 +/- ##
===========================================
+ Coverage 79.50% 81.69% +2.18%
===========================================
Files 100 119 +19
Lines 31016 41977 +10961
Branches 4819 6940 +2121
===========================================
+ Hits 24659 34289 +9630
- Misses 4245 5117 +872
- Partials 2112 2571 +459
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
Motivation
The Codecov reports for rocMLIR (visible on [app.codecov.io/gh/ROCm/rocMLIR (https://app.codecov.io/gh/ROCm/rocMLIR)) had three independent issues that came to light while investigating AIROCMLIR-601:
MLIRRockTestPasses(e.g.mlir/test/lib/Dialect/Rock/ TestFunctionFusibility.cpp,TestRockMultibuffer.cpp, …) and the gtest unit tests undermlir/unittests/were instrumented and reported as if they were production code. This inflated the headline percentage that the biweekly Teams report (.github/workflows/codecov-report.yml) publishes, added noise to per-file drilldowns, and blocked future use of Codecov as a meaningful PR gate.Code coveragestage timed out chronically and silently. Long phases (littest buffering,llvm-profdata mergeof ~125 GB of*.profraw, threellvm-covinvocations including a slow HTMLshow) defeated the activity-based timeout, and any timeout/exception was caught and turned into a green build with no Codecov upload — so the Codecov "no report" we kept seeing was actually a silent CI failure, not a Codecov problem.CODEPATHwas empty inside the upload shell, thecodecovCLI was invoked without-Zso it returned exit 0 even on missing files / bad tokens, and warnings were logged withechoinstead ofunstable(), so genuine upload failures showed up as a green build with aWARNINGline buried in the console.Technical Details
All changes are in
mlir/utils/jenkins/Jenkinsfile. No other CI / build / source files are touched.1. Exclude test sources from coverage
collectCoverageData(...)runs threellvm-covinvocations: a textreport, an LCOVexport(the artifact uploaded to Codecov), and an HTMLshow. All three previously passed--ignore-filename-regex=external/llvm-project, so only upstream LLVM was filtered. The regex is extended to also dropmlir/test/andmlir/unittests/:A small
codecov.ymlat the repo root with the sameignore:list would also protect the metric for coverage uploaded from any other source (developer-localllvm-cov, future GitHub Actions, one-off re-uploads). Not in this PR — tracked as a follow-up.2. Fix chronic timeouts in the coverage stage
Switched the parent timeout from activity-based to wall-clock 180 min so silent phases (lit buffering,
llvm-profdata merge) cannot make it fire spuriously. The 180 min number is a safety ceiling — real runs are far shorter (see "Future work" below).3. Fix empty
CODEPATHin Codecov upload scriptThe upload script previously referenced
${CODEPATH}from a nested closure where the variable was empty, so thecodecovCLI was effectively invoked as--flags "" -f ./coverage_.lcov. Switched to Groovy double-quoted string interpolation at the call site so${CODEPATH}resolves to the matrix codepath (e.g.gfx942,gfx90a).4. Decouple HTML coverage report from the Codecov upload
Moved the slow
llvm-cov show --format=htmlout ofcollectCoverageData(...)into a new helperproduceCoverageHtml(...)that runs after the Codecov upload, wrapped in its own 45 mintimeout(...)andcatchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', ...). A new pipeline parameterrunCoverageHtml(defaultfalse) toggles it on demand from the Jenkins "Build with parameters" UI, the same wayrunCodeCovalreadydoes.
Net effect: the HTML report can no longer block or starve the Codecov upload, and the typical CI run skips it entirely.
5. Surface Codecov failures as UNSTABLE instead of silent success
-Zto thecodecovCLI so missing files / bad tokens / network errors produce a non-zero exit code instead of a silent exit 0.echo "WARNING: ..."withunstable("...")on upload failure.echo "NOTE: Code coverage stage had an error or timeout..."withunstable("...")in the outercatch (Exception)block.Build colour semantics:
unstable(...)marks the build yellow but passing — subsequent stages, archive, and downstream jobs still run.Coverage problems are now visible in the Stage View instead of hidden in the console, but they never turn the build red.
Test Plan
The Jenkins
Code coveragestage on this PR is the source of truth. Each iteration validated:.lcovno longer contains entries undermlir/test/ormlir/unittests/(1).Codecov upload exit code: 0is reported, and the upload is visible at https://app.codecov.io/gh/ROCm/rocMLIR/commits with the matrix flag (gfx942etc.) attached (3, 4).runCoverageHtml=false(default) skips HTML generation; setting it totrueproducescoverage_*.htmland archives it (4).Test Result
Future work (not in this PR)
codecov.ymlmirroring theignore:list, so the filter applies to any future upload source (GitHub Actions, local re-uploads).Submission Checklist