contrib: Only print fuzz output on failure

This makes it humanly possible to track progress as only "[N/M]"-lines are printed as long as we succeed.

Also, use char (a, b) to indicate run_id instead of u8 (0, 1).
Also, use emojis to indicate final success or error.

Co-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>
This commit is contained in:
MarcoFalke
2025-03-31 14:02:45 +02:00
parent fa82fe2c73
commit fa900bb2dc
2 changed files with 26 additions and 22 deletions

View File

@@ -71,7 +71,7 @@ fn app() -> AppResult {
fn deterministic_coverage(build_dir: &Path, test_exe: &Path, filter: &str) -> AppResult {
let profraw_file = build_dir.join("test_det_cov.profraw");
let profdata_file = build_dir.join("test_det_cov.profdata");
let run_single = |run_id: u8| -> Result<PathBuf, AppError> {
let run_single = |run_id: char| -> Result<PathBuf, AppError> {
println!("Run with id {run_id}");
let cov_txt_path = build_dir.join(format!("test_det_cov.show.{run_id}.txt"));
if !Command::new(test_exe)
@@ -131,10 +131,10 @@ fn deterministic_coverage(build_dir: &Path, test_exe: &Path, filter: &str) -> Ap
}
Ok(())
};
let r0 = run_single(0)?;
let r1 = run_single(1)?;
let r0 = run_single('a')?;
let r1 = run_single('b')?;
check_diff(&r0, &r1)?;
println!("The coverage was deterministic across two runs.");
println!("The coverage was deterministic across two runs.");
Ok(())
}
@@ -142,7 +142,7 @@ fn main() -> ExitCode {
match app() {
Ok(()) => ExitCode::SUCCESS,
Err(err) => {
eprintln!("{}", err);
eprintln!("⚠️\n{}", err);
ExitCode::FAILURE
}
}