Skip to content

Commit 161b8c8

Browse files
authored
ci: test more things with miri (#6885)
1 parent 9cc4a81 commit 161b8c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+83
-34
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ env:
1717
# Change to specific Rust release to pin
1818
rust_stable: stable
1919
rust_nightly: nightly-2024-05-05
20+
# Pin a specific miri version
21+
rust_miri_nightly: nightly-2024-09-19
2022
rust_clippy: '1.77'
2123
# When updating this, also update:
2224
# - README.md
@@ -413,17 +415,19 @@ jobs:
413415
runs-on: ubuntu-latest
414416
steps:
415417
- uses: actions/checkout@v4
416-
- name: Install Rust ${{ env.rust_nightly }}
418+
- name: Install Rust ${{ env.rust_miri_nightly }}
417419
uses: dtolnay/rust-toolchain@stable
418420
with:
419-
toolchain: ${{ env.rust_nightly }}
421+
toolchain: ${{ env.rust_miri_nightly }}
420422
components: miri
423+
- name: Install cargo-nextest
424+
uses: taiki-e/install-action@v2
425+
with:
426+
tool: cargo-nextest
421427
- uses: Swatinem/rust-cache@v2
422428
- name: miri
423-
# Many of tests in tokio/tests and doctests use #[tokio::test] or
424-
# #[tokio::main] that calls epoll_create1 that Miri does not support.
425429
run: |
426-
cargo miri test --features full --lib --no-fail-fast
430+
cargo miri nextest run --features full --lib --tests --no-fail-fast
427431
working-directory: tokio
428432
env:
429433
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields

tests-build/tests/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[test]
2+
#[cfg_attr(miri, ignore)]
23
fn compile_fail_full() {
34
let t = trybuild::TestCases::new();
45

tests-integration/tests/process_stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(rust_2018_idioms)]
2-
#![cfg(all(feature = "full", not(target_os = "wasi")))]
2+
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))]
33

44
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader};
55
use tokio::join;

tokio-util/tests/spawn_pinned.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![warn(rust_2018_idioms)]
22
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
3+
// Blocked on https://github.com/rust-lang/miri/issues/3911
4+
#![cfg(not(miri))]
35

46
use std::rc::Rc;
57
use std::sync::Arc;

tokio-util/tests/time_delay_queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async fn single_short_delay() {
9292
}
9393

9494
#[tokio::test]
95+
#[cfg_attr(miri, ignore)] // Too slow on miri.
9596
async fn multi_delay_at_start() {
9697
time::pause();
9798

tokio-util/tests/udp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(rust_2018_idioms)]
22
#![cfg(not(target_os = "wasi"))] // Wasi doesn't support UDP
3+
#![cfg(not(miri))] // No `socket` in Miri.
34

45
use tokio::net::UdpSocket;
56
use tokio_stream::StreamExt;

tokio/tests/buffered.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::net::TcpStream;
99
use std::thread;
1010

1111
#[tokio::test]
12+
#[cfg_attr(miri, ignore)]
1213
async fn echo_server() {
1314
const N: usize = 1024;
1415

tokio/tests/coop_budget.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use tokio::net::UdpSocket;
2222
/// Since we are both sending and receiving, that should happen once per 64 packets, because budgets are of size 128
2323
/// and there are two budget events per packet, a send and a recv.
2424
#[tokio::test]
25+
#[cfg_attr(miri, ignore)]
2526
async fn coop_budget_udp_send_recv() {
2627
const BUDGET: usize = 128;
2728
const N_ITERATIONS: usize = 1024;

tokio/tests/fs_copy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use tempfile::tempdir;
55
use tokio::fs;
66

77
#[tokio::test]
8+
#[cfg_attr(miri, ignore)]
89
async fn copy() {
910
let dir = tempdir().unwrap();
1011

@@ -21,6 +22,7 @@ async fn copy() {
2122
}
2223

2324
#[tokio::test]
25+
#[cfg_attr(miri, ignore)]
2426
async fn copy_permissions() {
2527
let dir = tempdir().unwrap();
2628
let from_path = dir.path().join("foo.txt");

tokio/tests/fs_file.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ async fn set_max_buf_size_write() {
203203
}
204204

205205
#[tokio::test]
206+
#[cfg_attr(miri, ignore)]
206207
#[cfg(unix)]
207208
async fn file_debug_fmt() {
208209
let tempfile = tempfile();

0 commit comments

Comments
 (0)