-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest.sh
executable file
·74 lines (57 loc) · 1.88 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
#!/bin/sh
set -ex
FEATURES="compiler serde rand base64 simplicity"
cargo --version
rustc --version
# Pin dependencies required to build with Rust 1.63
if cargo --version | grep "1\.63"; then
cargo update -p regex --precise 1.8.4
fi
# Format if told to
if [ "$DO_FMT" = true ]
then
rustup component add rustfmt
cargo fmt -- --check
fi
# Test bitcoind integration tests if told to (this only works with the stable toolchain)
if [ "$DO_BITCOIND_TESTS" = true ]; then
BITCOIND_EXE_DEFAULT="$(git rev-parse --show-toplevel)/bitcoind-tests/bin/bitcoind"
ELEMENTSD_EXE_DEFAULT="$(git rev-parse --show-toplevel)/bitcoind-tests/bin/elementsd"
cd bitcoind-tests
BITCOIND_EXE=${BITCOIND_EXE:=${BITCOIND_EXE_DEFAULT}} \
ELEMENTSD_EXE=${ELEMENTSD_EXE:=${ELEMENTSD_EXE_DEFAULT}} \
cargo test --verbose
# Exit integration tests, do not run other tests.
exit 0
fi
# Defaults / sanity checks
cargo test
if [ "$DO_FEATURE_MATRIX" = true ]
then
# All features
cargo test --features="$FEATURES"
# Single features
for feature in ${FEATURES}
do
cargo test --features="$feature"
done
# Run all the examples
cargo build --examples
cargo run --example htlc --features=compiler
cargo run --example parse
cargo run --example sign_multisig
cargo run --example verify_tx > /dev/null
cargo run --example xpub_descriptors
cargo run --example taproot --features=compiler
cargo run --example psbt_sign_finalize --features=base64
fi
# Bench if told to (this only works with the nightly toolchain)
if [ "$DO_BENCH" = true ]
then
RUSTFLAGS=--cfg=miniscript_bench cargo bench --features="compiler"
fi
# Build the docs if told to (this only works with the nightly toolchain)
if [ "$DO_DOCS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --features="$FEATURES" -- -D rustdoc::broken-intra-doc-links
fi
exit 0