Fix metadata loss across state-restore. (#582)
* bug fix * fix * fix * remove getter
This commit is contained in:
parent
c88e38d9f4
commit
1167389149
@ -532,7 +532,9 @@ where
|
||||
{
|
||||
/// Create a new [`StdMOptMutator`].
|
||||
pub fn new(state: &mut S, mutations: MT, swarm_num: usize) -> Result<Self, Error> {
|
||||
if !state.has_metadata::<MOpt>() {
|
||||
state.add_metadata::<MOpt>(MOpt::new(mutations.len(), swarm_num)?);
|
||||
}
|
||||
Ok(Self {
|
||||
mode: MOptMode::Pilotfuzzing,
|
||||
finds_before: 0,
|
||||
|
@ -263,7 +263,16 @@ where
|
||||
/// Creates a new [`CoverageAccountingScheduler`] that wraps a `base` [`Scheduler`]
|
||||
/// and has a default probability to skip non-faved [`Testcase`]s of [`DEFAULT_SKIP_NON_FAVORED_PROB`].
|
||||
pub fn new(state: &mut S, base: CS, accounting_map: &'a [u32]) -> Self {
|
||||
match state.metadata().get::<TopAccountingMetadata>() {
|
||||
Some(meta) => {
|
||||
if meta.max_accounting.len() != accounting_map.len() {
|
||||
state.add_metadata(TopAccountingMetadata::new(accounting_map.len()));
|
||||
}
|
||||
}
|
||||
None => {
|
||||
state.add_metadata(TopAccountingMetadata::new(accounting_map.len()));
|
||||
}
|
||||
}
|
||||
Self {
|
||||
accounting_map,
|
||||
inner: MinimizerScheduler::new(base),
|
||||
@ -279,7 +288,16 @@ where
|
||||
skip_non_favored_prob: u64,
|
||||
accounting_map: &'a [u32],
|
||||
) -> Self {
|
||||
match state.metadata().get::<TopAccountingMetadata>() {
|
||||
Some(meta) => {
|
||||
if meta.max_accounting.len() != accounting_map.len() {
|
||||
state.add_metadata(TopAccountingMetadata::new(accounting_map.len()));
|
||||
}
|
||||
}
|
||||
None => {
|
||||
state.add_metadata(TopAccountingMetadata::new(accounting_map.len()));
|
||||
}
|
||||
}
|
||||
Self {
|
||||
accounting_map,
|
||||
inner: MinimizerScheduler::with_skip_prob(base, skip_non_favored_prob),
|
||||
|
@ -182,7 +182,9 @@ where
|
||||
{
|
||||
/// Creates a new [`PowerMutationalStage`]
|
||||
pub fn new(state: &mut S, mutator: M, map_observer_name: &O, strat: PowerSchedule) -> Self {
|
||||
if !state.has_metadata::<PowerScheduleMetadata>() {
|
||||
state.add_metadata::<PowerScheduleMetadata>(PowerScheduleMetadata::new(strat));
|
||||
}
|
||||
Self {
|
||||
map_observer_name: map_observer_name.name().to_string(),
|
||||
mutator,
|
||||
|
Loading…
x
Reference in New Issue
Block a user