11# Every commit on the master branch is expected to have working `check` and `test-*` recipes.
22#
33# The recipes make heavy use of `rustup`'s toolchain syntax (e.g. `cargo +nightly`). `rustup` is
4- # required on the system in order to intercept the `cargo` commands and to install and use the appropriate toolchain with components.
4+ # required on the system in order to intercept the `cargo` commands and to install and use the appropriate toolchain with components.
55#
66# The root directory of this workspace is "virtual", it has no source code itself, just a holder of crates. This means
77# the cargo commands generally run on all the child crates by default without the `--workspace` flag.
@@ -36,12 +36,12 @@ STABLE_TOOLCHAIN := "1.88.0"
3636 # Adding --fix flag to apply suggestions with --allow-dirty.
3737 cargo + {{ NIGHTLY_TOOLCHAIN}} clippy --all-features --all-targets --fix --allow-dirty -- -D warnings
3838
39- # Run a test suite: features, msrv, constraints, no-std, or all.
39+ # Run a test suite: features, msrv, constraints, no-std, fuzz, or all.
4040@ test suite = " features":
4141 just _test-{{ suite}}
4242
4343# Run all test suites.
44- @_ test-all : _test-features _test-msrv _test-constraints _test-no-std
44+ @_ test-all : _test-features _test-msrv _test-constraints _test-no-std _test-fuzz
4545
4646# Test library with feature flag matrix compatability.
4747@_ test-features :
@@ -68,7 +68,7 @@ STABLE_TOOLCHAIN := "1.88.0"
6868 # Clear any previously resolved versions and re-resolve to the minimums.
6969 rm -f Cargo.lock
7070 cargo + {{ NIGHTLY_TOOLCHAIN}} check --all-features -Z direct-minimal-versions
71- # Clear again and check the maximums by ignoring any rust-version caps.
71+ # Clear again and check the maximums by ignoring any rust-version caps.
7272 rm -f Cargo.lock
7373 cargo + {{ NIGHTLY_TOOLCHAIN}} check --all-features --ignore-rust-version
7474 rm -f Cargo.lock
@@ -78,21 +78,15 @@ STABLE_TOOLCHAIN := "1.88.0"
7878 cargo install cross@0.2.5
7979 $HOME/ .cargo/ bin/ cross build --package bip324 --target thumbv7m-none-eabi --no-default-features
8080
81+ # Check that fuzz targets compile.
82+ @_ test-fuzz :
83+ cargo install cargo-fuzz@0.12.0
84+ cargo + {{ NIGHTLY_TOOLCHAIN}} fuzz build
85+
8186# Run benchmarks.
8287@ bench :
8388 cargo + {{ NIGHTLY_TOOLCHAIN}} bench --package bip324 --bench cipher_session
8489
85- # Run fuzz target: receive_key or receive_garbage.
86- @ fuzz target seconds :
87- rustup component add --toolchain {{ NIGHTLY_TOOLCHAIN}} llvm-tools-preview
88- cargo install cargo-fuzz@0.12.0
89- # Generate new test cases and add to corpus. Bumping length for garbage.
90- cd protocol && cargo + {{ NIGHTLY_TOOLCHAIN}} fuzz run {{ target}} -- -max_len=5120 -max_total_time={{ seconds}}
91- # Measure coverage of corpus against code.
92- cd protocol && cargo + {{ NIGHTLY_TOOLCHAIN}} fuzz coverage {{ target}}
93- # Generate HTML coverage report.
94- protocol/ fuzz/ coverage.sh {{ NIGHTLY_TOOLCHAIN}} {{ target}}
95-
9690# Add a release tag and publish to the upstream remote. Requires write privileges.
9791@ tag crate version remote = " upstream":
9892 # Guardrails: on a clean main with updated changelog and manifest.
0 commit comments