about summary refs log tree commit diff
path: root/library/test
diff options
context:
space:
mode:
authorAlisa Sireneva <me@purplesyringa.moe>2025-01-31 14:16:19 +0300
committerAlisa Sireneva <me@purplesyringa.moe>2025-02-09 23:51:54 +0300
commitb01c7f6b9c6ac837511e7bb75c15e9cd537fc974 (patch)
tree98e6cfbae104dc9a5e640c27bbc9a9a1e03899d5 /library/test
parent25a16572a36321deae83546b63f5595d75361179 (diff)
downloadrust-b01c7f6b9c6ac837511e7bb75c15e9cd537fc974.tar.gz
rust-b01c7f6b9c6ac837511e7bb75c15e9cd537fc974.zip
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.
Diffstat (limited to 'library/test')
-rw-r--r--library/test/src/console.rs5
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))?;