Skip to content

Improve the test script and CI pipeline #405

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

Merged
merged 8 commits into from
May 15, 2022

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
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