Upgrade rust-bitcoin to 0.31
[rust-lightning] / fuzz / src / bin / msg_query_channel_range_target.rs
index b7e242467b962a024fb27ce113faa6b34959ba39..e07a046cb38d3eff4409eaf447848c24267f5099 100644 (file)
 
 #![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
 
+#[cfg(not(fuzzing))]
+compile_error!("Fuzz targets need cfg=fuzzing");
+
+#[cfg(not(hashes_fuzz))]
+compile_error!("Fuzz targets need cfg=hashes_fuzz");
+
+#[cfg(not(secp256k1_fuzz))]
+compile_error!("Fuzz targets need cfg=secp256k1_fuzz");
+
 extern crate lightning_fuzz;
 use lightning_fuzz::msg_targets::msg_query_channel_range::*;
 
@@ -93,10 +102,18 @@ fn run_test_cases() {
                        }
                }
        }
+       let mut failed_outputs = Vec::new();
        for (test, thread) in threads.drain(..) {
                if let Some(output) = thread.join().unwrap() {
-                       println!("Output of {}:\n{}", test, output);
-                       panic!();
+                       println!("\nOutput of {}:\n{}\n", test, output);
+                       failed_outputs.push(test);
+               }
+       }
+       if !failed_outputs.is_empty() {
+               println!("Test cases which failed: ");
+               for case in failed_outputs {
+                       println!("{}", case);
                }
+               panic!();
        }
 }