Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ jobs:
- name: cd nostd && cargo +nightly clippy -- --deny=warnings
run: cargo +nightly clippy -- --deny=warnings
working-directory: nostd
- name: cd lib/fuzz && cargo +nightly clippy --lib --examples -- --deny=warnings
run: cargo +nightly clippy --lib --examples -- --deny=warnings
working-directory: lib/fuzz
- name: cd lib/fuzz && cargo +nightly clippy -- --deny=warnings
env:
RUSTFLAGS: --cfg=fuzzing
run: cargo +nightly clippy -- --deny=warnings
working-directory: lib/fuzz
- name: cd lib && cargo +nightly build
Expand Down Expand Up @@ -103,7 +108,12 @@ jobs:
- name: cd nostd && cargo +nightly build --release
run: cargo +nightly build --release
working-directory: nostd
- name: cd lib/fuzz && cargo +nightly build --lib --examples
run: cargo +nightly build --lib --examples
working-directory: lib/fuzz
- name: cd lib/fuzz && cargo +nightly build
env:
RUSTFLAGS: --cfg=fuzzing
run: cargo +nightly build
working-directory: lib/fuzz
- name: cd cmp && cargo +nightly build
Expand All @@ -128,8 +138,8 @@ jobs:
- name: cd nostd && cargo +nightly run --release --features=alloc
run: cargo +nightly run --release --features=alloc
working-directory: nostd
- name: cd lib/fuzz && cargo +nightly test
run: cargo +nightly test
- name: cd lib/fuzz && cargo +nightly test --lib
run: cargo +nightly test --lib
working-directory: lib/fuzz
- name: cd cmp && cargo +nightly test
run: cargo +nightly test
Expand Down
47 changes: 34 additions & 13 deletions lib/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2021"
rust-version = "1.81"

[package.metadata]
cargo-fuzz = true
Expand All @@ -13,20 +12,42 @@ cargo-fuzz = true
data-encoding = { path = ".." }
libfuzzer-sys = "0.4.3"

# Fuzz targets organization based on prefix:
# - fuzz_FOO: FOO holds for the fuzzing tools (property testing)
# - impl_FOO: FOO is correctly implemented (differential testing)
# - spec_FOO: FOO holds for the specification (property testing)

[[bin]]
name = "fuzz_any_spec"
path = "fuzz_targets/fuzz_any_spec.rs"

[[bin]]
name = "impl_encode"
path = "fuzz_targets/impl_encode.rs"

[[bin]]
name = "impl_decode"
path = "fuzz_targets/impl_decode.rs"

[[bin]]
name = "impl_new_encoder"
path = "fuzz_targets/impl_new_encoder.rs"

[[bin]]
name = "round_trip"
path = "fuzz_targets/round_trip.rs"
test = false
doc = false
name = "impl_encode_write_buffer"
path = "fuzz_targets/impl_encode_write_buffer.rs"

[[bin]]
name = "encoder"
path = "fuzz_targets/encoder.rs"
test = false
doc = false
name = "spec_spec_base"
path = "fuzz_targets/spec_spec_base.rs"

[[bin]]
name = "encode_write"
path = "fuzz_targets/encode_write.rs"
test = false
doc = false
name = "spec_encode_decode"
path = "fuzz_targets/spec_encode_decode.rs"

[[bin]]
name = "spec_decode_encode"
path = "fuzz_targets/spec_decode_encode.rs"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
3 changes: 3 additions & 0 deletions lib/fuzz/analyze.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

cargo run --manifest-path=fuzz/Cargo.toml --release --example=analyze -- "$@"
5 changes: 5 additions & 0 deletions lib/fuzz/compact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

for target in $(cargo fuzz list); do
cargo fuzz cmin $target
done
3 changes: 3 additions & 0 deletions lib/fuzz/debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

cargo run --manifest-path=fuzz/Cargo.toml --example=debug -- "$1"
Loading