Skip to content

Comments

Fuzz stdin support#4430

Draft
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fuzz-prep
Draft

Fuzz stdin support#4430
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fuzz-prep

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Feb 20, 2026

Add stdin_fuzz feature support to all fuzz targets, allowing test cases to be replayed via stdin when built with --features stdin_fuzz. This is documented in a new section in the fuzz README.

@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

Update all fuzz target binaries to call the `_test` function (with a
DevNull logger) wrapped in `catch_unwind` instead of calling `_run`
directly. This allows fuzz targets built with `--features=stdin_fuzz`
to properly catch panics and exit with status 1, making them suitable
for reproducing crashes by piping test case bytes via stdin.

Also add a section in the fuzz README explaining how to use the
stdin_fuzz feature, which is useful during git bisect or when working
with tools that can construct and pipe byte sequences directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TARGET_NAME_test(&data, lightning_fuzz::utils::test_logger::Stdout {});
});
if res.is_err() {
std::process::exit(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this is required? panicing in fn main() should cause the process to exit, no?

@joostjager joostjager changed the title Fuzz target improvements: stdin support and chanmon_consistency fixes Fuzz stdin support Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.86%. Comparing base (153e57e) to head (ccbc566).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4430      +/-   ##
==========================================
- Coverage   85.90%   85.86%   -0.05%     
==========================================
  Files         156      157       +1     
  Lines      103965   103769     -196     
  Branches   103965   103769     -196     
==========================================
- Hits        89316    89101     -215     
- Misses      12128    12171      +43     
+ Partials     2521     2497      -24     
Flag Coverage Δ
tests 85.86% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants