mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 23:13:15 +00:00
fix(libtest): Enable Instant on wasm targets
`Instant::now()` works correctly on Emscripten since https://github.com/rust-lang/libc/pull/3962. All wasm-family targets with OS support can now handle instants.
This commit is contained in:
parent
25a16572a3
commit
cb7ab1ab27
@ -314,9 +314,8 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
|
||||
let mut st = ConsoleTestState::new(opts)?;
|
||||
|
||||
// Prevent the usage of `Instant` in some cases:
|
||||
// - It's currently not supported for wasm targets.
|
||||
let is_instant_unsupported =
|
||||
(cfg!(target_family = "wasm") && !cfg!(target_os = "wasi")) || cfg!(target_os = "zkvm");
|
||||
// - It's currently not supported for zkvm targets.
|
||||
let is_instant_unsupported = cfg!(target_os = "zkvm");
|
||||
|
||||
let start_time = (!is_instant_unsupported).then(Instant::now);
|
||||
run_tests(opts, tests, |x| on_test_event(&x, &mut st, &mut *out))?;
|
||||
|
Loading…
Reference in New Issue
Block a user