-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathtest.sh
executable file
·82 lines (70 loc) · 2.31 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
76
77
78
79
80
81
82
#!/bin/sh -ex
FEATURES="serde"
# Pin dependencies as required if we are using MSRV toolchain.
if cargo --version | grep "1\.56"; then
cargo update -p tempfile --precise 3.6.0
cargo update -p once_cell --precise 1.13.1
cargo update -p which --precise 4.4.0
cargo update -p byteorder --precise 1.4.3
cargo update -p cc --precise 1.0.94
cargo update -p libc --precise 0.2.163
cargo update -p serde_json --precise 1.0.98
cargo update -p serde --precise 1.0.156
cargo update -p ppv-lite86 --precise 0.2.8
fi
if [ "$DO_FEATURE_MATRIX" = true ]
then
# Test without any features first
cargo test --verbose --no-default-features
# Then test with the default features
cargo test --verbose
# Then test with the default features
cargo test --all-features --verbose
# Also build and run each example to catch regressions
cargo build --examples
# run all examples
run-parts ./target/debug/examples
# Test each feature
for feature in ${FEATURES}
do
cargo test --verbose --features="$feature"
done
fi
if [ "$DO_LINT" = true ]
then
cargo clippy --all-features --all-targets -- -D warnings
fi
# Build the docs if told to (this only works with the nightly toolchain)
if [ "$DO_DOCSRS" = true ]; then
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features
fi
# Build the docs with a stable toolchain, in unison with the DO_DOCSRS command
# above this checks that we feature guarded docs imports correctly.
if [ "$DO_DOCS" = true ]; then
RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features
fi
# Fuzz if told to
if [ "$DO_FUZZ" = true ]
then
(
cd fuzz
if cargo --version | grep "1\.58"; then
cargo update -p cc --precise 1.0.94
fi
cargo test --verbose
./travis-fuzz.sh
)
fi
# Do integration test if told to
if [ "$DO_INTEGRATION" = true ]
then
(
BITCOIND_EXE_DEFAULT="$(git rev-parse --show-toplevel)/elementsd-tests/bin/bitcoind"
ELEMENTSD_EXE_DEFAULT="$(git rev-parse --show-toplevel)/elementsd-tests/bin/elementsd"
cd elementsd-tests
BITCOIND_EXE=${BITCOIND_EXE:=${BITCOIND_EXE_DEFAULT}} \
ELEMENTSD_EXE=${ELEMENTSD_EXE:=${ELEMENTSD_EXE_DEFAULT}} \
cargo test
cd ..
)
fi