* fix

* clp
This commit is contained in:
Dongjia Zhang 2022-04-05 01:07:19 +09:00 committed by GitHub
parent d4cdf02512
commit eaa46075cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 13 deletions

View File

@ -131,7 +131,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
let calibration = CalibrationStage::new(&edges_observer); let calibration = CalibrationStage::new(&edges_observer);
let power = let power =
StdPowerMutationalStage::new(&mut state, mutator, &edges_observer, PowerSchedule::FAST); StdPowerMutationalStage::new(&mut state, mutator, &edges_observer, PowerSchedule::COE);
let mut stages = tuple_list!(calibration, power); let mut stages = tuple_list!(calibration, power);

View File

@ -111,13 +111,16 @@ where
let meta = state.metadata().get::<ProbabilityMetadata>().unwrap(); let meta = state.metadata().get::<ProbabilityMetadata>().unwrap();
let threshold = meta.total_probability * rand_prob; let threshold = meta.total_probability * rand_prob;
let mut k: f64 = 0.0; let mut k: f64 = 0.0;
let mut ret = *meta.map.keys().last().unwrap();
for (idx, prob) in meta.map.iter() { for (idx, prob) in meta.map.iter() {
k += prob; k += prob;
if k >= threshold { if k >= threshold {
return Ok(*idx); ret = *idx;
break;
} }
} }
Ok(*meta.map.keys().last().unwrap()) *state.corpus_mut().current_mut() = Some(ret);
Ok(ret)
} }
} }
} }

View File

@ -86,8 +86,18 @@ where
let corpus = state.corpus(); let corpus = state.corpus();
let mut n_paths = 0; let mut n_paths = 0;
let mut v = 0.0; let mut v = 0.0;
let cur_index = state.corpus().current().unwrap();
for idx in 0..corpus.count() { for idx in 0..corpus.count() {
let n_fuzz_entry = corpus let n_fuzz_entry = if cur_index == idx {
entry
.metadata()
.get::<PowerScheduleTestcaseMetaData>()
.ok_or_else(|| {
Error::KeyNotFound("PowerScheduleTestData not found".to_string())
})?
.n_fuzz_entry()
} else {
corpus
.get(idx)? .get(idx)?
.borrow() .borrow()
.metadata() .metadata()
@ -95,7 +105,8 @@ where
.ok_or_else(|| { .ok_or_else(|| {
Error::KeyNotFound("PowerScheduleTestData not found".to_string()) Error::KeyNotFound("PowerScheduleTestData not found".to_string())
})? })?
.n_fuzz_entry(); .n_fuzz_entry()
};
v += libm::log2(f64::from(psmeta.n_fuzz()[n_fuzz_entry])); v += libm::log2(f64::from(psmeta.n_fuzz()[n_fuzz_entry]));
n_paths += 1; n_paths += 1;
} }

View File

@ -285,7 +285,7 @@ where
})?; })?;
psmeta.set_queue_cycles(psmeta.queue_cycles() + 1); psmeta.set_queue_cycles(psmeta.queue_cycles() + 1);
} }
*state.corpus_mut().current_mut() = Some(idx);
Ok(idx) Ok(idx)
} }
} }