Skip to content

Add flag to opt out one test from parallel testing #2662

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

Closed
dns2utf8 opened this issue May 8, 2016 · 4 comments
Closed

Add flag to opt out one test from parallel testing #2662

dns2utf8 opened this issue May 8, 2016 · 4 comments

Comments

@dns2utf8
Copy link

dns2utf8 commented May 8, 2016

Hi all

I am not certain this is the right place, because the parsing of the test files appears to be done in rustc as well.

I had a problem while testing the threadpool-crate because all test run in parallel and all of them use the whole cpu.
Would it be possible to add a additional flag for test like this? Maybe something like this:

#[test]
#[no_parallel]
fn test_heavy_load_on_cpu_or_gpu_or_global_state() {
  // working hard here ...
}

The implementation would have to queue these test and run them sequencally.

The flag no_parallel seems very expressiv, but I prefere a positive keyword like single or individual or something like this.

What do you think?
Regards

@alexcrichton
Copy link
Member

Thanks for the report! This is actually more of a rustc bug than a Cargo bug (as the compiler is what processes these annotations), so you may want to open a bug over at rust-lang/rust.

I know I've wanted the ability to specify something like this before, though! One trick is to set RUST_TEST_THREADS=1 in the environment and that'll make sure the tests are single-threaded, but ideally there'd be a way to encode that in the source itself.

@dns2utf8
Copy link
Author

dns2utf8 commented May 9, 2016

Okay, i will open another issue in Rust. In my case running all tests in a chain kills the performance oft the tests. So flagging just 2 out of 20+ tests would be very handy.

@dns2utf8
Copy link
Author

dns2utf8 commented May 9, 2016

Added Issue to Rust: rust-lang/rust#33519

@alexcrichton
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants