From: Matt Corallo Date: Fri, 1 Jul 2022 20:53:39 +0000 (+0000) Subject: [fuzz] Take a full struct path in msg gen_target.sh X-Git-Tag: v0.0.110~25^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=cee1feb16558364e1639a7775464e8cc73111666;p=rust-lightning [fuzz] Take a full struct path in msg gen_target.sh --- diff --git a/fuzz/src/msg_targets/gen_target.sh b/fuzz/src/msg_targets/gen_target.sh index 848793db5..fbc9f5c33 100755 --- a/fuzz/src/msg_targets/gen_target.sh +++ b/fuzz/src/msg_targets/gen_target.sh @@ -1,7 +1,7 @@ #!/bin/sh GEN_TEST() { - tn=msg_$(echo $1 | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') + tn=msg_$(echo $1 | sed s'/.*:://g' | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') fn=${tn}.rs cat msg_target_template.txt | sed s/MSG_TARGET/$1/ | sed "s/TARGET_NAME/$tn/" | sed "s/TEST_MSG/$2/" | sed "s/EXTRA_ARGS/$3/" > $fn echo "pub mod $tn;" >> mod.rs @@ -11,37 +11,37 @@ echo "mod utils;" > mod.rs # Note when adding new targets here you should add a similar line in src/bin/gen_target.sh -GEN_TEST AcceptChannel test_msg_simple "" -GEN_TEST AnnouncementSignatures test_msg_simple "" -GEN_TEST ClosingSigned test_msg_simple "" -GEN_TEST CommitmentSigned test_msg_simple "" -GEN_TEST FundingCreated test_msg_simple "" -GEN_TEST ChannelReady test_msg_simple "" -GEN_TEST FundingSigned test_msg_simple "" -GEN_TEST GossipTimestampFilter test_msg_simple "" -GEN_TEST Init test_msg_simple "" -GEN_TEST OnionHopData test_msg_simple "" -GEN_TEST OpenChannel test_msg_simple "" -GEN_TEST Ping test_msg_simple "" -GEN_TEST Pong test_msg_simple "" -GEN_TEST QueryChannelRange test_msg_simple "" -GEN_TEST ReplyShortChannelIdsEnd test_msg_simple "" -GEN_TEST RevokeAndACK test_msg_simple "" -GEN_TEST Shutdown test_msg_simple "" -GEN_TEST UpdateAddHTLC test_msg_simple "" -GEN_TEST UpdateFailHTLC test_msg_simple "" -GEN_TEST UpdateFailMalformedHTLC test_msg_simple "" -GEN_TEST UpdateFee test_msg_simple "" -GEN_TEST UpdateFulfillHTLC test_msg_simple "" +GEN_TEST lightning::ln::msgs::AcceptChannel test_msg_simple "" +GEN_TEST lightning::ln::msgs::AnnouncementSignatures test_msg_simple "" +GEN_TEST lightning::ln::msgs::ClosingSigned test_msg_simple "" +GEN_TEST lightning::ln::msgs::CommitmentSigned test_msg_simple "" +GEN_TEST lightning::ln::msgs::FundingCreated test_msg_simple "" +GEN_TEST lightning::ln::msgs::ChannelReady test_msg_simple "" +GEN_TEST lightning::ln::msgs::FundingSigned test_msg_simple "" +GEN_TEST lightning::ln::msgs::GossipTimestampFilter test_msg_simple "" +GEN_TEST lightning::ln::msgs::Init test_msg_simple "" +GEN_TEST lightning::ln::msgs::OnionHopData test_msg_simple "" +GEN_TEST lightning::ln::msgs::OpenChannel test_msg_simple "" +GEN_TEST lightning::ln::msgs::Ping test_msg_simple "" +GEN_TEST lightning::ln::msgs::Pong test_msg_simple "" +GEN_TEST lightning::ln::msgs::QueryChannelRange test_msg_simple "" +GEN_TEST lightning::ln::msgs::ReplyShortChannelIdsEnd test_msg_simple "" +GEN_TEST lightning::ln::msgs::RevokeAndACK test_msg_simple "" +GEN_TEST lightning::ln::msgs::Shutdown test_msg_simple "" +GEN_TEST lightning::ln::msgs::UpdateAddHTLC test_msg_simple "" +GEN_TEST lightning::ln::msgs::UpdateFailHTLC test_msg_simple "" +GEN_TEST lightning::ln::msgs::UpdateFailMalformedHTLC test_msg_simple "" +GEN_TEST lightning::ln::msgs::UpdateFee test_msg_simple "" +GEN_TEST lightning::ln::msgs::UpdateFulfillHTLC test_msg_simple "" -GEN_TEST ChannelReestablish test_msg "" -GEN_TEST DecodedOnionErrorPacket test_msg "" +GEN_TEST lightning::ln::msgs::ChannelReestablish test_msg "" +GEN_TEST lightning::ln::msgs::DecodedOnionErrorPacket test_msg "" -GEN_TEST ChannelAnnouncement test_msg_exact "" -GEN_TEST NodeAnnouncement test_msg_exact "" -GEN_TEST QueryShortChannelIds test_msg "" -GEN_TEST ReplyChannelRange test_msg "" +GEN_TEST lightning::ln::msgs::ChannelAnnouncement test_msg_exact "" +GEN_TEST lightning::ln::msgs::NodeAnnouncement test_msg_exact "" +GEN_TEST lightning::ln::msgs::QueryShortChannelIds test_msg "" +GEN_TEST lightning::ln::msgs::ReplyChannelRange test_msg "" -GEN_TEST ErrorMessage test_msg_hole ", 32, 2" -GEN_TEST WarningMessage test_msg_hole ", 32, 2" -GEN_TEST ChannelUpdate test_msg_hole ", 108, 1" +GEN_TEST lightning::ln::msgs::ErrorMessage test_msg_hole ", 32, 2" +GEN_TEST lightning::ln::msgs::WarningMessage test_msg_hole ", 32, 2" +GEN_TEST lightning::ln::msgs::ChannelUpdate test_msg_hole ", 108, 1" diff --git a/fuzz/src/msg_targets/msg_target_template.txt b/fuzz/src/msg_targets/msg_target_template.txt index ebe832d59..14580183e 100644 --- a/fuzz/src/msg_targets/msg_target_template.txt +++ b/fuzz/src/msg_targets/msg_target_template.txt @@ -10,18 +10,16 @@ // 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; use utils::test_logger; #[inline] pub fn TARGET_NAME_test(data: &[u8], _out: Out) { - TEST_MSG!(msgs::MSG_TARGET, dataEXTRA_ARGS); + TEST_MSG!(MSG_TARGET, dataEXTRA_ARGS); } #[no_mangle] pub extern "C" fn TARGET_NAME_run(data: *const u8, datalen: usize) { let data = unsafe { std::slice::from_raw_parts(data, datalen) }; - TEST_MSG!(msgs::MSG_TARGET, dataEXTRA_ARGS); + TEST_MSG!(MSG_TARGET, dataEXTRA_ARGS); }