From d96680acd2daf98d5fb1d19b4bc6baf5f44ee42c Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 10 Jul 2019 12:21:26 +0200 Subject: [PATCH] Merge #16338: test: Disable other targets when enable-fuzz is set 84edfc72e5eba3dde824ebd0626e97929a0b1bca Update doc and CI config (qmma) 48bcb2ac249e0e666ce638bb29124558b3283c16 Disable other targets when enable-fuzz is set (qmma) Pull request description: This is to fix https://github.com/bitcoin/bitcoin/issues/16094 When the `enable-fuzz` flag is set, disable all other binary targets. ACKs for top commit: MarcoFalke: ACK 84edfc72e5eba3dde824ebd0626e97929a0b1bca (only checked that travis compiled this) Tree-SHA512: f4ac80526388a67709986b22de88b00bf93ab44ae31a20bd4d8923a4982ab97e015a9f13010081d6ecf6c23ae8afeac7ca9d849d198ce6ebe239aa3127151efc --- .travis.yml | 2 +- configure.ac | 47 +++++++++++++++++++++++++++++++++-------------- doc/fuzzing.md | 4 ++-- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 498a8bcfd6..31ee1922e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: >- diff --git a/configure.ac b/configure.ac index 9cc7ac018c..08e9070465 100644 --- a/configure.ac +++ b/configure.ac @@ -145,7 +145,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]) @@ -1118,6 +1119,37 @@ 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_bitcoin_utils=no + build_bitcoin_cli=no + build_bitcoin_tx=no + build_bitcoin_wallet=no + build_bitcoind=no + build_bitcoin_libs=no + bitcoin_enable_qt=no + bitcoin_enable_qt_test=no + bitcoin_enable_qt_dbus=no + enable_wallet=no + use_bench=no + use_upnp=no + use_zmq=no +else + BITCOIN_QT_INIT + + dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus + BITCOIN_QT_CONFIGURE([5.5.1]) + + dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc + QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES + if test x$suppress_external_warnings != xno ; then + QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES) + QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES) + QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) + fi +fi + if test x$enable_wallet != xno; then dnl Check for libdb_cxx only if wallet enabled BITCOIN_FIND_BDB48 @@ -1155,19 +1187,6 @@ if test x$have_miniupnpc != xno; then fi fi -BITCOIN_QT_INIT - -dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus -BITCOIN_QT_CONFIGURE([5.5.1]) - -dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc -QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES -if test x$suppress_external_warnings != xno ; then - QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES) - QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES) - QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) -fi - if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then use_boost=no else diff --git a/doc/fuzzing.md b/doc/fuzzing.md index a67f11891e..1d515339fc 100644 --- a/doc/fuzzing.md +++ b/doc/fuzzing.md @@ -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 ``` @@ -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 ```