// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::chanmon_consistency::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
chanmon_consistency_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ chanmon_consistency_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/chanmon_consistency") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ chanmon_consistency_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::chanmon_deser::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
chanmon_deser_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ chanmon_deser_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/chanmon_deser") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ chanmon_deser_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::full_stack::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
full_stack_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ full_stack_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/full_stack") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ full_stack_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_accept_channel::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_accept_channel_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_accept_channel_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_accept_channel") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_accept_channel_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_announcement_signatures::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_announcement_signatures_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_announcement_signatures_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_announcement_signatures") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_announcement_signatures_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_channel_announcement::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_channel_announcement_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_channel_announcement_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_channel_announcement") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_channel_announcement_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_channel_reestablish::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_channel_reestablish_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_channel_reestablish_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_channel_reestablish") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_channel_reestablish_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_channel_update::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_channel_update_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_channel_update_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_channel_update") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_channel_update_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_closing_signed::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_closing_signed_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_closing_signed_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_closing_signed") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_closing_signed_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_commitment_signed::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_commitment_signed_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_commitment_signed_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_commitment_signed") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_commitment_signed_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_decoded_onion_error_packet::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_decoded_onion_error_packet_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_decoded_onion_error_packet_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_decoded_onion_error_packet") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_decoded_onion_error_packet_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_error_message::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_error_message_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_error_message_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_error_message") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_error_message_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_funding_created::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_funding_created_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_funding_created_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_funding_created") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_funding_created_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_funding_locked::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_funding_locked_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_funding_locked_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_funding_locked") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_funding_locked_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_funding_signed::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_funding_signed_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_funding_signed_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_funding_signed") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_funding_signed_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_init::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_init_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_init_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_init") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_init_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_node_announcement::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_node_announcement_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_node_announcement_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_node_announcement") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_node_announcement_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_onion_hop_data::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_onion_hop_data_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_onion_hop_data_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_onion_hop_data") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_onion_hop_data_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_open_channel::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_open_channel_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_open_channel_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_open_channel") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_open_channel_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_ping::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_ping_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_ping_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_ping") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_ping_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_pong::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_pong_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_pong_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_pong") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_pong_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_revoke_and_ack::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_revoke_and_ack_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_revoke_and_ack_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_revoke_and_ack") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_revoke_and_ack_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_shutdown::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_shutdown_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_shutdown_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_shutdown") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_shutdown_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_update_add_htlc::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_update_add_htlc_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_update_add_htlc_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_update_add_htlc") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_update_add_htlc_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_update_fail_htlc::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_update_fail_htlc_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_update_fail_htlc_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_update_fail_htlc") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_update_fail_htlc_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_update_fail_malformed_htlc::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_update_fail_malformed_htlc_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_update_fail_malformed_htlc_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_update_fail_malformed_htlc") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_update_fail_malformed_htlc_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_update_fee::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_update_fee_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_update_fee_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_update_fee") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_update_fee_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_update_fulfill_htlc::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
msg_update_fulfill_htlc_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ msg_update_fulfill_htlc_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/msg_update_fulfill_htlc") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ msg_update_fulfill_htlc_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::peer_crypt::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
peer_crypt_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ peer_crypt_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/peer_crypt") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ peer_crypt_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::router::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
router_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ router_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/router") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ router_run(data.as_ptr(), data.len());
+ }
+ }
+}
// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.
-//Uncomment this for libfuzzer builds:
-//#![no_main]
+#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
extern crate lightning_fuzz;
use lightning_fuzz::TARGET_MOD::*;
+use std::fs;
use std::io::Read;
#[cfg(feature = "afl")]
std::io::stdin().read_to_end(&mut data).unwrap();
TARGET_NAME_run(data.as_ptr(), data.len());
}
+
+#[test]
+fn run_test_cases() {
+ let mut data: Vec<u8> = vec![0];
+ TARGET_NAME_run(data.as_ptr(), data.len());
+ if let Ok(tests) = fs::read_dir("test_cases/TARGET_NAME") {
+ for test in tests {
+ data.clear();
+ let path = test.unwrap().path();
+ println!("Running test {}...", path.file_name().unwrap().to_str().unwrap());
+ fs::File::open(path).unwrap().read_to_end(&mut data).unwrap();
+ TARGET_NAME_run(data.as_ptr(), data.len());
+ }
+ }
+}
pub extern "C" fn chanmon_consistency_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn chanmon_deser_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
- #[test]
- fn duplicate_crash() {
- let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned()));
- super::do_test(&::hex::decode("00").unwrap(), &logger);
- }
-
struct TrackingLogger {
/// (module, message) -> count
pub lines: Mutex<HashMap<(String, String), usize>>,
pub extern "C" fn msg_accept_channel_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_announcement_signatures_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_channel_announcement_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_channel_reestablish_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_channel_update_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_closing_signed_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_commitment_signed_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_decoded_onion_error_packet_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_error_message_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_funding_created_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_funding_locked_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_funding_signed_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_init_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_node_announcement_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_onion_hop_data_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_open_channel_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_ping_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_pong_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_revoke_and_ack_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_shutdown_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn TARGET_NAME_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_update_add_htlc_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_update_fail_htlc_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_update_fail_malformed_htlc_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_update_fee_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn msg_update_fulfill_htlc_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}
pub extern "C" fn peer_crypt_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("01").unwrap());
- }
-}
pub extern "C" fn router_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn duplicate_crash() {
- super::do_test(&::hex::decode("00").unwrap());
- }
-}