Skip to content

Consider .rs files for coverage by default - #3578

Open
jackmarsh wants to merge 2 commits into
thought-machine:masterfrom
jackmarsh:feat/rs-coverage-extension
Open

Consider .rs files for coverage by default#3578
jackmarsh wants to merge 2 commits into
thought-machine:masterfrom
jackmarsh:feat/rs-coverage-extension

Conversation

@jackmarsh

Copy link
Copy Markdown
Contributor

Please parses Rust coverage output correctly (the Rust plugin emits go-cover format), but Cover.FileExtension has no .rs, so collectCoverageFiles filters every Rust file out. The result is a coverage run that reports:

Total coverage:  No data

with every file at 0%, which reads as "coverage is broken" rather than "add a line of config". Every other language Please covers has its extension in this list already.

Adding it means Rust repos get working coverage without each of them discovering the same workaround. Three separate repos hit this before the cause was identified.

plz test //src/core:core_test is green (279 tests).

SubrepoFS looks a subrepo's output tree up by label and passes whatever it
finds to remotefs.New:

    tree := c.subrepoTrees[target.Label]
    return remotefs.New(c.remoteFSClient, tree, root)

subrepoTrees is populated only when a target's outputs are set from a remote
build, so a subrepo built locally, served from cache, or not yet built has
no entry and tree is nil. New then dereferences it while indexing the tree's
children, segfaulting at addr=0x18 during readSubrepoConfig, which calls
Subrepo.FS() unconditionally to look for .plzconfig.

A nil tree (or one without a root) now yields an empty filesystem, so the
lookup reports that the file does not exist and parsing carries on, which is
already how a subrepo without a .plzconfig is handled.
Rust coverage output is parsed fine, but every file in it is dropped unless
the repo adds .rs to this list, so coverage silently reports no data at all
rather than failing in a way that points at the cause. Every other language
Please knows how to cover has its extension here already.

Reported after a Rust plugin's coverage support looked broken in three
separate repos, each of which needed the same line of config.
@peterebden

Copy link
Copy Markdown
Collaborator

Makes sense. You can of course set it in config, but I think maybe you then have to list everything out again, and there's no real cost to having this as a default.

Looks like you have #3577 on this branch as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants