@@ -43,7 +43,7 @@ use crate::{
4343 ProgressReporter ,
4444 } ,
4545 executors:: { Executor , HasObservers } ,
46- fuzzer:: { EvaluatorObservers , ExecutionProcessor } ,
46+ fuzzer:: { Evaluator , EvaluatorObservers , ExecutionProcessor } ,
4747 inputs:: { NopInput , UsesInput } ,
4848 observers:: ObserversTuple ,
4949 state:: { HasExecutions , HasLastReportTime , NopState , State , UsesState } ,
5959{
6060 /// We only send 1 testcase for every `throttle` second
6161 pub ( crate ) throttle : Option < Duration > ,
62+ /// Treat the incoming testcase as interesting always without evaluating them
63+ always_interesting : bool ,
6264 /// We sent last message at `last_sent`
6365 last_sent : Duration ,
6466 hooks : EMH ,
@@ -98,6 +100,7 @@ impl LlmpEventManager<(), NopState<NopInput>, NopShMemProvider> {
98100pub struct LlmpEventManagerBuilder < EMH > {
99101 throttle : Option < Duration > ,
100102 hooks : EMH ,
103+ always_interesting : bool ,
101104}
102105
103106impl Default for LlmpEventManagerBuilder < ( ) > {
@@ -113,6 +116,7 @@ impl LlmpEventManagerBuilder<()> {
113116 Self {
114117 throttle : None ,
115118 hooks : ( ) ,
119+ always_interesting : false ,
116120 }
117121 }
118122
@@ -121,6 +125,17 @@ impl LlmpEventManagerBuilder<()> {
121125 LlmpEventManagerBuilder {
122126 throttle : self . throttle ,
123127 hooks,
128+ always_interesting : self . always_interesting ,
129+ }
130+ }
131+
132+ /// Set `always_interesting`
133+ #[ must_use]
134+ pub fn always_interesting ( self , always_interesting : bool ) -> LlmpEventManagerBuilder < ( ) > {
135+ LlmpEventManagerBuilder {
136+ throttle : self . throttle ,
137+ hooks : self . hooks ,
138+ always_interesting,
124139 }
125140 }
126141}
@@ -149,6 +164,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
149164 throttle : self . throttle ,
150165 last_sent : Duration :: from_secs ( 0 ) ,
151166 hooks : self . hooks ,
167+ always_interesting : self . always_interesting ,
152168 llmp,
153169 #[ cfg( feature = "llmp_compression" ) ]
154170 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -178,6 +194,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
178194 throttle : self . throttle ,
179195 last_sent : Duration :: from_secs ( 0 ) ,
180196 hooks : self . hooks ,
197+ always_interesting : self . always_interesting ,
181198 llmp,
182199 #[ cfg( feature = "llmp_compression" ) ]
183200 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -208,6 +225,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
208225 throttle : self . throttle ,
209226 last_sent : Duration :: from_secs ( 0 ) ,
210227 hooks : self . hooks ,
228+ always_interesting : self . always_interesting ,
211229 llmp,
212230 #[ cfg( feature = "llmp_compression" ) ]
213231 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -242,6 +260,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
242260 throttle : self . throttle ,
243261 last_sent : Duration :: from_secs ( 0 ) ,
244262 hooks : self . hooks ,
263+ always_interesting : self . always_interesting ,
245264 llmp,
246265 #[ cfg( feature = "llmp_compression" ) ]
247266 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -270,6 +289,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
270289 throttle : self . throttle ,
271290 last_sent : Duration :: from_secs ( 0 ) ,
272291 hooks : self . hooks ,
292+ always_interesting : self . always_interesting ,
273293 llmp,
274294 #[ cfg( feature = "llmp_compression" ) ]
275295 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -302,6 +322,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
302322 throttle : self . throttle ,
303323 last_sent : Duration :: from_secs ( 0 ) ,
304324 hooks : self . hooks ,
325+ always_interesting : self . always_interesting ,
305326 llmp,
306327 #[ cfg( feature = "llmp_compression" ) ]
307328 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -329,6 +350,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
329350 throttle : self . throttle ,
330351 last_sent : Duration :: from_secs ( 0 ) ,
331352 hooks : self . hooks ,
353+ always_interesting : self . always_interesting ,
332354 llmp,
333355 #[ cfg( feature = "llmp_compression" ) ]
334356 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -360,6 +382,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
360382 throttle : self . throttle ,
361383 last_sent : Duration :: from_secs ( 0 ) ,
362384 hooks : self . hooks ,
385+ always_interesting : self . always_interesting ,
363386 llmp,
364387 #[ cfg( feature = "llmp_compression" ) ]
365388 compressor : GzipCompressor :: with_threshold ( COMPRESS_THRESHOLD ) ,
@@ -506,7 +529,9 @@ where
506529 where
507530 E : Executor < Self , Z > + HasObservers < State = S > ,
508531 for < ' a > E :: Observers : Deserialize < ' a > ,
509- Z : ExecutionProcessor < E :: Observers , State = S > + EvaluatorObservers < E :: Observers > ,
532+ Z : ExecutionProcessor < E :: Observers , State = S >
533+ + EvaluatorObservers < E :: Observers >
534+ + Evaluator < E , Self > ,
510535 {
511536 if !self . hooks . pre_exec_all ( state, client_id, & event) ? {
512537 return Ok ( ( ) ) ;
@@ -524,33 +549,40 @@ where
524549 } => {
525550 log:: info!( "Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})" ) ;
526551
527- let res = if client_config. match_with ( & self . configuration )
528- && observers_buf. is_some ( )
529- {
530- #[ cfg( feature = "adaptive_serialization" ) ]
531- let start = current_time ( ) ;
532- let observers: E :: Observers =
533- postcard:: from_bytes ( observers_buf. as_ref ( ) . unwrap ( ) ) ?;
534- #[ cfg( feature = "adaptive_serialization" ) ]
535- {
536- self . deserialization_time = current_time ( ) - start;
537- }
538- #[ cfg( feature = "scalability_introspection" ) ]
539- {
540- state. scalability_monitor_mut ( ) . testcase_with_observers += 1 ;
541- }
542- fuzzer. execute_and_process ( state, self , input, & observers, & exit_kind, false ) ?
552+ if self . always_interesting {
553+ let item = fuzzer. add_input ( state, executor, self , input) ?;
554+ log:: info!( "Added received Testcase as item #{item}" ) ;
543555 } else {
544- #[ cfg( feature = "scalability_introspection" ) ]
556+ let res = if client_config. match_with ( & self . configuration )
557+ && observers_buf. is_some ( )
545558 {
546- state. scalability_monitor_mut ( ) . testcase_without_observers += 1 ;
559+ #[ cfg( feature = "adaptive_serialization" ) ]
560+ let start = current_time ( ) ;
561+ let observers: E :: Observers =
562+ postcard:: from_bytes ( observers_buf. as_ref ( ) . unwrap ( ) ) ?;
563+ #[ cfg( feature = "adaptive_serialization" ) ]
564+ {
565+ self . deserialization_time = current_time ( ) - start;
566+ }
567+ #[ cfg( feature = "scalability_introspection" ) ]
568+ {
569+ state. scalability_monitor_mut ( ) . testcase_with_observers += 1 ;
570+ }
571+ fuzzer. execute_and_process (
572+ state, self , input, & observers, & exit_kind, false ,
573+ ) ?
574+ } else {
575+ #[ cfg( feature = "scalability_introspection" ) ]
576+ {
577+ state. scalability_monitor_mut ( ) . testcase_without_observers += 1 ;
578+ }
579+ fuzzer. evaluate_input_with_observers :: < E , Self > (
580+ state, executor, self , input, false ,
581+ ) ?
582+ } ;
583+ if let Some ( item) = res. 1 {
584+ log:: info!( "Added received Testcase as item #{item}" ) ;
547585 }
548- fuzzer. evaluate_input_with_observers :: < E , Self > (
549- state, executor, self , input, false ,
550- ) ?
551- } ;
552- if let Some ( item) = res. 1 {
553- log:: info!( "Added received Testcase as item #{item}" ) ;
554586 }
555587 }
556588 Event :: CustomBuf { tag, buf } => {
@@ -686,7 +718,9 @@ where
686718 SP : ShMemProvider ,
687719 E : HasObservers < State = S > + Executor < Self , Z > ,
688720 for < ' a > E :: Observers : Deserialize < ' a > ,
689- Z : EvaluatorObservers < E :: Observers , State = S > + ExecutionProcessor < E :: Observers , State = S > ,
721+ Z : ExecutionProcessor < E :: Observers , State = S >
722+ + EvaluatorObservers < E :: Observers >
723+ + Evaluator < E , Self > ,
690724{
691725 fn process (
692726 & mut self ,
@@ -732,7 +766,9 @@ where
732766 EMH : EventManagerHooksTuple < S > ,
733767 S : State + HasExecutions + HasMetadata + HasLastReportTime ,
734768 SP : ShMemProvider ,
735- Z : EvaluatorObservers < E :: Observers , State = S > + ExecutionProcessor < E :: Observers , State = S > ,
769+ Z : ExecutionProcessor < E :: Observers , State = S >
770+ + EvaluatorObservers < E :: Observers >
771+ + Evaluator < E , Self > ,
736772{
737773}
738774
0 commit comments