Skip to content

Commit

Permalink
Fix toolchain to avoid LLVM complaining on TSAN usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-Janggun committed Mar 14, 2024
1 parent d990f4e commit 5ef3525
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion homework/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
nightly-2024-03-13
12 changes: 8 additions & 4 deletions homework/scripts/grade-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
# * RUNNERS: array of "cargo[_asan | _tsan] [--release]"
# * TIMEOUT: default 10s

rustup toolchain update stable nightly
export RUST_NIGHTLY=nightly-2024-03-13
# rustup toolchain update stable # nightly
rustup install $RUST_NIGHTLY
rustup component add rust-src --toolchain $RUST_NIGHTLY-x86_64-unknown-linux-gnu


echo_err() {
echo "$@" 1>&2
Expand Down Expand Up @@ -43,7 +47,7 @@ export -f grep_skip_comment
run_linters() {
cargo fmt -- --check
local FMT_ERR=$?
cargo +nightly clippy -- -D warnings
cargo +$RUST_NIGHTLY clippy -- -D warnings
local CLIPPY_ERR=$?
[ "$FMT_ERR" -ne 0 ] && echo_err 'Please format your code with `cargo fmt` first.'
[ "$CLIPPY_ERR" -ne 0 ] && echo_err 'Please fix the issues from `cargo +nightly clippy -- -D warnings` first.'
Expand All @@ -60,7 +64,7 @@ cargo_asan() {
RUSTFLAGS="-Z sanitizer=address" \
ASAN_OPTIONS="detect_leaks=1" \
RUSTDOCFLAGS="-Z sanitizer=address" \
cargo +nightly $SUBCOMMAND -Z build-std --target $TARGET_TRIPLE "$@"
cargo +$RUST_NIGHTLY $SUBCOMMAND -Z build-std --target $TARGET_TRIPLE "$@"
}
export -f cargo_asan

Expand All @@ -71,7 +75,7 @@ cargo_tsan() {
TSAN_OPTIONS="suppressions=suppress_tsan.txt" \
RUSTDOCFLAGS="-Z sanitizer=thread" \
RUST_TEST_THREADS=1 \
cargo +nightly $SUBCOMMAND -Z build-std --target $TARGET_TRIPLE "$@"
cargo +$RUST_NIGHTLY $SUBCOMMAND -Z build-std --target $TARGET_TRIPLE "$@"
}
export -f cargo_tsan

Expand Down
7 changes: 7 additions & 0 deletions homework/suppress_tsan.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Suppress false positives from Arc.
# This is supposed to be fixed in https://github.com/rust-lang/rust/pull/65097,
# but tsan still reports races in Arc::drop. Why??
# The grading script doesn't test Arc, but we still have it listed here anyway so that
# `cargo_tsan test` does not give out false positives.
race:Arc

# uses fences
race:crossbeam_epoch

0 comments on commit 5ef3525

Please sign in to comment.