Create binary for processing fuzz crashes
This commit is contained in:
parent
2ffb626573
commit
03879c223a
|
@ -0,0 +1,2 @@
|
||||||
|
/target/
|
||||||
|
/Cargo.lock
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "hyperbuild-fuzz-process"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = ["Wilson Lin <code@wilsonl.in>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
hyperbuild = { path = "../.." }
|
|
@ -0,0 +1,21 @@
|
||||||
|
use std::fs;
|
||||||
|
use std::io::{self, Write};
|
||||||
|
use std::panic;
|
||||||
|
use hyperbuild;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
for dirent in fs::read_dir("../out/crashes").unwrap() {
|
||||||
|
let path = dirent.unwrap().path().to_path_buf();
|
||||||
|
let path_in_catch = path.clone();
|
||||||
|
let res = panic::catch_unwind(|| {
|
||||||
|
let mut contents = fs::read(path_in_catch).unwrap();
|
||||||
|
let _ = hyperbuild::hyperbuild(&mut contents);
|
||||||
|
});
|
||||||
|
if res.is_err() {
|
||||||
|
let contents = fs::read(path).unwrap();
|
||||||
|
io::stdout().write_all(&contents).unwrap();
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
fs::remove_file(path).unwrap();
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue