Merge rust-bitcoin/rust-secp256k1#641: Fix CI

92778efe92 CI: Pin cc in ASAN no_std_test crate (Tobin C. Harding)
5e6dd8a467 CI: Use bash instead of sh (Tobin C. Harding)
cf5f1034ca Target panic message at lib users (Tobin C. Harding)
ec9c9643d7 Allow stuff after unconditional panic (Tobin C. Harding)
3bbf08348e no_std_test: Remove internal_features (Tobin C. Harding)
cff7a3dae7 CI: Grep for exact error message (Tobin C. Harding)
79e184f08a CI: Update MSRV pins (Tobin C. Harding)

Pull request description:

  CI has a bunch of things broken.

  This is #640 followed by #639 followed by  a few addition fixes to get CI green again. Includes clippy warnings in feature gated code which is not strictly necessary and a fix to a panic message, also not strictly necessary.

ACKs for top commit:
  apoelstra:
    ACK 92778efe92

Tree-SHA512: f99b01e17fade7df394299bdb6bf385bec3f88d6568d43962238049b33a94c364d48c266acb358e72a48dd55a4aac6300ace6478b0821275b89cb86eba639d8b
This commit is contained in:
Andrew Poelstra 2023-08-10 15:01:03 +00:00
commit 090f073772
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 15 additions and 5 deletions

View File

@ -1,7 +1,8 @@
#!/bin/sh #!/usr/bin/env bash
set -ex 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" FEATURES="bitcoin-hashes global-context lowmemory rand recovery serde std alloc bitcoin-hashes-std rand-std"
cargo --version cargo --version
@ -16,11 +17,13 @@ fi
# Pin dependencies as required if we are using MSRV toolchain. # Pin dependencies as required if we are using MSRV toolchain.
if cargo --version | grep "1\.48"; then if cargo --version | grep "1\.48"; then
cargo update -p wasm-bindgen-test --precise 0.3.34 cargo update -p wasm-bindgen-test --precise 0.3.34
cargo update -p serde --precise 1.0.156 cargo update -p serde_test --precise 1.0.175
fi fi
# Test if panic in C code aborts the process (either with a real panic or with SIGILL) # 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\\|panicked at '\[libsecp256k1\]" 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 # Make all cargo invocations verbose
export CARGO_TERM_VERBOSE=true export CARGO_TERM_VERBOSE=true
@ -106,6 +109,12 @@ if [ "$DO_ASAN" = true ]; then
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 -Cllvm-args=-msan-eager-checks=0' \ 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 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 --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" cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
fi fi

View File

@ -27,7 +27,6 @@
//! * Requires linking with `libc` for calling `printf`. //! * Requires linking with `libc` for calling `printf`.
//! //!
#![feature(lang_items)]
#![feature(start)] #![feature(start)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(panic_info_message)] #![feature(panic_info_message)]

View File

@ -1036,6 +1036,8 @@ impl serde::Serialize for KeyPair {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[allow(unused_variables)] // For `data` under some feature combinations (the unconditional panic below).
#[allow(unreachable_code)] // For `KeyPair::from_seckey_slice` after unconditional panic.
impl<'de> serde::Deserialize<'de> for KeyPair { impl<'de> serde::Deserialize<'de> for KeyPair {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> { fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
if d.is_human_readable() { if d.is_human_readable() {
@ -1051,7 +1053,7 @@ impl<'de> serde::Deserialize<'de> for KeyPair {
let ctx = Secp256k1::signing_only(); let ctx = Secp256k1::signing_only();
#[cfg(not(any(feature = "global-context", feature = "alloc")))] #[cfg(not(any(feature = "global-context", feature = "alloc")))]
let ctx: Secp256k1<crate::SignOnlyPreallocated> = panic!("The previous implementation was panicking too, please enable the global-context feature of rust-secp256k1"); let ctx: Secp256k1<crate::SignOnlyPreallocated> = panic!("cannot deserialize key pair without a context (please enable either the global-context or alloc feature)");
#[allow(clippy::needless_borrow)] #[allow(clippy::needless_borrow)]
KeyPair::from_seckey_slice(&ctx, data) KeyPair::from_seckey_slice(&ctx, data)