From 69349a858f414b487c852a6ffcfd46e0d343b7c4 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 28 Jun 2022 14:04:26 +1000 Subject: [PATCH 1/2] Add NIGHTLY variable to CI script We are currently using the DO_BENCH variable as a proxy for whether or not we are using a nightly toolchain, while this is technically correct we use it from within an if guarded statement that is guarded by DO_FEATURE_MATRIX and we never run the CI script with _both_ of these variables set to true. This means that the all features test is never being run. Add a NIGHTLY variable and set it based on the output of `cargo --version`. --- contrib/test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/test.sh b/contrib/test.sh index 5047ee429..f4e088e49 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -17,6 +17,12 @@ fi cargo --version rustc --version +# Work out if we are using a nightly toolchain. +NIGHTLY=false +if cargo --version | grep nightly; then + NIGHTLY=true +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\\|panicked at '\[libsecp256k1\]" @@ -51,7 +57,7 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all --features="$FEATURES" cargo test --all --features="rand serde" - if [ "$DO_BENCH" = true ]; then # proxy for us having a nightly compiler + if [ "$NIGHTLY" = true ]; then cargo test --all --all-features RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all --all-features fi From 5f611f6f7fe7f9b01d54f4525b50b0b2e5996169 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 29 Jun 2022 11:11:39 +1000 Subject: [PATCH 2/2] Conditionally compile the hex macro We only use this macro when not fuzzing, add a cfg attribute to build it in only when needed. --- src/key.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/key.rs b/src/key.rs index dfbaa9b71..e38f4aaac 100644 --- a/src/key.rs +++ b/src/key.rs @@ -1651,6 +1651,7 @@ mod test { use crate::Error::{InvalidPublicKey, InvalidSecretKey}; use crate::Scalar; + #[cfg(not(fuzzing))] macro_rules! hex { ($hex:expr) => ({ let mut result = vec![0; $hex.len() / 2];