Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Improve feature coverage in CI test suite #147

Merged
merged 5 commits into from
Feb 3, 2022

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Jan 27, 2022

Improve feature testing by adding all the features to the test matrix and enabling testing with --no-default-features.

@apoelstra
Copy link
Member

I'm hesitant about the have_allocator feature ... it is tempting, and possibly gives extreme power users a way to hack past our "real" feature matrix, but it can be simulated using #[any(...)] and #[all(...)] within the code itself, which is a bit nicer from a user perspective (even though it can be harder to keep in sync rom our persective)

@tcharding
Copy link
Member Author

No worries, I'll pull that change out of the PR and re-spin. Thanks for looking.

The feature "serde-std" gets tested along with "std" during the combos
of two loop, no need to run it explicitly.
Currently when we run the test suite we always enable the "std" feature.
There are tests that can be run without "std", we should run these
without "std" to better test our no-std code.
Currently we always run tests with "std" enabled. It is currently not
possible to run the tests without an allocator but there is no reason
that we should not be able to run allocation free tests without an
allocator, doing so is better because it tests our claim that the lib
can be used without an allocator.
@tcharding tcharding force-pushed the feature-gating branch 4 times, most recently from e7f5513 to 746f39e Compare February 1, 2022 23:58
In order to assist users of the library understanding which features
should be enabled for what functionality add documentation to the
optional dependencies.
@tcharding tcharding marked this pull request as ready for review February 2, 2022 01:41
@@ -41,6 +42,9 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then
done
done

# Other combos
# TODO: Add this test once we bump MSRV past 1.29
# cargo test --all --no-default-features --features="std,schemars"
Copy link
Member

Choose a reason for hiding this comment

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

In af992d7:

Did you intend to comment out this line? From your commit message it sounds like you do intend to test std and schemars.

We definitely need schemars to be tested in CI somehow. Historically we have had breakage from this dependency that went undetected by CI. (This is why, incidentally, I worte all my own independent CI scripts, and also why schemars is not a dependency in any other rust-bitcoin crate.)

Copy link
Member Author

@tcharding tcharding Feb 2, 2022

Choose a reason for hiding this comment

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

Shit, I've been a bit sloppy lately fixing commit messages when re-basing. I'm still struggling big time with Rust 1.29, I have some shell functions to build with 1.29 but I often forget to use them because they are not well tied in with my editor ... so I'm constantly re-basing and getting punished by CI. You might have noticed all the force pushes in my PRs :) I'm being lazy, we are so close to bumping to 1.41

We have extended_tests which test bitcoin_hashes with serde, schemars, and std enabled. The schemars feature doesn't build on its own at the moment cargo check --no-default-features --features=schemars fails. I didn't investigate why I just added this comment to remind us.

I added this commented out line with the MSRV comment since I've seen that done in a few places and have started doing it. Now as I write this message I think it would be better to add all these to the edition 2018 tracking issue instead of leaving it in the code. Oh that's right, the tracking issue is not on this repo its on rust-bitcoin.

Will fix the commit log.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, good observation that we'll be bumping to 1.41.0 soon, and at that point we can put schemars into the normal CI pipeline.

We get build errors when building with Rust 1.29 for `core2` and
`schemars`. Add todos to remind us to test theses once we bump MSRV.

Note the `schemars` cannot be added to the test matrix because it must
be built with `std`, we must add a specific test for this combination.

Example build error:

```
error: unable to get packages from source

Caused by:
failed to parse manifest at `/home/tobin/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/core2-0.3.3/Cargo.toml`

Caused by:
editions are unstable

Caused by:
feature `edition` is required
```

Add a TODO to `test.sh` to remind us to add `core2` to the features
matrix once we bump MSRV.

Add a commented out schemars/std test and a note to uncomment test once
we bump MSRV past 1.29
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 5dc3fd4

No user-visible changes, good to merge.

@apoelstra apoelstra merged commit 029d665 into rust-bitcoin:master Feb 3, 2022
@tcharding tcharding deleted the feature-gating branch April 6, 2022 23:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants