mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-03 00:00:05 +02:00
tokio: enable more tests in Miri (#7734)
This commit is contained in:
@@ -18,7 +18,7 @@ env:
|
|||||||
rust_stable: stable
|
rust_stable: stable
|
||||||
rust_nightly: nightly-2025-10-12
|
rust_nightly: nightly-2025-10-12
|
||||||
# Pin a specific miri version
|
# Pin a specific miri version
|
||||||
rust_miri_nightly: nightly-2025-11-09
|
rust_miri_nightly: nightly-2025-11-13
|
||||||
rust_clippy: '1.88'
|
rust_clippy: '1.88'
|
||||||
# When updating this, also update:
|
# When updating this, also update:
|
||||||
# - README.md
|
# - README.md
|
||||||
@@ -372,7 +372,7 @@ jobs:
|
|||||||
cargo miri nextest run --features full --lib --no-fail-fast
|
cargo miri nextest run --features full --lib --no-fail-fast
|
||||||
working-directory: tokio
|
working-directory: tokio
|
||||||
env:
|
env:
|
||||||
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance
|
||||||
|
|
||||||
miri-test:
|
miri-test:
|
||||||
name: miri-test
|
name: miri-test
|
||||||
@@ -395,7 +395,7 @@ jobs:
|
|||||||
cargo miri nextest run --features full --test '*' --no-fail-fast
|
cargo miri nextest run --features full --test '*' --no-fail-fast
|
||||||
working-directory: tokio
|
working-directory: tokio
|
||||||
env:
|
env:
|
||||||
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance
|
||||||
|
|
||||||
miri-doc:
|
miri-doc:
|
||||||
name: miri-doc
|
name: miri-doc
|
||||||
@@ -414,7 +414,7 @@ jobs:
|
|||||||
cargo miri test --doc --features $TOKIO_STABLE_FEATURES --no-fail-fast
|
cargo miri test --doc --features $TOKIO_STABLE_FEATURES --no-fail-fast
|
||||||
working-directory: tokio
|
working-directory: tokio
|
||||||
env:
|
env:
|
||||||
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance
|
||||||
|
|
||||||
asan:
|
asan:
|
||||||
name: asan
|
name: asan
|
||||||
|
|||||||
+1
-1
@@ -200,7 +200,7 @@ run loom tests that test unstable features.
|
|||||||
|
|
||||||
You can run miri tests with
|
You can run miri tests with
|
||||||
```
|
```
|
||||||
MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields" \
|
MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance" \
|
||||||
cargo +nightly miri test --features full --lib --tests
|
cargo +nightly miri test --features full --lib --tests
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // takes a really long time with miri
|
||||||
fn test_splitter() {
|
fn test_splitter() {
|
||||||
let data = str::repeat("█", DEFAULT_MAX_BUF_SIZE);
|
let data = str::repeat("█", DEFAULT_MAX_BUF_SIZE);
|
||||||
let mut wr = super::SplitByUtf8BoundaryIfWindows::new(TextMockWriter);
|
let mut wr = super::SplitByUtf8BoundaryIfWindows::new(TextMockWriter);
|
||||||
@@ -191,7 +191,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // takes a really long time with miri
|
||||||
fn test_pseudo_text() {
|
fn test_pseudo_text() {
|
||||||
// In this test we write a piece of binary data, whose beginning is
|
// In this test we write a piece of binary data, whose beginning is
|
||||||
// text though. We then validate that even in this corner case buffer
|
// text though. We then validate that even in this corner case buffer
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ pub(crate) mod sync {
|
|||||||
// internal use. Note however that some are not _currently_ named by
|
// internal use. Note however that some are not _currently_ named by
|
||||||
// consuming code.
|
// consuming code.
|
||||||
|
|
||||||
|
// Not using parking_lot in Miri due to <https://github.com/Amanieu/parking_lot/issues/477>.
|
||||||
#[cfg(all(feature = "parking_lot", not(miri)))]
|
#[cfg(all(feature = "parking_lot", not(miri)))]
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
pub(crate) use crate::loom::std::parking_lot::{
|
pub(crate) use crate::loom::std::parking_lot::{
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ pub(crate) mod test {
|
|||||||
drop(signal_guard);
|
drop(signal_guard);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(miri, ignore)] // Miri does not support epoll.
|
#[cfg_attr(miri, ignore)] // No `sigaction` on Miri
|
||||||
#[test]
|
#[test]
|
||||||
fn does_not_register_signal_if_queue_empty() {
|
fn does_not_register_signal_if_queue_empty() {
|
||||||
let (io_driver, io_handle) = IoDriver::new(1024).unwrap();
|
let (io_driver, io_handle) = IoDriver::new(1024).unwrap();
|
||||||
|
|||||||
@@ -431,7 +431,6 @@ impl Runtime {
|
|||||||
/// use std::time::Duration;
|
/// use std::time::Duration;
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// # if cfg!(miri) { return } // Miri reports error when main thread terminated without waiting all remaining threads.
|
|
||||||
/// let runtime = Runtime::new().unwrap();
|
/// let runtime = Runtime::new().unwrap();
|
||||||
///
|
///
|
||||||
/// runtime.block_on(async move {
|
/// runtime.block_on(async move {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ cfg_not_loom! {
|
|||||||
mod inject;
|
mod inject;
|
||||||
mod queue;
|
mod queue;
|
||||||
|
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))] // takes a really long time with miri
|
||||||
mod task_combinations;
|
mod task_combinations;
|
||||||
|
|
||||||
#[cfg(miri)]
|
#[cfg(miri)]
|
||||||
|
|||||||
@@ -479,8 +479,6 @@ async fn multiple_waiters() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
// Block on https://github.com/rust-lang/miri/issues/4374
|
|
||||||
#[cfg_attr(miri, ignore)]
|
|
||||||
async fn poll_fns() {
|
async fn poll_fns() {
|
||||||
let (a, b) = socketpair();
|
let (a, b) = socketpair();
|
||||||
let afd_a = Arc::new(AsyncFd::new(a).unwrap());
|
let afd_a = Arc::new(AsyncFd::new(a).unwrap());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// This tests test the behavior of `process::Command::spawn` when it is used
|
// This tests test the behavior of `process::Command::spawn` when it is used
|
||||||
// outside runtime, and when `process::Child::wait ` is used in a different
|
// outside runtime, and when `process::Child::wait ` is used in a different
|
||||||
// runtime from which `process::Command::spawn` is used.
|
// runtime from which `process::Command::spawn` is used.
|
||||||
#![cfg(all(unix, not(target_os = "freebsd"), not(miri)))]
|
#![cfg(all(unix, not(target_os = "freebsd"), not(miri)))] // Miri cannot run system commands
|
||||||
|
|
||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
use tokio::{process::Command, runtime::Runtime};
|
use tokio::{process::Command, runtime::Runtime};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands
|
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands
|
||||||
|
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands
|
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands
|
||||||
|
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
use tokio_test::assert_ok;
|
use tokio_test::assert_ok;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(not(miri))] // Possible bug on Miri.
|
|
||||||
|
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user