Debian Codegraph @

third_party/rust/cubeb-coreaudio/run_sanitizers.sh

raw
1 # The option `Z` is only accepted on the nightly compiler
2 # so changing to nightly toolchain by `rustup default nightly` is required.
3
4 # See: https://github.com/rust-lang/rust/issues/39699 for more sanitizer support.
5
6 toolchain=$(rustup default)
7 echo "\nUse Rust toolchain: $toolchain"
8
9 if [[ $toolchain != nightly* ]]; then
10 echo "The sanitizer is only available on Rust Nightly only. Skip."
11 exit
12 fi
13
14 # Bail out once getting an error.
15 set -e
16
17 # Ideally, sanitizers should be ("address" "leak" "memory" "thread") but
18 # - `memory`: It doesn't works with target x86_64-apple-darwin
19 # - `leak`: Get some errors that are out of our control. See:
20 # https://github.com/mozilla/cubeb-coreaudio-rs/issues/45#issuecomment-591642931
21 sanitizers=("address" "thread")
22 for san in "${sanitizers[@]}"
23 do
24 San="$(tr '[:lower:]' '[:upper:]' <<< ${san:0:1})${san:1}"
25 echo "\n\nRun ${San}Sanitizer\n------------------------------"
26 RUSTFLAGS="-Z sanitizer=${san}" sh run_tests.sh
27 done