summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-12-15 01:09:16 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-12-15 01:09:16 +0000
commit7348681b6559c6d623fd47fbc656f924e9c7bcdc (patch)
treea2911b7eae9b2ab3318849a6cdceed3d355acd05
parent5178a7b8eaf1f5ed6259ce95b7badf88518d9cf0 (diff)
downloadgentoo-utils-7348681b6559c6d623fd47fbc656f924e9c7bcdc.tar.gz
gate atom parser fuzzer debug printing
-rw-r--r--fuzz/atom/parser/fuzz.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/fuzz/atom/parser/fuzz.rs b/fuzz/atom/parser/fuzz.rs
index 77988c7..b727c24 100644
--- a/fuzz/atom/parser/fuzz.rs
+++ b/fuzz/atom/parser/fuzz.rs
@@ -3,7 +3,10 @@
use core::slice;
use gentoo_utils::{Parseable, atom::Atom};
-use std::io::{self, Write};
+use std::{
+ env::{self},
+ io::{self, Write},
+};
#[unsafe(no_mangle)]
pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> i32 {
@@ -32,10 +35,14 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
match (control, gentoo_utils) {
(Ok(_), Ok(_)) => {
- eprintln!("agreement that {str} is valid");
+ if env::var("FUZZER_LOG").is_ok() {
+ eprintln!("agreement that {str} is valid");
+ }
}
(Err(_), Err(_)) => {
- eprintln!("agreement that {str} is invalid");
+ if env::var("FUZZER_LOG").is_ok() {
+ eprintln!("agreement that {str} is invalid");
+ }
}
(Ok(_), Err(rest)) => {
panic!("disagreement on {str}\ncontrol:Ok\ngentoo-utils:Err({rest})");
@@ -49,9 +56,11 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
> 1
}) =>
{
- eprintln!(
- "disagreement, but we will allow it since its probably because of duplicated usdeps"
- );
+ if env::var("FUZZER_LOG").is_ok() {
+ eprintln!(
+ "disagreement, but we will allow it since its probably because of duplicated usdeps"
+ );
+ }
}
(Err(_), Ok(_)) => {
panic!("disagreement on {str}\ncontrol:Err\ngentoo-utils:Ok")