HACK: interrupt limit for random fuzzing

This commit is contained in:
Alwin Berger 2023-05-25 08:40:43 +02:00
parent 1bca346b39
commit 35da9fdf24
2 changed files with 12 additions and 3 deletions

View File

@ -161,7 +161,7 @@ rule run_bench:
exit 0
"""
if wildcards.fuzzer.find('random') >= 0:
script="export FUZZ_RANDOM=1\n"+script
script="export FUZZ_RANDOM={output[1]}\n"+script
shell(script)
rule run_showmap:

View File

@ -46,6 +46,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
pub static mut RNG_SEED: u64 = 1;
pub static mut LIMIT : u32 = u32::MAX;
pub const MAX_NUM_INTERRUPT: usize = 32;
pub const DO_NUM_INTERRUPT: usize = 32;
pub static mut MAX_INPUT_SIZE: usize = 32;
@ -201,7 +203,7 @@ pub fn fuzz() {
t[j]=buf[i*4+j];
}
if i == 0 || true {
start_tick = u32::from_le_bytes(t);
unsafe {start_tick = u32::from_le_bytes(t) % LIMIT;}
} else {
start_tick = u32::saturating_add(start_tick,max(MINIMUM_INTER_ARRIVAL_TIME,u32::from_le_bytes(t)));
}
@ -435,7 +437,14 @@ pub fn fuzz() {
Ok(t) => {
println!("Iterations {}",t);
let num = str::parse::<u64>(&t).expect("FUZZ_ITERS was not a number");
if let Ok(_) = env::var("FUZZ_RANDOM") { unsafe {
if let Ok(s) = env::var("FUZZ_RANDOM") { unsafe {
if s.contains("watersv2_int") {
println!("V2");
LIMIT=7000000;
} else {
println!("V1");
LIMIT=5000000;
}
println!("Random Fuzzing, ignore corpus");
// let mut generator = RandBytesGenerator::new(MAX_INPUT_SIZE);
let target_duration = Duration::from_secs(num);