Merge pull request #256 from rust-bitcoin/workspace

Make test.sh test and build secp256k1-sys
This commit is contained in:
Andrew Poelstra 2020-12-23 17:58:34 +00:00 committed by GitHub
commit 91eea119b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 19 deletions

View File

@ -54,3 +54,7 @@ name = "sign_verify"
[[example]] [[example]]
name = "generate_keys" name = "generate_keys"
required-features = ["rand"] required-features = ["rand"]
[workspace]
members = ["secp256k1-sys"]
exclude = ["no_std_test"]

View File

@ -11,30 +11,33 @@ fi
cargo --version cargo --version
rustc --version rustc --version
# Make all cargo invocations verbose
export CARGO_TERM_VERBOSE=true
# Defaults / sanity checks # Defaults / sanity checks
cargo build --verbose cargo build --all
cargo test --verbose cargo test --all
if [ "$DO_FEATURE_MATRIX" = true ]; then if [ "$DO_FEATURE_MATRIX" = true ]; then
cargo build --verbose --no-default-features cargo build --all --no-default-features
#This doesn't work but probably should --andrew #This doesn't work but probably should --andrew
#cargo test --verbose --no-default-features #cargo test --all --no-default-features
# All features # All features
cargo build --verbose --no-default-features --features="$FEATURES" cargo build --all --no-default-features --features="$FEATURES"
cargo test --verbose --features="$FEATURES" cargo test --all --features="$FEATURES"
# Single features # Single features
for feature in ${FEATURES} for feature in ${FEATURES}
do do
cargo build --verbose --no-default-features --features="$feature" cargo build --all --no-default-features --features="$feature"
cargo test --verbose --features="$feature" cargo test --all --features="$feature"
done done
# Other combos # Other combos
RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --no-run --verbose RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --no-run --all
RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --no-run --verbose --features="recovery" RUSTFLAGS='--cfg=rust_secp_fuzz' cargo test --no-run --all --features="recovery"
cargo test --verbose --features="rand rand-std" cargo test --all --features="rand rand-std"
cargo test --verbose --features="rand serde" cargo test --all --features="rand serde"
# Examples # Examples
cargo run --example sign_verify cargo run --example sign_verify
@ -44,13 +47,13 @@ fi
# Docs # Docs
if [ "$DO_DOCS" = true ]; then if [ "$DO_DOCS" = true ]; then
cargo doc --verbose --features="$FEATURES" cargo doc --all --features="$FEATURES"
fi fi
# Webassembly stuff # Webassembly stuff
if [ "$DO_WASM" = true ]; then if [ "$DO_WASM" = true ]; then
clang --version && clang --version &&
CARGO_TARGET_DIR=wasm cargo install --verbose --force wasm-pack && CARGO_TARGET_DIR=wasm cargo install --force wasm-pack &&
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml && printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml &&
CC=clang-9 wasm-pack build && CC=clang-9 wasm-pack build &&
CC=clang-9 wasm-pack test --node; CC=clang-9 wasm-pack test --node;
@ -62,16 +65,16 @@ if [ "$DO_ASAN" = true ]; then
CC='clang -fsanitize=address -fno-omit-frame-pointer' \ CC='clang -fsanitize=address -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \ 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' \ ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
cargo test --lib --verbose --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu && cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu &&
cargo clean && cargo clean &&
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \ CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \ RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
cargo test --lib --verbose --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu && cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu &&
cd no_std_test && cargo run --release | grep -q "Verified Successfully" cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
fi fi
# Bench # Bench
if [ "$DO_BENCH" = true ]; then if [ "$DO_BENCH" = true ]; then
cargo bench --features="unstable" cargo bench --all --features="unstable"
fi fi