Skip to content

Commit

Permalink
deep testing for stage resumeability
Browse files Browse the repository at this point in the history
  • Loading branch information
addisoncrump committed Jan 7, 2024
1 parent c6af1ca commit 2683c9f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions libafl/src/stages/logics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,28 @@ mod test {
test_resume(&completed, &mut state, tuple_list!(ifstage, resetstage));
}

#[test]
fn check_resumability_if_deep() {
let (completed, stages) = test_resume_stages();
let ifstage = IfStage::new(
|_, _, _, _| Ok(true),
tuple_list!(IfStage::new(
|_, _, _, _| Ok(true),
tuple_list!(IfStage::new(
|_, _, _, _| Ok(true),
tuple_list!(IfStage::new(
|_, _, _, _| Ok(true),
tuple_list!(IfStage::new(|_, _, _, _| Ok(true), stages),),
),),
))
)),
);

let mut state = test_std_state::<NopInput>();

test_resume(&completed, &mut state, tuple_list!(ifstage));
}

#[derive(Debug)]
pub struct PanicStage<S> {
phantom: PhantomData<S>,
Expand Down Expand Up @@ -462,4 +484,34 @@ mod test {

test_resume(&completed, &mut state, tuple_list!(ifstage, resetstage));
}

#[test]
fn check_resumability_if_else_else_deep() {
let (completed, stages) = test_resume_stages();
let ifstage = IfElseStage::new(
|_, _, _, _| Ok(false),
tuple_list!(PanicStage::new()),
tuple_list!(IfElseStage::new(
|_, _, _, _| Ok(false),
tuple_list!(PanicStage::new()),
tuple_list!(IfElseStage::new(
|_, _, _, _| Ok(false),
tuple_list!(PanicStage::new()),
tuple_list!(IfElseStage::new(
|_, _, _, _| Ok(false),
tuple_list!(PanicStage::new()),
tuple_list!(IfElseStage::new(
|_, _, _, _| Ok(false),
tuple_list!(PanicStage::new()),
stages,
)),
)),
)),
)),
);

let mut state = test_std_state::<NopInput>();

test_resume(&completed, &mut state, tuple_list!(ifstage));
}
}

0 comments on commit 2683c9f

Please sign in to comment.