diff options
| author | Oli Iliffe <oliver.iliffe@kcl.ac.uk> | 2024-09-22 22:15:21 +0100 |
|---|---|---|
| committer | Oli Iliffe <oliver.iliffe@kcl.ac.uk> | 2024-09-22 23:46:08 +0100 |
| commit | e9b0bc9432e39822a8a87b301860423be3363f00 (patch) | |
| tree | 776ca59b0519ceba07f0ca069eaea8926cb1076c /library/std/tests/thread.rs | |
| parent | 6c6d210089e4589afee37271862b9f88ba1d7755 (diff) | |
| download | rust-e9b0bc9432e39822a8a87b301860423be3363f00.tar.gz rust-e9b0bc9432e39822a8a87b301860423be3363f00.zip | |
Add test for `available_parallelism()`
This is a redo of (this PR)[https://github.com/rust-lang/rust/pull/104095]. Add test for available_parallelism Add test for available_parallelism Add test for Add test for
Diffstat (limited to 'library/std/tests/thread.rs')
| -rw-r--r-- | library/std/tests/thread.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/library/std/tests/thread.rs b/library/std/tests/thread.rs index 79a981d0b0d..fc9917178b2 100644 --- a/library/std/tests/thread.rs +++ b/library/std/tests/thread.rs @@ -37,3 +37,21 @@ fn thread_local_containing_const_statements() { assert_eq!(CELL.get(), 1); assert_eq!(REFCELL.take(), 1); } + +#[test] +// Include an ignore list on purpose, so that new platforms don't miss it +#[cfg_attr( + any( + target_os = "redox", + target_os = "l4re", + target_env = "sgx", + target_os = "solid_asp3", + target_os = "teeos", + target_os = "wasi" + ), + should_panic +)] +fn available_parallelism() { + // check that std::thread::available_parallelism() returns a valid value + assert!(thread::available_parallelism().is_ok()); +} |
