Skip to content

Allow only running a specific set of tests #8685

@camelid

Description

@camelid

Describe the problem you are trying to solve
It's currently not possible (to my understanding) to filter out multiple tests with Cargo. It would be nice to be able to rerun all the tests in a CI build that failed, without running all the passing tests too.

Describe the solution you'd like
A --tests option that lets you pass a list of tests to run, excluding all other tests. Although I would like it if it were not limited to just integration tests (as --test is), and have it work on unit tests too. If I understand correctly, this would be the equivalent of passing --test to the underlying test runner, except that the test runner does not allow multiple --test options:

error: Option 'test' given more than once

Also it would be nice if at the end of a test run where there were failed tests, Cargo printed out the command that you can run to only re-run the failed tests.

Notes
I find the --test option confusing as it seems to only run integration tests. Could this be changed to allow you to use it with unit tests as well?

See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.60cargo.20test.20--test.20foo.60.20for.20multiple.20tests for more context.

Cc @jyn514

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-test

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions