Certainly! Here is a title and description for your pull request that you can copy and paste:
Title:
ci: Add separate fuzz-only CI jobs with -DBUILD_FOR_FUZZING
Pull Request Description:
ci: Add separate fuzz-only CI jobs with -DBUILD_FOR_FUZZING
This pull request addresses [issue #31057](https://github.com/bitcoin/bitcoin/issues/31057) by updating the Continuous Integration (CI) workflow to disallow building the fuzz binary without -DBUILD_FOR_FUZZING
and by adding separate fuzz-only CI jobs for macOS and Windows platforms.
Changes:
-
Added new fuzz-only CI jobs:
- macOS Fuzz Job (
macos-fuzz
):- Builds the fuzz binary with
-DBUILD_FOR_FUZZING=ON
. - Runs the fuzz tests after building.
- Builds the fuzz binary with
- Windows Fuzz Job (
win64-fuzz
):- Builds the fuzz binary with
-DBUILD_FOR_FUZZING=ON
. - Runs the fuzz tests after building.
- Builds the fuzz binary with
- macOS Fuzz Job (
-
Modified existing CI jobs:
macos-native-arm64
:- Removed building of the fuzz binary without
-DBUILD_FOR_FUZZING
. - Ensured the job does not run fuzz tests.
- Removed building of the fuzz binary without
win64-native
:- Adjusted build steps to exclude the fuzz binary when
-DBUILD_FOR_FUZZING
is not set. - Ensured the job does not run fuzz tests.
- Adjusted build steps to exclude the fuzz binary when
Rationale:
Building the fuzz binary without -DBUILD_FOR_FUZZING
results in a less effective binary for testing because:
- It won’t crash on
Assume
statements. - It won’t bypass fuzz blockers with
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
.
By creating separate fuzz-only CI jobs that use -DBUILD_FOR_FUZZING
, we ensure:
- The fuzz binary is correctly configured for testing.
- Compile-time errors are caught early in the CI on all platforms.
- Avoidance of workarounds like [PR #31028](https://github.com/bitcoin/bitcoin/pull/31028).
Testing:
- Validated that the new fuzz-only CI jobs run successfully and pass all fuzz tests.
- Confirmed that the existing CI jobs continue to pass without building or running the fuzz binary.
Notes:
- This change complements updates made to disallow building the fuzz binary without
-DBUILD_FOR_FUZZING
in the build configuration. - Ensures consistency across all platforms in how fuzz binaries are built and tested.
Fixes #31057
CC: @dergoegge, @marcofleon, @maflcko