merge bitcoin#20936: build fuzz tests by default

This commit is contained in:
Kittywhiskers Van Gogh 2023-08-23 16:58:58 +05:30 committed by PastaPastaPasta
parent 4b00e08707
commit dcd7babd80
4 changed files with 38 additions and 10 deletions

View File

@ -14,4 +14,4 @@ export DEP_OPTS="NO_UPNP=1 DEBUG=1"
export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS_SEQUENTIAL="true"
export RUN_UNIT_TESTS="false" export RUN_UNIT_TESTS="false"
export GOAL="install" export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports LDFLAGS=-static-libstdc++" export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++"

View File

@ -13,5 +13,5 @@ export DPKG_ADD_ARCH="i386"
export RUN_INTEGRATION_TESTS=false export RUN_INTEGRATION_TESTS=false
export RUN_SECURITY_TESTS="false" export RUN_SECURITY_TESTS="false"
export GOAL="deploy" export GOAL="deploy"
export BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --disable-miner" export BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --disable-fuzz-binary --disable-miner"
export DIRECT_WINE_EXEC_TESTS=true export DIRECT_WINE_EXEC_TESTS=true

View File

@ -178,10 +178,16 @@ AC_ARG_ENABLE([extended-functional-tests],
AC_ARG_ENABLE([fuzz], AC_ARG_ENABLE([fuzz],
AS_HELP_STRING([--enable-fuzz], AS_HELP_STRING([--enable-fuzz],
[enable building of fuzz targets (default no). enabling this will disable all other targets]), [build for fuzzing (default no). enabling this will disable all other targets and override --{enable,disable}-fuzz-binary]),
[enable_fuzz=$enableval], [enable_fuzz=$enableval],
[enable_fuzz=no]) [enable_fuzz=no])
AC_ARG_ENABLE([fuzz-binary],
AS_HELP_STRING([--enable-fuzz-binary],
[enable building of fuzz binary (default yes).]),
[enable_fuzz_binary=$enableval],
[enable_fuzz_binary=yes])
AC_ARG_ENABLE([danger_fuzz_link_all], AC_ARG_ENABLE([danger_fuzz_link_all],
AS_HELP_STRING([--enable-danger-fuzz-link-all], AS_HELP_STRING([--enable-danger-fuzz-link-all],
[Danger! Modifies source code. Needs git and gnu sed installed. Link each fuzz target (default no).]), [Danger! Modifies source code. Needs git and gnu sed installed. Link each fuzz target (default no).]),
@ -1275,7 +1281,7 @@ AC_DEFUN([SUPPRESS_WARNINGS],
dnl enable-fuzz should disable all other targets dnl enable-fuzz should disable all other targets
if test "x$enable_fuzz" = "xyes"; then if test "x$enable_fuzz" = "xyes"; then
AC_MSG_WARN(enable-fuzz will disable all other targets) AC_MSG_WARN(enable-fuzz will disable all other targets and force --enable-fuzz-binary=yes)
build_bitcoin_utils=no build_bitcoin_utils=no
build_bitcoin_cli=no build_bitcoin_cli=no
build_bitcoin_tx=no build_bitcoin_tx=no
@ -1290,10 +1296,11 @@ if test "x$enable_fuzz" = "xyes"; then
use_upnp=no use_upnp=no
use_natpmp=no use_natpmp=no
use_zmq=no use_zmq=no
enable_fuzz_binary=yes
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"]],,[[$CXXFLAG_WERROR]]) AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"]],,[[$CXXFLAG_WERROR]])
AC_MSG_CHECKING([whether main function is needed]) AC_MSG_CHECKING([whether main function is needed for fuzz binary])
AX_CHECK_LINK_FLAG( AX_CHECK_LINK_FLAG(
[[-fsanitize=$use_sanitizers]], [[-fsanitize=$use_sanitizers]],
[AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])],
@ -1321,6 +1328,8 @@ else
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES) QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi fi
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"
fi fi
if test x$enable_wallet != xno; then if test x$enable_wallet != xno; then
@ -1733,6 +1742,7 @@ AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"]) AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"])
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes]) AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
AM_CONDITIONAL([ENABLE_FUZZ_BINARY],[test x$enable_fuzz_binary = xyes])
AM_CONDITIONAL([ENABLE_FUZZ_LINK_ALL],[test x$enable_danger_fuzz_link_all = xyes]) AM_CONDITIONAL([ENABLE_FUZZ_LINK_ALL],[test x$enable_danger_fuzz_link_all = xyes])
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes]) AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes]) AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes])
@ -1748,6 +1758,8 @@ AM_CONDITIONAL([ENABLE_ARM_CRC],[test x$enable_arm_crc = xyes])
AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"]) AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"])
AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes]) AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes])
AM_CONDITIONAL([WORDS_BIGENDIAN],[test x$ac_cv_c_bigendian = xyes]) AM_CONDITIONAL([WORDS_BIGENDIAN],[test x$ac_cv_c_bigendian = xyes])
AM_CONDITIONAL([USE_NATPMP],[test x$use_natpmp = xyes])
AM_CONDITIONAL([USE_UPNP],[test x$use_upnp = xyes])
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])

View File

@ -3,9 +3,11 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
if ENABLE_FUZZ if ENABLE_FUZZ_BINARY
noinst_PROGRAMS += test/fuzz/fuzz noinst_PROGRAMS += test/fuzz/fuzz
else endif
if !ENABLE_FUZZ
bin_PROGRAMS += test/test_dash bin_PROGRAMS += test/test_dash
endif endif
@ -61,6 +63,14 @@ FUZZ_SUITE_LD_COMMON = \
$(GMP_LIBS) \ $(GMP_LIBS) \
$(BACKTRACE_LIB) $(BACKTRACE_LIB)
if USE_UPNP
FUZZ_SUITE_LD_COMMON += $(MINIUPNPC_LIBS)
endif
if USE_NATPMP
FUZZ_SUITE_LD_COMMON += $(NATPMP_LIBS)
endif
# test_dash binary # # test_dash binary #
BITCOIN_TESTS =\ BITCOIN_TESTS =\
test/arith_uint256_tests.cpp \ test/arith_uint256_tests.cpp \
@ -178,10 +188,16 @@ BITCOIN_TESTS += \
wallet/test/ismine_tests.cpp \ wallet/test/ismine_tests.cpp \
wallet/test/scriptpubkeyman_tests.cpp wallet/test/scriptpubkeyman_tests.cpp
FUZZ_SUITE_LD_COMMON +=\
$(LIBBITCOIN_WALLET) \
$(SQLITE_LIBS) \
$(BDB_LIBS)
if USE_BDB if USE_BDB
BITCOIN_TESTS += wallet/test/db_tests.cpp BITCOIN_TESTS += wallet/test/db_tests.cpp
endif endif
BITCOIN_TEST_SUITE += \ BITCOIN_TEST_SUITE += \
wallet/test/wallet_test_fixture.cpp \ wallet/test/wallet_test_fixture.cpp \
wallet/test/wallet_test_fixture.h \ wallet/test/wallet_test_fixture.h \
@ -204,11 +220,12 @@ test_test_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $
if ENABLE_ZMQ if ENABLE_ZMQ
test_test_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) test_test_dash_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
FUZZ_SUITE_LD_COMMON += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif endif
if ENABLE_FUZZ
FUZZ_SUITE_LDFLAGS_COMMON = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(LDFLAGS_WRAP_EXCEPTIONS) $(PTHREAD_FLAGS) FUZZ_SUITE_LDFLAGS_COMMON = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(LDFLAGS_WRAP_EXCEPTIONS) $(PTHREAD_FLAGS)
if ENABLE_FUZZ_BINARY
test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON) test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON)
@ -305,8 +322,7 @@ test_fuzz_fuzz_SOURCES = \
test/fuzz/transaction.cpp \ test/fuzz/transaction.cpp \
test/fuzz/tx_in.cpp \ test/fuzz/tx_in.cpp \
test/fuzz/tx_out.cpp test/fuzz/tx_out.cpp
endif # ENABLE_FUZZ_BINARY
endif # ENABLE_FUZZ
nodist_test_test_dash_SOURCES = $(GENERATED_TEST_FILES) nodist_test_test_dash_SOURCES = $(GENERATED_TEST_FILES)