You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin#32113: fuzz: enable running fuzz test cases in Debug mode
3669ecd doc: Document fuzz build options (Anthony Towns)
c1d01f5 fuzz: enable running fuzz test cases in Debug mode (Anthony Towns)
Pull request description:
When building with
BUILD_FOR_FUZZING=OFF
BUILD_FUZZ_BINARY=ON
CMAKE_BUILD_TYPE=Debug
allow the fuzz binary to execute given test cases (without actual fuzzing) to make it easier to reproduce fuzz test failures in a more normal debug build.
In Debug builds, deterministic fuzz behaviour is controlled via a runtime variable, which is normally false, but set to true automatically in the fuzz binary, unless the FUZZ_NONDETERMINISM environment variable is set.
ACKs for top commit:
maflcko:
re-ACK 3669ecd 🏉
marcofleon:
re ACK 3669ecd
ryanofsky:
Code review ACK 3669ecd with just variable renamed and documentation added since last review
Tree-SHA512: 5da5736462f98437d0aa1bd01aeacb9d46a9cc446a748080291067f7a27854c89f560f3a6481b760b9a0ea15a8d3ad90cd329ee2a008e5e347a101ed2516449e
Copy file name to clipboardExpand all lines: doc/fuzzing.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,37 @@ If you find coverage increasing inputs when fuzzing you are highly encouraged to
150
150
151
151
Every single pull request submitted against the Bitcoin Core repo is automatically tested against all inputs in the [`bitcoin-core/qa-assets`](https://github.com/bitcoin-core/qa-assets) repo. Contributing new coverage increasing inputs is an easy way to help make Bitcoin Core more robust.
152
152
153
+
## Building and debugging fuzz tests
154
+
155
+
There are 3 ways fuzz tests can be built:
156
+
157
+
1. With `-DBUILD_FOR_FUZZING=ON` which forces on fuzz determinism (skipping
158
+
proof of work checks, disabling random number seeding, disabling clock time)
159
+
and causes `Assume()` checks to abort on failure.
160
+
161
+
This is the normal way to run fuzz tests and generate new inputs. Because
162
+
determinism is hardcoded on in this build, only the fuzz binary can be built
163
+
and all other binaries are disabled.
164
+
165
+
2. With `-DBUILD_FUZZ_BINARY=ON -DCMAKE_BUILD_TYPE=Debug` which causes
166
+
`Assume()` checks to abort on failure, and enables fuzz determinism, but
167
+
makes it optional.
168
+
169
+
Determinism is turned on in the fuzz binary by default, but can be turned off
170
+
by setting the `FUZZ_NONDETERMINISM` environment variable to any value, which
171
+
may be useful for running fuzz tests with code that deterministic execution
172
+
would otherwise skip.
173
+
174
+
Since `BUILD_FUZZ_BINARY`, unlike `BUILD_FOR_FUZZING`, does not hardcode on
175
+
determinism, this allows non-fuzz binaries to coexist in the same build,
176
+
making it possible to reproduce fuzz test failures in a normal build.
177
+
178
+
3. With `-DBUILD_FUZZ_BINARY=ON -DCMAKE_BUILD_TYPE=Release`. In this build, the
179
+
fuzz binary will build but refuse to run, because in release builds
180
+
determinism is forced off and `Assume()` checks do not abort, so running the
181
+
tests would not be useful. This build is only useful for ensuring fuzz tests
182
+
compile and link.
183
+
153
184
## macOS hints for libFuzzer
154
185
155
186
The default Clang/LLVM version supplied by Apple on macOS does not include
0 commit comments