diff options
| author | Jubilee <workingjubilee@gmail.com> | 2025-02-10 00:51:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-10 00:51:51 -0800 |
| commit | 6ef2cd8e1c3638bbc30dcd44159ffed459264e81 (patch) | |
| tree | 834be0f47d46ce3dc88ac88cf914e90c2ecb07a3 | |
| parent | 888b4384763b5dcae5696d83c0d99c09ca657b72 (diff) | |
| parent | b01c7f6b9c6ac837511e7bb75c15e9cd537fc974 (diff) | |
| download | rust-6ef2cd8e1c3638bbc30dcd44159ffed459264e81.tar.gz rust-6ef2cd8e1c3638bbc30dcd44159ffed459264e81.zip | |
Rollup merge of #136353 - purplesyringa:libtest-instant-wasm, r=Mark-Simulacrum
fix(libtest): Enable Instant on Emscripten 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. Improves #131738. ~~This changes the behavior of libtest on `unknown-unknown`/`unknown-none` wasm targets, but as far as I can see, libtest doesn't support them anyway. (Can anyone double-check?)~~ UPD: this patch no longer affects `unknown-unknown` targets. ``@rustbot`` label +A-libtest +T-testing-devex +O-emscripten +O-wasm -needs-triage
| -rw-r--r-- | library/test/src/console.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs index 024ef48fc51..8f29f1dada5 100644 --- a/library/test/src/console.rs +++ b/library/test/src/console.rs @@ -314,9 +314,10 @@ 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. + // - It's currently not supported for wasm targets without Emscripten nor WASI. + // - It's currently not supported for zkvm targets. let is_instant_unsupported = - (cfg!(target_family = "wasm") && !cfg!(target_os = "wasi")) || cfg!(target_os = "zkvm"); + (cfg!(target_family = "wasm") && cfg!(target_os = "unknown")) || 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))?; |
