rust-lightning/fuzz/src/msg_targets/msg_channel_announcement.rs
Matt Corallo a343cf9436 Drop individual fuzz target duplicate_crash tests for file reader
Previously, in each of our fuzz tests we had a dummy test which
had a hard-coded hex string which it passed into the fuzz target
so that when a failing test case was found, its hex could be
copied into the test and you could run cargo test to analyze the
failure. However, this was somewhat unwieldy as converting large
tests back and forth between hex and raw files is quite annoying.

Instead, we replace each of those tests with a test in each target
that looks for files in fuzz/test_cases and runs each file it finds.

Since we're editing every bin target anyway, we also automate adding
no_main to libfuzzer builds with #![cfg_attr].
2020-01-19 16:13:47 -05:00

16 lines
478 B
Rust

// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
use lightning::ln::msgs;
use msg_targets::utils::VecWriter;
#[inline]
pub fn do_test(data: &[u8]) {
test_msg_exact!(msgs::ChannelAnnouncement, data);
}
#[no_mangle]
pub extern "C" fn msg_channel_announcement_run(data: *const u8, datalen: usize) {
do_test(unsafe { std::slice::from_raw_parts(data, datalen) });
}