Better error message in testcase_score.rs pt.2 (#2863)

* msg

* l
This commit is contained in:
Dongjia "toka" Zhang 2025-01-18 13:07:14 +01:00 committed by GitHub
parent 019c71a368
commit 2e26af90db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -312,12 +312,13 @@ where
None => 0.0, None => 0.0,
}; };
let avg_top_size = let avg_top_size = match state.metadata::<TopRatedsMetadata>() {
match state.metadata::<TopRatedsMetadata>() {
Ok(m) => m.map().len() as f64, Ok(m) => m.map().len() as f64,
Err(_) => return Err(Error::key_not_found( Err(e) => {
"TopRatedsMetadata not found! You have to use Minimizer scheduler with this.", return Err(Error::key_not_found(format!(
)), "{e:?} You have to use Minimizer scheduler with this.",
)))
}
}; };
weight *= 1.0 + (tc_ref / avg_top_size); weight *= 1.0 + (tc_ref / avg_top_size);

View File

@ -38,7 +38,11 @@ impl<E, EM, TE, S, Z> Stage<E, EM, S, Z> for AFLppCmplogTracingStage<'_, EM, TE,
where where
TE: HasObservers + Executor<EM, BytesInput, S, Z>, TE: HasObservers + Executor<EM, BytesInput, S, Z>,
TE::Observers: MatchNameRef + ObserversTuple<BytesInput, S>, TE::Observers: MatchNameRef + ObserversTuple<BytesInput, S>,
S: HasCorpus<BytesInput> + HasCurrentTestcase<BytesInput> + HasMetadata + HasNamedMetadata + HasCurrentCorpusId, S: HasCorpus<BytesInput>
+ HasCurrentTestcase<BytesInput>
+ HasMetadata
+ HasNamedMetadata
+ HasCurrentCorpusId,
{ {
#[inline] #[inline]
fn perform( fn perform(