Upgrade rust-bitcoin to 0.31
[rust-lightning] / fuzz / src / bin / msg_pong_target.rs
index 20304c4530e0bfea0fbc3ce41b321a4d52671b3b..a8e4285d1710a5d19fbbef64b59004dcf41e4ff3 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_pong::*;
 
@@ -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!();
        }
 }