Skip to content

Commit 16db876

Browse files
workingjubileegitbot
authored and
gitbot
committed
Rollup merge of rust-lang#136353 - purplesyringa:libtest-instant-wasm, r=Mark-Simulacrum
fix(libtest): Enable Instant on Emscripten targets `Instant::now()` works correctly on Emscripten since rust-lang/libc#3962. All wasm-family targets with OS support can now handle instants. Improves rust-lang#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
2 parents 2feefb1 + b41429a commit 16db876

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/src/console.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,10 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
314314
let mut st = ConsoleTestState::new(opts)?;
315315

316316
// Prevent the usage of `Instant` in some cases:
317-
// - It's currently not supported for wasm targets.
317+
// - It's currently not supported for wasm targets without Emscripten nor WASI.
318+
// - It's currently not supported for zkvm targets.
318319
let is_instant_unsupported =
319-
(cfg!(target_family = "wasm") && !cfg!(target_os = "wasi")) || cfg!(target_os = "zkvm");
320+
(cfg!(target_family = "wasm") && cfg!(target_os = "unknown")) || cfg!(target_os = "zkvm");
320321

321322
let start_time = (!is_instant_unsupported).then(Instant::now);
322323
run_tests(opts, tests, |x| on_test_event(&x, &mut st, &mut *out))?;

0 commit comments

Comments
 (0)