From 1e82681d168bb07fbdb2d1c50cfd61caf03893c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Mon, 6 Jul 2020 18:28:47 +0200 Subject: [PATCH] Use ThreadSanitizer CI setup that avoids false positives (#406) --- .github/workflows/ci.yml | 4 +++- ci/tsan | 24 ------------------------ ci/tsan.sh | 4 +--- 3 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 ci/tsan diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 164ec13..47952d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,9 @@ jobs: - uses: actions/checkout@v2 - name: Install Rust run: rustup update nightly && rustup default nightly - - name: TSAN / MSAN + - name: Install rust-src + run: rustup component add rust-src + - name: ASAN / TSAN run: . ci/tsan.sh # Loom diff --git a/ci/tsan b/ci/tsan deleted file mode 100644 index e53f9b8..0000000 --- a/ci/tsan +++ /dev/null @@ -1,24 +0,0 @@ -# TSAN suppressions file for `bytes` - -# TSAN does not understand fences and `Arc::drop` is implemented using a fence. -# This causes many false positives. -race:Arc*drop -race:arc*Weak*drop - -# `std` mpsc is not used in any Bytes code base. This race is triggered by some -# rust runtime logic. -race:std*mpsc_queue - -# Some test runtime races. Allocation should be race free -race:alloc::alloc - -# Not sure why this is warning, but it is in the test harness and not the library. -race:TestEvent*clone -race:test::run_tests_console::*closure - -# Probably more fences in std. -race:__call_tls_dtors - -# This ignores a false positive caused by `thread::park()`/`thread::unpark()`. -# See: https://github.com/rust-lang/rust/pull/54806#issuecomment-436193353 -race:pthread_cond_destroy diff --git a/ci/tsan.sh b/ci/tsan.sh index 7e5b3be..ca520bd 100644 --- a/ci/tsan.sh +++ b/ci/tsan.sh @@ -2,9 +2,7 @@ set -ex -export RUST_TEST_THREADS=1 export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" -export TSAN_OPTIONS="suppressions=$(pwd)/ci/tsan" # Run address sanitizer RUSTFLAGS="-Z sanitizer=address" \ @@ -12,4 +10,4 @@ cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf - # Run thread sanitizer RUSTFLAGS="-Z sanitizer=thread" \ -cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut +cargo -Zbuild-std test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut