TOR_VEGAS: Implement Prop#324 TOR_VEGAS.
[tor.git] / src / test / test_rust.sh
blob804d2ada3615db71836d962473cbda46f88d0c09
1 #!/bin/sh
2 # Test all Rust crates
4 set -e
6 export LSAN_OPTIONS=suppressions=${abs_top_srcdir:-../../..}/src/test/rust_supp.txt
8 # When testing Cargo we pass a number of very specific linker flags down
9 # through Cargo. We do not, however, want these flags to affect things like
10 # build scripts, only the tests that we're compiling. To ensure this happens
11 # we unconditionally pass `--target` into Cargo, ensuring that `RUSTFLAGS` in
12 # the environment won't make their way into build scripts.
13 rustc_host=$(rustc -vV | grep host | sed 's/host: //')
15 for cargo_toml_dir in "${abs_top_srcdir:-../../..}"/src/rust/*; do
16 if [ -e "${cargo_toml_dir}/Cargo.toml" ]; then
17 # shellcheck disable=SC2086
18 cd "${abs_top_builddir:-../../..}/src/rust" && \
19 CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
20 "${CARGO:-cargo}" test "${CARGO_ONLINE-'--frozen'}" \
21 --features "test_linking_hack" \
22 --target "$rustc_host" \
23 ${EXTRA_CARGO_OPTIONS} \
24 --manifest-path "${cargo_toml_dir}/Cargo.toml" || exitcode=1
26 done
28 exit $exitcode