fix typos from #28614
[tor.git] / src / test / test_rust.sh
blob00b3e88d37525ce13ca2d37d2b7f2348307f3a3c
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 cd "${abs_top_builddir:-../../..}/src/rust" && \
18 CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
19 "${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} \
20 --features "test_linking_hack" \
21 --target $rustc_host \
22 ${EXTRA_CARGO_OPTIONS} \
23 --manifest-path "${cargo_toml_dir}/Cargo.toml" || exitcode=1
25 done
27 exit $exitcode