Repository navigation
Fix coverage region parsing for filenames with spaces - #4936
feliperodri merged 2 commits into
Conversation
Parse coverage region delimiters from the right to preserve filenames containing whitespace, colons, and separator text. Add parser unit tests and a coverage UI regression for issue model-checking#4838.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: None
What changed in this PR
Fixes CoverageRegion parsing so coverage output can be parsed when source filenames contain spaces (and other tricky substrings), preventing kani autoharness --coverage panics and adding regressions tests for the reported case (#4838).
Changes:
- Update
CoverageRegion::from_strto parse from the right (preserving filenames with spaces/colons/-). - Add unit tests covering multiple tricky filename shapes.
- Add a UI coverage regression test using an auxiliary module file named
a a.rs.
| File | Description |
|---|---|
| tests/ui/coverage-spaces/test.rs | New UI test that compiles/executes coverage with a module path containing spaces. |
| tests/ui/coverage-spaces/expected | Expected coverage output asserting a a.rs is reported and parsed correctly. |
| tests/ui/coverage-spaces/auxiliary/a a.rs | Auxiliary module source file whose filename contains a space. |
| kani-driver/src/coverage/cov_results.rs | Implements right-to-left parsing and adds parser unit tests for edge-case filenames. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
feliperodri
left a comment
There was a problem hiding this comment.
Approving. Splitting from the right fixes it at the source. I checked it against real files named a a.rs, a - b.rs and x:y z.rs, and against the issue's autoharness command. All report correct coverage, and main panics on the first. One suggestion inline: keep the input in the panic message.
Coverage region parsing currently splits on whitespace, so a source filename such as
a a.rsmakeskani autoharness --coveragepanic atblank_splits[1] == "-".Parse the region separator and starting line/column from the right, preserving the complete filename. Add parser unit tests for spaces, repeated colons and
-in filenames, plus a coverage UI regression using a module nameda a.rs.Resolves #4838.
Validation
kani autoharness -Zautoharness --coverage -Zsource-coverage a.rs) exit successfully and reporta a.rs (a::c)as covered.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.