Skip to content

Commit

Permalink
Merge bitcoin#16338: test: Disable other targets when enable-fuzz is set
Browse files Browse the repository at this point in the history
84edfc7 Update doc and CI config (qmma)
48bcb2a Disable other targets when enable-fuzz is set (qmma)

Pull request description:

  This is to fix bitcoin#16094

  When the `enable-fuzz` flag is set, disable all other binary targets.

ACKs for top commit:
  MarcoFalke:
    ACK 84edfc7 (only checked that travis compiled this)

Tree-SHA512: f4ac80526388a67709986b22de88b00bf93ab44ae31a20bd4d8923a4982ab97e015a9f13010081d6ecf6c23ae8afeac7ca9d849d198ce6ebe239aa3127151efc
  • Loading branch information
laanwj authored and Munkybooty committed Nov 4, 2021
1 parent 47710db commit d30484c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ after_success:
RUN_FUNCTIONAL_TESTS=false
RUN_FUZZ_TESTS=true
GOAL="install"
BITCOIN_CONFIG="--disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++"
BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++"
- stage: test
env: >-
Expand Down
28 changes: 26 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ AC_ARG_ENABLE([extended-functional-tests],
[use_extended_functional_tests=no])

AC_ARG_ENABLE([fuzz],
AS_HELP_STRING([--enable-fuzz],[enable building of fuzz targets (default no)]),
AS_HELP_STRING([--enable-fuzz],
[enable building of fuzz targets (default no). enabling this will disable all other targets]),
[enable_fuzz=$enableval],
[enable_fuzz=no])

Expand Down Expand Up @@ -1111,6 +1112,29 @@ dnl it would break GCC's #include_next.
AC_DEFUN([SUPPRESS_WARNINGS],
[$(echo $1 |${SED} -E -e 's/(^| )-I/\1-isystem /g' -e 's;-isystem /usr/include([/ ]|$);-I/usr/include\1;g')])

dnl enable-fuzz should disable all other targets
if test "x$enable_fuzz" = "xyes"; then
AC_MSG_WARN(enable-fuzz will disable all other targets)
build_dash_utils=no
build_dash_cli=no
build_dash_tx=no
build_dash_wallet=no
build_dashd=no
build_dash_libs=no
dash_enable_qt=no
dash_enable_qt_test=no
dash_enable_qt_dbus=no
enable_wallet=no
use_bench=no
use_upnp=no
use_zmq=no
else
BITCOIN_QT_INIT

dnl sets $dash_enable_qt, $dash_enable_qt_test, $dash_enable_qt_dbus
BITCOIN_QT_CONFIGURE([$use_pkgconfig])
fi

if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48
Expand Down Expand Up @@ -1161,7 +1185,7 @@ if test x$suppress_external_warnings != xno ; then
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi

if test x$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnononononono; then
if test x$build_dash_wallet$build_dash_cli$build_dash_tx$build_dashd$dash_enable_qt$use_tests$use_bench = xnonononononono; then
use_boost=no
else
use_boost=yes
Expand Down
4 changes: 2 additions & 2 deletions doc/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ For macOS you may need to ignore x86 compilation checks when running `make`:
To build Dash Core using AFL instrumentation (this assumes that the
`AFLPATH` was set as above):
```
./configure --disable-ccache --disable-shared --enable-tests --enable-fuzz --disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no CC=${AFLPATH}/afl-gcc CXX=${AFLPATH}/afl-g++
./configure --disable-ccache --disable-shared --enable-tests --enable-fuzz CC=${AFLPATH}/afl-gcc CXX=${AFLPATH}/afl-g++
export AFL_HARDEN=1
make
```
Expand Down Expand Up @@ -102,7 +102,7 @@ libFuzzer is needed (all found in the `compiler-rt` runtime libraries package).
To build all fuzz targets with libFuzzer, run

```
./configure --disable-ccache --disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++
./configure --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++
make
```

Expand Down

0 comments on commit d30484c

Please sign in to comment.