Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread sanitizer to test #72

Merged
merged 6 commits into from
Dec 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add workflow thread_sanitizer-MacOS
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu committed Dec 20, 2021
commit 86c2b8de59e802eda22fa325e3f2665b5f163d92
39 changes: 37 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,10 @@ jobs:
MIRIFLAGS: "-Zmiri-disable-isolation"
run: cargo miri test --all-features

thread_sanitizer:
name: Thread Sanitizer checks
thread_sanitizer-ubuntu-latest:
name: Thread Sanitizer checks Ubuntu
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand Down Expand Up @@ -245,3 +246,37 @@ jobs:
env:
RUSTDOCFLAGS: "-Zsanitizer=thread"
RUSTFLAGS: "-Zsanitizer=thread"


thread_sanitizer-MacOS:
name: Thread Sanitizer checks MacOS
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-thread_sanitizer-v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rust-src
- name: Run thread sanitizer
run: |
# Thread sanitizer isn't guaranteed to catch all data races, it can only catch it
# the data race if it happens when running the program.
#
# Running the tests multiple times increase the chances that data races are found
# by the thread sanitizer.
for _ in $(seq 1 10); do cargo +nightly test -Z build-std --target --target $(uname -m)-apple-darwin; done
env:
RUSTDOCFLAGS: "-Zsanitizer=thread"
RUSTFLAGS: "-Zsanitizer=thread"