File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44#![ no_main]
55#![ allow( clippy:: unwrap_used, clippy:: result_large_err) ]
66
7+ use std:: str:: FromStr ;
8+
79use libfuzzer_sys:: Corpus ;
810use libfuzzer_sys:: fuzz_target;
11+ use tracing:: level_filters:: LevelFilter ;
912use vortex_error:: vortex_panic;
1013use vortex_fuzz:: FuzzArrayAction ;
1114use vortex_fuzz:: run_fuzz_action;
1215
1316fuzz_target ! (
1417 init: {
15- tracing_subscriber:: fmt:: init( ) ;
18+ let fmt = tracing_subscriber:: fmt:: format( )
19+ . with_ansi( false ) // Colour output is messed up in raw logs
20+ . without_time( ) // We run fuzzer in CI which prepends timestamps
21+ . compact( ) ;
22+ let level = std:: env:: var( "RUST_LOG" ) . map(
23+ |v| LevelFilter :: from_str( v. as_str( ) ) . unwrap( ) ) . unwrap_or( LevelFilter :: INFO ) ;
24+ tracing_subscriber:: fmt( )
25+ . event_format( fmt)
26+ . with_max_level( level)
27+ . init( ) ;
1628 } ,
1729 |fuzz_action: FuzzArrayAction | -> Corpus {
1830 match run_fuzz_action( fuzz_action) {
1931 Ok ( true ) => Corpus :: Keep ,
2032 Ok ( false ) => Corpus :: Reject ,
21- Err ( e) => {
22- vortex_panic!( "{e}" ) ;
23- }
33+ Err ( e) => vortex_panic!( "{e}" ) ,
2434 }
2535} ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ use strum::EnumIter;
3737use strum:: IntoEnumIterator ;
3838pub ( crate ) use sum:: * ;
3939pub ( crate ) use take:: * ;
40- use tracing:: info ;
40+ use tracing:: debug ;
4141use vortex_array:: ArrayRef ;
4242use vortex_array:: DynArray ;
4343use vortex_array:: IntoArray ;
@@ -561,14 +561,14 @@ pub fn run_fuzz_action(fuzz_action: FuzzArrayAction) -> crate::error::VortexFuzz
561561 let FuzzArrayAction { array, actions } = fuzz_action;
562562 let mut current_array = array. to_array ( ) ;
563563
564- info ! (
564+ debug ! (
565565 "Initial array:\n Tree:\n {}Values:\n {:#}" ,
566566 current_array. display_tree( ) ,
567567 current_array. display_values( )
568568 ) ;
569569
570570 for ( i, ( action, expected) ) in actions. into_iter ( ) . enumerate ( ) {
571- info ! ( id = i, action = ?action) ;
571+ debug ! ( id = i, action = ?action) ;
572572 match action {
573573 Action :: Compress ( strategy) => {
574574 let canonical = current_array
Original file line number Diff line number Diff line change @@ -330,6 +330,7 @@ impl Display for dyn DynArray + '_ {
330330 }
331331}
332332
333+ const DISPLAY_LIMIT : usize = 16 ;
333334impl dyn DynArray + ' _ {
334335 /// Display logical values of the array
335336 ///
@@ -479,10 +480,11 @@ impl dyn DynArray + '_ {
479480 write ! ( f, "{}" , if f. alternate( ) { "[\n " } else { "[" } ) ?;
480481 let sep = if * omit_comma_after_space { "," } else { ", " } ;
481482 let sep = if f. alternate ( ) { ",\n " } else { sep } ;
483+ let limit = std:: cmp:: min ( self . len ( ) , f. precision ( ) . unwrap_or ( DISPLAY_LIMIT ) ) ;
482484 write ! (
483485 f,
484486 "{}" ,
485- ( 0 ..self . len ( ) )
487+ ( 0 ..limit )
486488 . map( |i| self
487489 . scalar_at( i)
488490 . map_or_else( |e| format!( "<error: {e}>" ) , |s| s. to_string( ) ) )
You can’t perform that action at this time.
0 commit comments