about summary refs log tree commit diff
path: root/library/test
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-04-15 16:56:14 +0100
committerGitHub <noreply@github.com>2024-04-15 16:56:14 +0100
commit2074631732cbe9601996f1ea3fddb70e4d0f81d3 (patch)
tree2a18a1fc8baf2978db3649d4aed887729b703466 /library/test
parente07d18fb2fa1d1a11008490d9f3e170a67573c36 (diff)
parent510720e9fcb1181cc2e634fe6edddadf2d2c4993 (diff)
downloadrust-2074631732cbe9601996f1ea3fddb70e4d0f81d3.tar.gz
rust-2074631732cbe9601996f1ea3fddb70e4d0f81d3.zip
Rollup merge of #123548 - RalfJung:what-is-time, r=joboet
libtest: also measure time in Miri

A long time ago we disabled timekeeping of the default test harness in Miri, as otherwise it would fail to run without `-Zmiri-disable-isolation`. However, since then Miri gained a "fake clock" that lets it present some deterministic notion of time when isolation is enabled.

So we could now let libtest do timekeeping again when running in Miri. That's nice as it can help detect tests that run too long. However it can also be confusing as the results with isolation can be quite different than the real time.

``@rust-lang/miri`` what do you think?
Diffstat (limited to 'library/test')
-rw-r--r--library/test/src/console.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index f3918ba333a..7e224d60d9d 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -315,10 +315,8 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
 
     // Prevent the usage of `Instant` in some cases:
     // - It's currently not supported for wasm targets.
-    // - We disable it for miri because it's not available when isolation is enabled.
-    let is_instant_unsupported = (cfg!(target_family = "wasm") && !cfg!(target_os = "wasi"))
-        || cfg!(target_os = "zkvm")
-        || cfg!(miri);
+    let is_instant_unsupported =
+        (cfg!(target_family = "wasm") && !cfg!(target_os = "wasi")) || 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))?;