From 779b9c19d5c373d4d89ef3d758cf7469e9941c31 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Tue, 6 Jun 2023 09:35:19 -0700 Subject: [PATCH] ci: disable tuning test when runing ASAN (#5770) The tuning test relies on a predictable execution environment. It assumes that spawning a new task can complete reasonably fast. When running tests with ASAN, the tuning test will spurriously fail. After investigating, I believe this is due to running tests with ASAN enabled and without `release` in a low resource environment (CI) results in an execution environment that is too slow for the tuning test to succeed. --- .github/workflows/ci.yml | 6 +++--- tokio/tests/rt_threaded.rs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8fd34ce4..46b0faf67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -296,7 +296,7 @@ jobs: - name: asan run: cargo test --workspace --all-features --target x86_64-unknown-linux-gnu --tests -- --test-threads 1 --nocapture env: - RUSTFLAGS: -Z sanitizer=address + RUSTFLAGS: -Z sanitizer=address --cfg tokio_no_tuning_tests # Ignore `trybuild` errors as they are irrelevant and flaky on nightly TRYBUILD: overwrite @@ -366,14 +366,14 @@ jobs: # First run with all features (including parking_lot) - run: cross test -p tokio --all-features --target ${{ matrix.target }} --tests env: - RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_cross ${{ matrix.rustflags }} + RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} # Now run without parking_lot - name: Remove `parking_lot` from `full` feature run: sed -i '0,/parking_lot/{/parking_lot/d;}' tokio/Cargo.toml # The `tokio_no_parking_lot` cfg is here to ensure the `sed` above does not silently break. - run: cross test -p tokio --features full,test-util --target ${{ matrix.target }} --tests env: - RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_parking_lot --cfg tokio_cross ${{ matrix.rustflags }} + RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_parking_lot --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} # See https://github.com/tokio-rs/tokio/issues/5187 no-atomic-u64: diff --git a/tokio/tests/rt_threaded.rs b/tokio/tests/rt_threaded.rs index fcfec74a3..6631768c3 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -35,7 +35,6 @@ fn single_thread() { } #[test] -#[cfg(not(tokio_cross))] fn many_oneshot_futures() { // used for notifying the main thread const NUM: usize = 1_000; @@ -595,7 +594,7 @@ async fn test_block_in_place4() { // is sufficient. If there is a regression, this test will hang. In theory, we // could add limits, but that would be likely to fail on CI. #[test] -#[cfg(not(tokio_cross))] +#[cfg(not(tokio_no_tuning_tests))] fn test_tuning() { use std::sync::atomic::AtomicBool; use std::time::Duration;