Skip to content

Commit 18138bd

Browse files
committed
Enable disabling --cfg fuzzing_repro
Changing `RUSTFLAGS` causes a recompile of the entire project so for projects that are expensive to build this option being enabled by default means that workflows which switch back-and-forth between fuzzing and running individual tests generate a full rebuild every time. This adds a `--no-cfg-fuzzing` option on the `cargo fuzz run` CLI to disable this `--cfg` argument from being passed.
1 parent 7302ebf commit 18138bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/options/run.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ pub struct Run {
2929
/// Number of concurrent jobs to run
3030
pub jobs: u16,
3131

32+
/// By default the 'cfg(fuzzing_repro)' compilation configuration is set
33+
/// when a single test case is being run, and this flag allows you to opt
34+
/// out of it.
35+
#[arg(long)]
36+
pub no_cfg_fuzzing_repro: bool,
37+
3238
#[arg(last(true))]
3339
/// Additional libFuzzer arguments passed through to the binary
3440
pub args: Vec<String>,
@@ -37,7 +43,7 @@ pub struct Run {
3743
impl RunCommand for Run {
3844
fn run_command(&mut self) -> Result<()> {
3945
let project = FuzzProject::new(self.fuzz_dir_wrapper.fuzz_dir.to_owned())?;
40-
self.build.cfg_fuzzing_repro = !self.corpus.is_empty();
46+
self.build.cfg_fuzzing_repro = !self.corpus.is_empty() && !self.no_cfg_fuzzing_repro;
4147
project.exec_fuzz(self)
4248
}
4349
}

0 commit comments

Comments
 (0)