Skip to content

Commit 475dd45

Browse files
committed
wip coverage
1 parent 8192204 commit 475dd45

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

fuzz/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ bitcoin = { version = "0.32.2", features = ["secp-lowmemory"] }
2727
afl = { version = "0.12", optional = true }
2828
honggfuzz = { version = "0.5", optional = true, default-features = false }
2929
libfuzzer-sys = { version = "0.4", optional = true }
30+
component = "0.1.1"
31+
llvm-tools = "0.1.1"
3032

3133
[build-dependencies]
3234
cc = "1.0"
@@ -40,6 +42,7 @@ lto = "off"
4042
debug-assertions = true
4143
overflow-checks = true
4244
opt-level = 0
45+
debug = true
4346

4447
# When testing a large fuzz corpus, -O1 offers a nice speedup
4548
[profile.dev]

fuzz/src/process_onion_failure.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
// FUZZER COMMANDS:
2+
// RUSTFLAGS="--cfg hashes_fuzz --cfg=secp256k1_fuzz" cargo +nightly fuzz run --features "libfuzzer_fuzz" process_onion_failure_target
3+
// RUSTFLAGS="--cfg hashes_fuzz --cfg=secp256k1_fuzz" cargo +nightly fuzz coverage -v --features "libfuzzer_fuzz" process_onion_failure_target
4+
// llvm-cov show target/aarch64-apple-darwin/coverage/aarch64-apple-darwin/release/process_onion_failure_target --instr-profile=/Users/joost/repo/rust-lightning/fuzz/coverage/process_onion_failure_target/coverage.profdata --format=html --output-dir=reports
5+
16
use std::sync::Arc;
27

38
use bitcoin::{key::Secp256k1, secp256k1::{PublicKey, SecretKey}};
4-
use lightning::{blinded_path::BlindedHop, ln::{channelmanager::{HTLCSource, PaymentId}, msgs::OnionErrorPacket}, routing::router::{BlindedTail, Path, RouteHop, TrampolineHop}, types::features::{ChannelFeatures, Features, NodeFeatures}, util::test_utils::TestLogger};
9+
use lightning::{blinded_path::BlindedHop, ln::{channelmanager::{HTLCSource, PaymentId}, msgs::OnionErrorPacket}, routing::router::{BlindedTail, Path, RouteHop, TrampolineHop}, types::features::{ChannelFeatures, Features, NodeFeatures}, util::{logger::Logger, test_utils::TestLogger}};
510

611
// Imports that need to be added manually
712
use crate::{utils::test_logger::{self}};
@@ -21,7 +26,9 @@ fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
2126
}
2227

2328
let secp_ctx = Secp256k1::new();
24-
let logger: Arc<TestLogger> = Arc::new(TestLogger::new());
29+
30+
let logger: Arc<dyn Logger> =
31+
Arc::new(test_logger::TestLogger::new("".to_owned(), out));
2532

2633
let first_hop_htlc_msat_bytes = match get_slice!(8).try_into() {
2734
Ok(val) => val,
@@ -40,7 +47,7 @@ fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
4047

4148
macro_rules! get_pubkey {
4249
() => {
43-
match PublicKey::from_slice(get_slice!(32)) {
50+
match PublicKey::from_slice(get_slice!(33)) {
4451
Ok(val) => val,
4552
Err(_) => return,
4653
}

0 commit comments

Comments
 (0)