Skip to content

Conversation

@tcharding
Copy link
Member

@tcharding tcharding commented May 11, 2022

Make an effort to improve the test script, taking inspiration for the test script in rust-secp256k1. Since Bash can, at times, be a bit obscure, I made extra effort to do very simple discreet patches.

First part of the PR is fixes to the test script, second part is improvements to the CI pipeline.

tcharding added 3 commits May 11, 2022 15:20
Use the Bash `set -e` option to make the test script fail if a command
fails. While we are at it add sanity check commands that call the
compiler and `cargo`.
There is no obvious reason to run the fuzzer in a subprocess.

Remove the subprocess from the fuzzing code. While we are at it change
the code comment to state what it does instead of mentioning the CI vms.
There is no obvious reason to run the fuzzer in a subprocess.

Remove the subprocess from the fuzzing code.
@tcharding tcharding force-pushed the 05-11-test-script branch from 560ded4 to 06fba01 Compare May 11, 2022 06:11
@tcharding
Copy link
Member Author

Removed last patch, I guess that is why we are using 1.58 for fuzzing and not stable?

@tcharding tcharding changed the title Improve the test script and CI pipeline WIP: Improve the test script and CI pipeline May 11, 2022
tcharding added 5 commits May 12, 2022 08:01
In an effort to improve test coverage without being inefficient add a
new env variable `DO_FEATURE_MATRIX` to the test script. This is how we
do it over in `rust-secp256k1`, it enables good test coverage while not
having to run the whole matrix in every CI job.

Add cargo calls for each example because the current way we run the
examples does not work for those who configure the build output
directory to something other than the default.
Be a good UNIX hacker and exit the test script explicitly with a success
value.
As we do in `rust-secp256k1` use a string that includes 'Nightly' in
name of the nightly test.
In the `Tests` CI job run the feature matrix tests. Also run these tests
for 4 toolchains, stable, beta, nightly, and 1.41.1
Rename the integration test job to `IntTests` now that we do not run the
full matrix of unit tests in this job. Simplify the yaml by removing the
strategy section since we only use a single toolchain in this job.
@tcharding tcharding force-pushed the 05-11-test-script branch from 06fba01 to ed51323 Compare May 11, 2022 22:01
@tcharding tcharding changed the title WIP: Improve the test script and CI pipeline Improve the test script and CI pipeline May 12, 2022
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ed51323

@@ -1,5 +1,7 @@
#!/bin/sh -ex

set -e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big bug! I wonder how it ever worked till now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we were getting some false positives in the CI runs. rust-bitcoin/contrib/test.sh doesn't have this either :)

cargo run --example sign_multisig
cargo run --example verify_tx > /dev/null
cargo run --example psbt
cargo run --example xpub_descriptors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why manually list examples instead of run-parts? Is it because of the extra args to each example? We need to remember to add examples here every time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its so the script can be run locally, but yes as you say there is a maintenance cost. Is it worth it, I don't know? I configure target-dir to be a global build cache so there is no target directory when I build so the examples don't run.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ed51323

run-parts ./target/debug/examples
# Run all the examples
cargo build --examples
cargo run --example htlc --features=compiler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There is a white space at the end of this line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooo, means I did not read the diff before pushing, bad Tobin. Thanks man, I'll fix it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the diff and I missed this too, oops! Thanks Sanket.

@sanket1729 sanket1729 merged commit 4071548 into rust-bitcoin:master May 15, 2022
@tcharding tcharding deleted the 05-11-test-script branch May 16, 2022 01:20
heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
…I pipeline

ed51323a0bb3257b09abfb5eb51ca21815b815af Rename and simplify integration test job (Tobin C. Harding)
27df8630e5c7f419d5f1a3d0d7b2095f3731ab82 Run feature matrix tests (Tobin C. Harding)
ca9988de6cb441c5b4293d78fc0b3b10920d5333 Add additional information to nightly job (Tobin C. Harding)
a5718f76a9885a1e2c0d51992527bc3ed115fb94 Explicitly exit test script with 0 (Tobin C. Harding)
3913a08dfb3d55fd7b0153f66bb8c6d36fca0f6f Improve test coverage (Tobin C. Harding)
04577224f72bf66e24de7c5d0d0137797a706ed3 Do not run formatter in subprocess (Tobin C. Harding)
b072a5f8122fdc0ed162fb61b4cb748b46286d24 Do not run fuzzer in subprocess (Tobin C. Harding)
62d5169f210907d1bfe11085f1601fde50ede304 Fail script if command fails (Tobin C. Harding)

Pull request description:

  Make an effort to improve the test script, taking inspiration for the test script in `rust-secp256k1`. Since Bash can, at times, be a bit obscure, I made extra effort to do very simple discreet patches.

  First part of the PR is fixes to the test script, second part is improvements to the CI pipeline.

ACKs for top commit:
  sanket1729:
    ACK ed51323a0bb3257b09abfb5eb51ca21815b815af
  apoelstra:
    ACK ed51323a0bb3257b09abfb5eb51ca21815b815af

Tree-SHA512: 9e150b1faebc0d5ae73f7779129c1e8ec5c48bb5e73380793266f02b73636427a45aa378db6cbab8f815f655fd3ead2fffab6000bdb92cf7c443de507c72d261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants