diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ed7d068..ec020ac 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -213,3 +213,36 @@ jobs: PROPTEST_CASES: "10" MIRIFLAGS: "-Zmiri-disable-isolation" run: cargo miri test --all-features + + 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"