Skip to content

Commit d81d4f7

Browse files
authored
Merge pull request #165 from nyonson/clean-up-fuzz
Clean up fuzzing
2 parents 62ecf77 + 417d74b commit d81d4f7

File tree

8 files changed

+12
-62
lines changed

8 files changed

+12
-62
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[workspace]
2-
members = ["protocol", "protocol/fuzz", "traffic"]
3-
default-members = ["protocol", "traffic"]
2+
members = ["protocol", "traffic"]
3+
exclude = ["fuzz"]
44
resolver = "2"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cargo-fuzz = true
99

1010
[dependencies]
1111
libfuzzer-sys = "0.4"
12-
bip324 = { path = ".." }
12+
bip324 = { path = "../protocol" }
1313
rand = "0.8"
1414
secp256k1 = "0.29"
1515

File renamed without changes.
File renamed without changes.

justfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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.

protocol/fuzz/coverage.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)