Skip to content

Option to generate and persist a test executable for documentation tests #37048

Closed
@sunjay

Description

@sunjay

I couldn't find an existing issue for this so I thought I would bring it up. Pardon me if this is a duplicate or in the wrong repository.

I wrote an in depth guide about Rust code coverage a few months ago based on the older guide that had been around for a while. One of the things I wrote about was that you can't currently get code coverage for documentation tests because cargo test or cargo test --doc doesn't output any test executable for documentation tests. The tool being used to generate coverage data, kcov, requires an executable that directly runs the code you want to measure.

It would be really helpful if there was a way not to just temporarily generate an executable for documentation tests, but also to have the option to store that executable somewhere (much like how the unit test executable is generated and stored in target/debug). That way we can manually run it using whatever tools we please.

I'm really surprised that I couldn't find an existing issue for this. There is a StackOverflow question about the issue but it doesn't lead anywhere. Hopefully this is a duplicate and it's been on your radar for some time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions