-
Notifications
You must be signed in to change notification settings - Fork 440
/
test.sh
executable file
·46 lines (37 loc) · 1.59 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
cd "$(dirname "$0")"/..
set -ex
export RUSTFLAGS="-D warnings"
if [[ -n "$TARGET" ]]; then
# If TARGET is specified, use cross for testing.
cargo install cross
cross test --all --target "$TARGET" --exclude benchmarks
# For now, the non-host target only runs tests.
exit 0
fi
# Otherwise, run tests and checks with the host target.
cargo check --all --bins --examples --tests --exclude benchmarks
cargo test --all --exclude benchmarks -- --test-threads=1
if [[ "$RUST_VERSION" == "nightly"* ]]; then
# Some crates have `nightly` feature, so run tests with --all-features.
cargo test --all --all-features --exclude benchmarks -- --test-threads=1
# Benchmarks are only checked on nightly because depending on unstable features.
cargo check --all --benches
cargo check --bins --manifest-path crossbeam-channel/benchmarks/Cargo.toml
# Run address sanitizer on crossbeam-epoch
# Note: this will be significantly rewritten by https://github.com/crossbeam-rs/crossbeam/pull/591.
if [[ "$OSTYPE" == "linux"* ]]; then
cargo clean
# TODO: Once `cfg(sanitize = "..")` is stable, replace
# `cfg(crossbeam_sanitize)` with `cfg(sanitize = "..")` and remove
# `--cfg crossbeam_sanitize`.
ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \
RUSTFLAGS="-Z sanitizer=address --cfg crossbeam_sanitize" \
cargo run \
--release \
--target x86_64-unknown-linux-gnu \
--features nightly \
--example sanitize \
--manifest-path crossbeam-epoch/Cargo.toml
fi
fi