Skip to content

Commit

Permalink
Merge pull request #362 from alexcrichton/remove-cfg-fuzzing-repro
Browse files Browse the repository at this point in the history
Revert "Add `--cfg fuzzing_repro` when reproducing a crash"
  • Loading branch information
fitzgen authored Feb 20, 2024
2 parents 7302ebf + 84b1c63 commit 5a29637
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
8 changes: 0 additions & 8 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ pub struct BuildOptions {
#[arg(long)]
pub no_cfg_fuzzing: bool,

#[arg(skip = false)]
/// Add the 'cfg(fuzzing-repro)' compilation configuration. This build
/// option will be automatically used when running `cargo fuzz run <target>
/// <corpus>`. The option will not be shown to the user, which is ensured by
/// the `skip` attribute.
pub cfg_fuzzing_repro: bool,

#[arg(long)]
/// Don't build with the `sanitizer-coverage-trace-compares` LLVM argument
///
Expand Down Expand Up @@ -239,7 +232,6 @@ mod test {
coverage: false,
strip_dead_code: false,
no_cfg_fuzzing: false,
cfg_fuzzing_repro: false,
no_trace_compares: false,
};

Expand Down
1 change: 0 additions & 1 deletion src/options/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub struct Run {
impl RunCommand for Run {
fn run_command(&mut self) -> Result<()> {
let project = FuzzProject::new(self.fuzz_dir_wrapper.fuzz_dir.to_owned())?;
self.build.cfg_fuzzing_repro = !self.corpus.is_empty();
project.exec_fuzz(self)
}
}
4 changes: 0 additions & 4 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ impl FuzzProject {
rustflags.push_str(" --cfg fuzzing");
}

if build.cfg_fuzzing_repro {
rustflags.push_str(" --cfg fuzzing_repro");
}

if !build.strip_dead_code {
rustflags.push_str(" -Clink-dead-code");
}
Expand Down
19 changes: 4 additions & 15 deletions tests/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ fn run_no_crash() {
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
#[cfg(fuzzing_repro)]
eprintln!("Reproducing a crash");
run_no_crash::pass_fuzzing(data);
});
"#,
Expand All @@ -254,10 +251,7 @@ fn run_no_crash() {
.arg("--")
.arg("-runs=1000")
.assert()
.stderr(
predicate::str::contains("Done 1000 runs")
.and(predicate::str::contains("Reproducing a crash").not()),
)
.stderr(predicate::str::contains("Done 1000 runs"))
.success();
}

Expand Down Expand Up @@ -500,9 +494,6 @@ fn run_one_input() {
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
#[cfg(fuzzing_repro)]
eprintln!("Reproducing a crash");
assert!(data.is_empty());
});
"#,
Expand All @@ -518,11 +509,9 @@ fn run_one_input() {
.arg(corpus.join("pass"))
.assert()
.stderr(
predicate::str::contains("Running 1 inputs 1 time(s) each.")
.and(predicate::str::contains(
"Running: fuzz/corpus/run_one/pass",
))
.and(predicate::str::contains("Reproducing a crash")),
predicate::str::contains("Running 1 inputs 1 time(s) each.").and(
predicate::str::contains("Running: fuzz/corpus/run_one/pass"),
),
)
.success();
}
Expand Down

0 comments on commit 5a29637

Please sign in to comment.