Skip to content

Commit

Permalink
Experimental support for parallel fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed May 9, 2024
1 parent 3ef9989 commit 224bce0
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 85 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ Options:
--backtrace Display backtraces
--consolidate Move one target's crashes, hangs, and work queue to its corpus; to
consolidate all targets, use --consolidate-all
--cpus <N> Fuzz using at most <N> cpus; default is all but one
--display <OBJECT> Display corpus, crashes, generic args, `impl` generic args, hangs,
or work queue. By default, corpus uses an uninstrumented fuzz
target; the others use an instrumented fuzz target. To display the
Expand Down Expand Up @@ -282,6 +283,8 @@ Options:
reset all targets, use --reset-all
--resume Resume target's last fuzzing session
--run-until-crash Stop fuzzing once a crash is found
--slice <SECONDS> When there are not sufficiently many cpus to fuzz all targets
concurrently, fuzz them in intervals of <SECONDS> [default: 1200]
--test <NAME> Integration test containing fuzz target
--timeout <TIMEOUT> Number of seconds to consider a hang when fuzzing or replaying
(equivalent to -- -t <TIMEOUT * 1000> when fuzzing)
Expand Down
2 changes: 2 additions & 0 deletions cargo-test-fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ clap = { version = "4.5", features = ["cargo", "derive", "wrap_help"] }
env_logger = "0.11"
heck = "0.5"
log = "0.4"
mio = { version = "0.8", features = ["os-ext", "os-poll"] }
num_cpus = "1.16"
paste = "1.0"
remain = "0.2"
semver = "1.0"
Expand Down
18 changes: 18 additions & 0 deletions cargo-test-fuzz/src/bin/cargo_test_fuzz/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ struct TestFuzzWithDeprecations {
consolidate: bool,
#[arg(long, hide = true)]
consolidate_all: bool,
#[arg(
long,
value_name = "N",
help = "Fuzz using at most <N> cpus; default is all but one"
)]
cpus: Option<usize>,
#[arg(
long,
value_name = "OBJECT",
Expand Down Expand Up @@ -107,6 +113,14 @@ struct TestFuzzWithDeprecations {
resume: bool,
#[arg(long, help = "Stop fuzzing once a crash is found")]
run_until_crash: bool,
#[arg(
long,
value_name = "SECONDS",
default_value = "1200",
help = "When there are not sufficiently many cpus to fuzz all targets concurrently, fuzz \
them in intervals of <SECONDS>"
)]
slice: u64,
#[arg(
long,
value_name = "NAME",
Expand Down Expand Up @@ -136,6 +150,7 @@ impl From<TestFuzzWithDeprecations> for super::TestFuzz {
backtrace,
consolidate,
consolidate_all,
cpus,
display,
exact,
exit_code,
Expand All @@ -155,6 +170,7 @@ impl From<TestFuzzWithDeprecations> for super::TestFuzz {
reset_all,
resume,
run_until_crash,
slice,
test,
timeout,
verbose,
Expand All @@ -165,6 +181,7 @@ impl From<TestFuzzWithDeprecations> for super::TestFuzz {
backtrace,
consolidate,
consolidate_all,
cpus,
display,
exact,
exit_code,
Expand All @@ -184,6 +201,7 @@ impl From<TestFuzzWithDeprecations> for super::TestFuzz {
reset_all,
resume,
run_until_crash,
slice,
test,
timeout,
verbose,
Expand Down
Loading

0 comments on commit 224bce0

Please sign in to comment.