-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
test.sh
executable file
·82 lines (70 loc) · 1.73 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
AS_DEPENDENCY=true
DO_LINT=true
# Library components, one by one
FEATURES="rgb lnp"
# ... and used together
FEATURES="${FEATURES} rgb,lnp"
# Cryptographic optionals
FEATURES="${FEATURES} keygen bulletproofs elgamal"
# Core rust optionals
FEATURES="${FEATURES} serde tokio async"
# Networking
FEATURES="${FEATURES} tor url websockets"
FEATURES="${FEATURES} tor,url"
# Full LNP strength, but without Serde
FEATURES="${FEATURES} lnp,websockets,url,tokio,async,keygen"
# Full library strength, but without Serde
FEATURES="${FEATURES} rgb,lnp,tokio,websockets,url,async,keygen"
if [ "$DO_COV" = true ]
then
export RUSTFLAGS="-C link-dead-code"
fi
# Use toolchain if explicitly specified
if [ -n "$TOOLCHAIN" ]
then
alias cargo="cargo +$TOOLCHAIN"
fi
# Check that we can build w/o features
cargo check --verbose --all-targets --workspace
cargo check --verbose --no-default-features --all-targets --workspace
# Check that we can build with each feature
for feature in ${FEATURES}
do
cargo check --verbose --features="$feature" --all-targets
done
# Fuzz if told to
if [ "$DO_FUZZ" = true ]
then
(
cd fuzz
cargo test --verbose --all-targets
./travis-fuzz.sh
)
fi
# Bench if told to
if [ "$DO_BENCH" = true ]
then
cargo bench --features unstable --all-targets
fi
# Use as dependency if told to
if [ -n "$AS_DEPENDENCY" ]
then
rm -rf dep_test
cargo new dep_test
cd dep_test
cat ../contrib/depCargo.toml >> Cargo.toml
cargo build --verbose
cd ..
rm -rf dep_test
fi
# Test all features
cargo test --verbose --all-features --all-targets --workspace
# Lint if told to
if [ "$DO_LINT" = true ]
then
(
rustup component add rustfmt
cargo fmt --all -- --check
)
fi