-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: test with commited lock files #632
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
461bae9
Move recent/minimal lock files
tcharding d9b70d2
Remove trailing whitespace
tcharding 637d08f
Add a layer of indirection to the test script
tcharding 4b9168c
Run WASM tests from test wrapper script
tcharding 3da39c6
Run test with recent/minimal lock files
tcharding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
REPO_DIR=$(git rev-parse --show-toplevel) | ||
FEATURES="bitcoin-hashes global-context lowmemory rand recovery serde std alloc bitcoin-hashes-std rand-std" | ||
|
||
cargo --version | ||
rustc --version | ||
|
||
# Work out if we are using a nightly toolchain. | ||
NIGHTLY=false | ||
if cargo --version | grep nightly; then | ||
NIGHTLY=true | ||
fi | ||
|
||
# Pin dependencies as required if we are using MSRV toolchain. | ||
if cargo --version | grep "1\.48"; then | ||
cargo update -p wasm-bindgen-test --precise 0.3.34 | ||
cargo update -p serde_test --precise 1.0.175 | ||
fi | ||
|
||
# Test if panic in C code aborts the process (either with a real panic or with SIGILL) | ||
cargo test -- --ignored --exact 'tests::test_panic_raw_ctx_should_terminate_abnormally' 2>&1 \ | ||
| tee /dev/stderr \ | ||
| grep "SIGILL\\|\[libsecp256k1] illegal argument. !rustsecp256k1_v0_._._fe_is_zero(&ge->x)" | ||
|
||
# Make all cargo invocations verbose | ||
export CARGO_TERM_VERBOSE=true | ||
|
||
# Defaults / sanity checks | ||
cargo build --locked --all | ||
cargo test --locked --all | ||
|
||
if [ "$DO_FEATURE_MATRIX" = true ]; then | ||
cargo build --locked --all --no-default-features | ||
cargo test --locked --all --no-default-features | ||
|
||
# All features | ||
cargo build --locked --all --no-default-features --features="$FEATURES" | ||
cargo test --locked --all --no-default-features --features="$FEATURES" | ||
# Single features | ||
for feature in ${FEATURES} | ||
do | ||
cargo build --locked --all --no-default-features --features="$feature" | ||
cargo test --locked --all --no-default-features --features="$feature" | ||
done | ||
# Features tested with 'std' feature enabled. | ||
for feature in ${FEATURES} | ||
do | ||
cargo build --locked --all --no-default-features --features="std,$feature" | ||
cargo test --locked --all --no-default-features --features="std,$feature" | ||
done | ||
# Other combos | ||
RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all | ||
RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all --features="$FEATURES" | ||
cargo test --locked --all --features="rand serde" | ||
|
||
if [ "$NIGHTLY" = true ]; then | ||
cargo test --locked --all --all-features | ||
RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all --all-features | ||
fi | ||
|
||
# Examples | ||
cargo run --locked --example sign_verify --features=bitcoin-hashes-std | ||
cargo run --locked --example sign_verify_recovery --features=recovery,bitcoin-hashes-std | ||
cargo run --locked --example generate_keys --features=rand-std | ||
fi | ||
|
||
if [ "$DO_LINT" = true ] | ||
then | ||
cargo clippy --locked --all-features --all-targets -- -D warnings | ||
cargo clippy --locked --example sign_verify --features=bitcoin-hashes-std -- -D warnings | ||
cargo clippy --locked --example sign_verify_recovery --features=recovery,bitcoin-hashes-std -- -D warnings | ||
cargo clippy --locked --example generate_keys --features=rand-std -- -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 | ||
|
||
# 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 | ||
cargo clean | ||
# The -Cllvm-args=-msan-eager-checks=0 flag was added to overcome this issue: | ||
# https://github.com/rust-bitcoin/rust-secp256k1/pull/573#issuecomment-1399465995 | ||
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \ | ||
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \ | ||
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu | ||
|
||
pushd "$REPO_DIR/no_std_test" > /dev/null || exit 1 | ||
# See https://github.com/rust-bitcoin/rust-secp256k1/pull/641#issuecomment-1671598914 | ||
cargo update -p cc --precise 1.0.79 | ||
popd > /dev/null || exit 1 | ||
|
||
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully" | ||
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully" | ||
fi | ||
|
||
# Run formatter if told to. | ||
if [ "$DO_FMT" = true ]; then | ||
if [ "$NIGHTLY" = false ]; then | ||
echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)" | ||
exit 1 | ||
fi | ||
rustup component add rustfmt | ||
cargo fmt --check || exit 1 | ||
fi | ||
|
||
# Bench if told to, only works with non-stable toolchain (nightly, beta). | ||
if [ "$DO_BENCH" = true ] | ||
then | ||
RUSTFLAGS='--cfg=bench' cargo bench --features=recovery,rand-std | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In f4078f8:
This warning is harmless enough, but "
cargo update
yields later dependencies" is neither necessary nor sufficient for us to want to update Cargo-recent.lock. I expect this warning to literally always trigger because it finds later dependencies that are incompatible with our MSRV.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only runs for "recent" but I agree, and thought at the time that we added it to
rust-bitcoin
that it was not that useful. Didn't seem to hurt though, and since its informational I acked it. I'm happy to remove it everywhere but I'd prefer to wait till @Kixunil is back because he added it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to open the file in GH to see the warning so it at least won't be intrusive.