-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
Random test ordering for cargo test #85440
Copy link
Copy link
Open
Labels
A-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Projects
- StatusShow more project fieldsNo status
Describe the problem you are trying to solve
Sometimes tests depend on each other and one of the possible counter measures is to shuffle the order in which tests are run.
Describe the solution you'd like
I would like
cargo testto take a--randomflag, which would shuffle the test order. Ideally it would generate and print the seed used (a u64 integer). This could be used to debug situations, maybe with a corresponding--random-seed <seed>parameter (which would imply--random).Notes
I had a look at the codebase and I think I identified the place where the sorting currently happens (https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_test.rs#L67). I'd be happy to try to contribute a PR.