Change DumpToDiskStage's callback (#1242)

This commit is contained in:
Dongjia "toka" Zhang 2023-05-03 11:16:53 +02:00 committed by GitHub
parent 5b02fb420d
commit cf79d13d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ where
impl<CB, E, EM, Z> Stage<E, EM, Z> for DumpToDiskStage<CB, EM, Z> impl<CB, E, EM, Z> Stage<E, EM, Z> for DumpToDiskStage<CB, EM, Z>
where where
CB: FnMut(&<Z::State as UsesInput>::Input) -> Vec<u8>, CB: FnMut(&<Z::State as UsesInput>::Input, &Z::State) -> Vec<u8>,
EM: UsesState<State = Z::State>, EM: UsesState<State = Z::State>,
E: UsesState<State = Z::State>, E: UsesState<State = Z::State>,
Z: UsesState, Z: UsesState,
@ -69,7 +69,7 @@ where
while let Some(i) = corpus_idx { while let Some(i) = corpus_idx {
let mut testcase = state.corpus().get(i)?.borrow_mut(); let mut testcase = state.corpus().get(i)?.borrow_mut();
state.corpus().load_input_into(&mut testcase)?; state.corpus().load_input_into(&mut testcase)?;
let bytes = (self.to_bytes)(testcase.input().as_ref().unwrap()); let bytes = (self.to_bytes)(testcase.input().as_ref().unwrap(), state);
let fname = self.corpus_dir.join(format!( let fname = self.corpus_dir.join(format!(
"id_{i}_{}", "id_{i}_{}",
@ -87,7 +87,7 @@ where
while let Some(i) = solutions_idx { while let Some(i) = solutions_idx {
let mut testcase = state.solutions().get(i)?.borrow_mut(); let mut testcase = state.solutions().get(i)?.borrow_mut();
state.solutions().load_input_into(&mut testcase)?; state.solutions().load_input_into(&mut testcase)?;
let bytes = (self.to_bytes)(testcase.input().as_ref().unwrap()); let bytes = (self.to_bytes)(testcase.input().as_ref().unwrap(), state);
let fname = self.solutions_dir.join(format!( let fname = self.solutions_dir.join(format!(
"id_{i}_{}", "id_{i}_{}",
@ -113,7 +113,6 @@ where
impl<CB, EM, Z> DumpToDiskStage<CB, EM, Z> impl<CB, EM, Z> DumpToDiskStage<CB, EM, Z>
where where
CB: FnMut(&<Z::State as UsesInput>::Input) -> Vec<u8>,
EM: UsesState<State = Z::State>, EM: UsesState<State = Z::State>,
Z: UsesState, Z: UsesState,
Z::State: HasCorpus + HasSolutions + HasRand + HasMetadata, Z::State: HasCorpus + HasSolutions + HasRand + HasMetadata,