-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Enable specifying --test-threads in Cargo.toml #8430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think using the |
I'd like to see this feature added. The |
I found [env]
RUST_TEST_THREADS = "1" |
The cargo benchmarks also double as tests and so cause the `cargo test` command to fail, as they were not meant to be run in the test harness: the benchmark harness runs each test in sequence as to avoid resource contention, but tests are run in parallel by default. Multiple SDL contexts can't coexist, so while sequential tests drop the context in time for the next test, parallel tests conflict with eachother for the global context slot and panic/fail. This is not the best fix but is held up on rust-lang/cargo#8430
It seems to be a proper place for setting
I'd say this issue is effectively resolved by #8430 (comment). Keep it open for the awareness of the test harness protocol of threading control. Labelled as |
FYI I'm working on revamping custom test harnesses which we plan to make first class. My current plan for my PoC custom harness is to have a For some cases, a workaround is to use |
Without this, while (test) compile jobs respect MAKEOPTS via our config settings already deployed via the eclass, *test* jobs do not. We may want to consider setting NEXTEST_TEST_THREADS and/or having a cargo_enable_tests helper in the eclass at some point too. Bug: rust-lang/cargo#8430 Signed-off-by: Sam James <[email protected]>
I have an integration test suite that does some expensive setup/teardowns and really doesn't support parallel running of individual tests. I always have to run my tests as
cargo test -- --test-threads=1
and it would be great if I could specify this somehow inCargo.toml
as this is something inherent to the project and static.It would be great if this was configurable similarly to the
jobs
parameter in the[build]
section. Perhaps there can be a new section[test]
added?Also if this can be solved somehow with current mechanisms, please advise since anything that obviates me from wrapping the build in a Makefile (that passes the necessary
--test-threads
param tocargo test
) and just usingcargo
for everything would be a huge boon for me 👍The text was updated successfully, but these errors were encountered: