Skip to content

Commit

Permalink
complain if runner fails
Browse files Browse the repository at this point in the history
  • Loading branch information
R9295 committed Dec 11, 2024
1 parent c4fd49a commit 2046ec3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 3 additions & 6 deletions examples/url/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ fn idempotency_fuzz(data: &str) {

fn main() {
ziggy::fuzz!(|data: &[u8]| {
if let Ok(string) = std::str::from_utf8(data) {
invariant_fuzz(string);
differential_fuzz(string);
correctness_fuzz(string);
consistency_fuzz(string);
idempotency_fuzz(string);
let ptr = 0 as *const i32;
unsafe {
println!("Value: {}", *ptr);
}
});
}
8 changes: 5 additions & 3 deletions src/bin/cargo-ziggy/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ impl Build {

eprintln!(" {} honggfuzz", style("Finished").cyan().bold());
}

if std::env::var("AFL_LLVM_CMPGLOG").is_ok() {
panic!("Even the mighty may fall, especially on 77b2c27a59bb858045c4db442989ce8f20c8ee11")
panic!(
"Even the mighty may fall, especially on 77b2c27a59bb858045c4db442989ce8f20c8ee11"
)
}

Ok(())
}
}
11 changes: 10 additions & 1 deletion src/bin/cargo-ziggy/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use console::style;
use std::{
collections::HashSet,
env, fs,
os::unix::process::ExitStatusExt,
path::{Path, PathBuf},
process,
};
Expand Down Expand Up @@ -78,14 +79,22 @@ impl Run {
false => format!("./target/runner/debug/{}", target),
};

process::Command::new(runner_path)
let res = process::Command::new(runner_path)
.args(run_args)
.env("RUST_BACKTRACE", "full")
.spawn()
.context("⚠️ couldn't spawn the runner process")?
.wait()
.context("⚠️ couldn't wait for the runner process")?;

if !res.success() {
if let Some(signal) = res.signal() {
println!("⚠️ input terminated with signal {:?}!", signal);
} else if let Some(exit_code) = res.code() {
println!("⚠️ input terminated with code {:?}!", exit_code);
}
}

Ok(())
}
}
Expand Down

0 comments on commit 2046ec3

Please sign in to comment.