-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathtest.sh
executable file
·75 lines (61 loc) · 2.04 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh -ex
FEATURES="hashes global-context lowmemory rand rand-std recovery serde"
cargo --version
rustc --version
# Make all cargo invocations verbose
export CARGO_TERM_VERBOSE=true
# Pin dependencies as required if we are using MSRV toolchain.
if cargo --version | grep "1\.56"; then
cargo update -p cc --precise 1.0.94
fi
# Defaults / sanity checks
cargo build --all
cargo test --all
if [ "$DO_FEATURE_MATRIX" = true ]; then
cargo build --all --no-default-features
#This doesn't work but probably should --andrew
#cargo test --all --no-default-features
# All features
cargo build --all --no-default-features --features="$FEATURES"
cargo test --all --features="$FEATURES"
# Single features
for feature in ${FEATURES}
do
cargo build --all --no-default-features --features="$feature"
cargo test --all --features="$feature"
done
# Other combos
RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --all
RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --all --features="$FEATURES"
cargo test --all --features="rand rand-std"
cargo test --all --features="rand serde"
cargo test --all --all-features
RUSTFLAGS='--cfg=rust_secp_fuzz' RUSTDOCFLAGS='--cfg=rust_secp_fuzz' cargo test --all --all-features
fi
# Docs
if [ "$DO_DOCS" = true ]; then
cargo doc --all --features="$FEATURES"
fi
# Webassembly stuff
if [ "$DO_WASM" = true ]; then
clang --version
wasm-pack build
wasm-pack test --node;
fi
# Address Sanitizer
if [ "$DO_ASAN" = true ]; then
clang --version
cargo clean
CC='clang -fsanitize=address -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
fi
# Lint if told to
if [ "$DO_LINT" = true ]
then
(
cargo fmt --all -- --check
)
fi
exit 0