Refactor fuzzing to be a C-callable library plus rust binaries
[rust-lightning] / fuzz / src / msg_targets / msg_funding_created.rs
diff --git a/fuzz/src/msg_targets/msg_funding_created.rs b/fuzz/src/msg_targets/msg_funding_created.rs
new file mode 100644 (file)
index 0000000..8e468a8
--- /dev/null
@@ -0,0 +1,24 @@
+// 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!(msgs::FundingCreated, data);
+}
+
+#[no_mangle]
+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());
+       }
+}