Better control of test-execution order #6266
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-test
S-blocked-external
Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Cargo currently does not take too much care about what order tests are executed.
cargo_test::compile_tests()
places them in order of(PackageID, TargetKind, Name)
. We could do better than that by ordering test execution by(PackageID, TargetKind)
Name
This has some benefits:
cargo watch
and filter the test we just broke.fail-fast
) are executed as soon as possible, so we get a least one readingNotice that if the testsuite completes successfully, the ordering almost returns to current behaviour, with only latency-scheduling taking precedence over
Name
.To do this, we'd need to persists some information to disk. We could do this by writing a "marker"-file somewhere in
/target
for every test (consider "target/testruns/test-hash(...)
") where the files'ctime
is the time the test were last started and the files'mtime
is the time the tests were last completed successfully. We can reconstruct the above ordering from that.Alternatively we serialize a single struct to disk.
Also notice that the ordering we derive from this information may be wrong or outdated (e.g. by changing test-bodies), yet this does not cause the testsuite to execute incorrectly as a whole and Is Only Wrong Once™
See also #10673
The text was updated successfully, but these errors were encountered: