diff --git a/.cirrus.yml b/.cirrus.yml index 2dd109af6a1b..1e4b8303b65c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,33 +1,3 @@ -task: - name: "FreeBsd 12.1 amd64 [GOAL: install] [no depends, only system libs]" - freebsd_instance: - image_family: freebsd-12-1 # https://cirrus-ci.org/guide/FreeBSD/ - cpu: 8 - memory: 8G - timeout_in: 60m - env: - MAKEJOBS: "-j9" - CONFIGURE_OPTS: "--disable-dependency-tracking" - GOAL: "install" - TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache - CCACHE_SIZE: "200M" - CCACHE_COMPRESS: 1 - CCACHE_DIR: "/tmp/ccache_dir" - ccache_cache: - folder: "/tmp/ccache_dir" - install_script: - - pkg install -y autoconf automake boost-libs git gmake libevent libtool pkgconf python3 ccache - - ./contrib/install_db4.sh $(pwd) - - ccache --max-size=${CCACHE_SIZE} - configure_script: - - ./autogen.sh - - ./configure ${CONFIGURE_OPTS} BDB_LIBS="-L$(pwd)/db4/lib -ldb_cxx-4.8" BDB_CFLAGS="-I$(pwd)/db4/include" || ( cat config.log && false) - make_script: - - gmake ${MAKEJOBS} ${GOAL} || ( echo "Build failure. Verbose build follows." && gmake ${GOAL} V=1 ; false ) - check_script: - - gmake check ${MAKEJOBS} VERBOSE=1 - functional_test_script: - - ./test/functional/test_runner.py --jobs 9 --ci --extended --exclude feature_dbcrash --combinedlogslen=1000 --quiet --failfast task: name: "x86_64 Linux [GOAL: install] [focal] [Using ./ci/ system]" container: diff --git a/.travis.yml b/.travis.yml index b95eb317ae06..07af403a577a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,7 +74,6 @@ builddocker: &builddocker # no need to run tests again here - if [ "$DOCKER_BUILD" = "true" ]; then $DOCKER_RUN_IN_BUILDER ./ci/dash/build_depends.sh && $DOCKER_RUN_IN_BUILDER ./ci/dash/build_src.sh && BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./ci/dash/build-docker.sh; fi - CI_RETRY_EXE="travis_retry" - - CI_WAIT="while sleep 500; do echo .; done" - CACHE_ERR_MSG="Error! Initial build successful, but not enough time remains to run later build stages and tests. See https://docs.travis-ci.com/user/customizing-the-build#build-timeouts . Please manually re-run this job by using the travis restart button. The next run should not time out because the build cache has been saved." before_install: - set -o errexit; source ./ci/test/00_setup_env.sh @@ -209,26 +208,6 @@ after_success: FILE_ENV="./ci/test/00_setup_env_arm.sh" QEMU_USER_CMD="" - - stage: test - name: 's390x native BE [GOAL: install] [bionic] [no depends, no GUI]' - arch: s390x - dist: bionic - addons: - apt: - packages: - - bsdmainutils - - libboost-filesystem-dev - - libboost-system-dev - - libboost-test-dev - - libboost-thread-dev - - libdb++-dev - - libdb-dev - - libevent-dev - env: >- - DANGER_RUN_CI_ON_HOST=true - CI_USE_APT_INSTALL=no - FILE_ENV="./ci/test/00_setup_env_s390x_host.sh" - # s390 build was disabled temporarily because of disk space issues on the Travis VM # # - stage: test @@ -249,10 +228,12 @@ after_success: FILE_ENV="./ci/test/00_setup_env_native_qt5.sh" # x86_64 Linux (xenial, no depends, only system libs, sanitizers: thread (TSan)) - stage: test - name: 'x86_64 Linux [GOAL: install] [xenial] [no depends, only system libs, sanitizers: thread (TSan), no wallet]' + name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, sanitizers: thread (TSan), no wallet]' + # Not enough memory on travis machines, so feature_block is excluded for now env: >- + TEST_RUNNER_EXTRA="--exclude feature_block" FILE_ENV="./ci/test/00_setup_env_native_tsan.sh" - TEST_RUNNER_EXTRA="--exclude feature_block" # Not enough memory on travis machines + # x86_64 Linux (no depends, only system libs, sanitizers: address/leak (ASan + LSan) + undefined (UBSan) + integer) - stage: test name: 'x86_64 Linux [GOAL: install] [focal] [no depends, only system libs, sanitizers: address/leak (ASan + LSan) + undefined (UBSan) + integer]' diff --git a/ci/dash/build_src.sh b/ci/dash/build_src.sh index 8fd4e0da12e2..5b4ad1f039f6 100755 --- a/ci/dash/build_src.sh +++ b/ci/dash/build_src.sh @@ -37,7 +37,7 @@ if [ -n "$CONFIG_SHELL" ]; then export CONFIG_SHELL="$CONFIG_SHELL" fi -BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib" +BITCOIN_CONFIG_ALL="--enable-suppress-external-warnings --disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib" ( test -n "$CONFIG_SHELL" && eval '"$CONFIG_SHELL" -c "./autogen.sh"' ) || ./autogen.sh diff --git a/ci/dash/test_integrationtests.sh b/ci/dash/test_integrationtests.sh index faf354eeb8cf..707fbd9fde13 100755 --- a/ci/dash/test_integrationtests.sh +++ b/ci/dash/test_integrationtests.sh @@ -42,7 +42,7 @@ echo "Using socketevents mode: $SOCKETEVENTS" EXTRA_ARGS="--dashd-arg=-socketevents=$SOCKETEVENTS" set +e -./test/functional/test_runner.py --ci --attempts=3 --ansi --combinedlogslen=4000 ${TEST_RUNNER_EXTRA} --failfast --nocleanup --tmpdir=$(pwd)/testdatadirs $PASS_ARGS $EXTRA_ARGS +LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib ./test/functional/test_runner.py --ci --attempts=3 --ansi --combinedlogslen=4000 ${TEST_RUNNER_EXTRA} --failfast --nocleanup --tmpdir=$(pwd)/testdatadirs $PASS_ARGS $EXTRA_ARGS RESULT=$? set -e diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index fb003981cc4e..eff442719e91 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -39,7 +39,6 @@ export USE_BUSY_BOX=${USE_BUSY_BOX:-false} export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true} export RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS:-true} export RUN_SECURITY_TESTS=${RUN_SECURITY_TESTS:-false} -export TEST_PREVIOUS_RELEASES=${TEST_PREVIOUS_RELEASES:-false} export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false} export RUN_SYMBOL_TESTS=${RUN_SYMBOL_TESTS:-true} export CONTAINER_NAME=${CONTAINER_NAME:-ci_unnamed} @@ -47,6 +46,8 @@ export DOCKER_NAME_TAG=${DOCKER_NAME_TAG:-ubuntu:focal} # Randomize test order. # See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1} +# See man 7 debconf +export DEBIAN_FRONTEND=noninteractive export HOST_CACHE_DIR=${HOST_CACHE_DIR:-$BASE_ROOT_DIR/ci-cache-$BUILD_TARGET} export CACHE_DIR=${CACHE_DIR:-$HOST_CACHE_DIR} export CCACHE_SIZE=${CCACHE_SIZE:-100M} diff --git a/ci/test/00_setup_env_mac_host.sh b/ci/test/00_setup_env_mac_host.sh index 177c87e1ccaa..fad5ae2889da 100755 --- a/ci/test/00_setup_env_mac_host.sh +++ b/ci/test/00_setup_env_mac_host.sh @@ -9,8 +9,6 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_macos export HOST=x86_64-apple-darwin export PIP_PACKAGES="zmq lief" -export RUN_UNIT_TESTS=true -export RUN_INTEGRATION_TESTS=false export RUN_SECURITY_TESTS="true" export GOAL="install" export BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --disable-miner --enable-werror" diff --git a/ci/test/00_setup_env_native_cxx20.sh b/ci/test/00_setup_env_native_cxx20.sh index 6de18f16ee7b..6d7405b2f2e3 100755 --- a/ci/test/00_setup_env_native_cxx20.sh +++ b/ci/test/00_setup_env_native_cxx20.sh @@ -13,5 +13,5 @@ export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG" export PYZMQ=true export RUN_INTEGRATION_TESTS=false export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --enable-c++20 --enable-suppress-external-warnings --enable-werror" +export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --enable-c++20 --enable-werror" diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 92001c8860a1..edaaff34dd0a 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -17,4 +17,4 @@ export RUN_UNIT_TESTS=false export RUN_INTEGRATION_TESTS=false export RUN_FUZZ_TESTS=true export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined --enable-c++17 --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" +export BITCOIN_CONFIG="--enable-zmq --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index 9805ccf12b22..ad2937e84b21 100644 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -15,4 +15,4 @@ export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=true export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="install" -export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer --enable-c++17 --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" +export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" diff --git a/ci/test/00_setup_env_native_qt5.sh b/ci/test/00_setup_env_native_qt5.sh index 093835275341..d99dda71899c 100755 --- a/ci/test/00_setup_env_native_qt5.sh +++ b/ci/test/00_setup_env_native_qt5.sh @@ -10,10 +10,9 @@ export CONTAINER_NAME=ci_native_qt5 export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev" export DEP_OPTS="NO_UPNP=1 DEBUG=1" # TODO: we have few rpcs that aren't covered by any test, re-enable the line below once it's fixed -# export TEST_RUNNER_EXTRA="--coverage --extended --exclude feature_pruning,feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash +# export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_pruning,feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" -export TEST_PREVIOUS_RELEASES=true export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.0.0 v0.16.1.1 v0.17.0.3 v18.2.2 v19.3.0 v20.0.1" export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++" diff --git a/ci/test/00_setup_env_native_tsan.sh b/ci/test/00_setup_env_native_tsan.sh index 60b2eaab6b79..9cdd91d46d0f 100755 --- a/ci/test/00_setup_env_native_tsan.sh +++ b/ci/test/00_setup_env_native_tsan.sh @@ -7,11 +7,11 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_tsan -export PACKAGES="clang-8 llvm-8 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev" +export PACKAGES="clang-15 llvm-15 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev" export DEP_OPTS="NO_UPNP=1 DEBUG=1" export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,wallet_multiwallet.py" # Temporarily suppress ASan heap-use-after-free (see issue #14163) export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --enable-suppress-external-warnings --with-sanitizers=thread" +export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=thread" export BITCOIN_CONFIG="${BITCOIN_CONFIG} CC=clang-15 CXX=clang++-15 CXXFLAGS=-Werror=thread-safety" export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG" export PYZMQ=true diff --git a/ci/test/00_setup_env_native_ubsan.sh b/ci/test/00_setup_env_native_ubsan.sh index f17852642fec..da979706a5ec 100755 --- a/ci/test/00_setup_env_native_ubsan.sh +++ b/ci/test/00_setup_env_native_ubsan.sh @@ -4,12 +4,13 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. +# TODO: use config `asan` instead `ubsan` for `undefined` sanitizer to unify with bitcoin export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_ubsan -export PACKAGES="clang-8 llvm-8 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev" +export PACKAGES="clang-15 llvm-15 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev" export DEP_OPTS="NO_UPNP=1 DEBUG=1" export GOAL="install" -export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=undefined --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" +export BITCOIN_CONFIG="--enable-zmq --enable-reduce-exports --enable-crash-hooks --with-sanitizers=undefined CC=clang-15 CXX=clang++-15" export PYZMQ=true export RUN_SYMBOL_TESTS=false diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 9067e80df9ca..e558eb0fcec9 100644 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -9,10 +9,6 @@ export LC_ALL=C.UTF-8 export PACKAGES="valgrind clang llvm python3-zmq libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev" export USE_VALGRIND=1 export NO_DEPENDS=1 -if [[ "${TRAVIS}" == "true" && "${TRAVIS_REPO_SLUG}" != "bitcoin/bitcoin" ]]; then - export TEST_RUNNER_EXTRA="wallet_disable" # Only run wallet_disable as a smoke test to not hit the 50 min travis time limit -else - export TEST_RUNNER_EXTRA="--exclude rpc_bind" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 -fi +export TEST_RUNNER_EXTRA="--exclude rpc_bind" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no --enable-suppress-external-warnings CC=clang-15 CXX=clang++-15" # TODO enable GUI diff --git a/ci/test/00_setup_env_s390x_host.sh b/ci/test/00_setup_env_s390x_host.sh deleted file mode 100644 index 3e31867f2f07..000000000000 --- a/ci/test/00_setup_env_s390x_host.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2019-2020 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C.UTF-8 - -export HOST=s390x-linux-gnu -export NO_DEPENDS=1 -export BITCOIN_CONFIG="--with-incompatible-bdb --enable-reduce-exports" -export RUN_UNIT_TESTS=true -export RUN_FUNCTIONAL_TESTS=true -export GOAL="install" diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 61f7c5acdc43..8e25a65a510d 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -26,7 +26,7 @@ export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order= export LSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/lsan" export TSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/tsan" export UBSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" -env | grep -E '^(BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|TEST_PREVIOUS_RELEASES|PREVIOUS_RELEASES_DIR))' | tee /tmp/env +env | grep -E '^(BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|PREVIOUS_RELEASES_DIR))' | tee /tmp/env if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN" elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764) diff --git a/configure.ac b/configure.ac index b01cf5af8da9..ad96a2d1e1da 100644 --- a/configure.ac +++ b/configure.ac @@ -424,6 +424,7 @@ if test "x$enable_werror" = "xyes"; then AC_MSG_ERROR("enable-werror set but -Werror is not usable") fi AX_CHECK_COMPILE_FLAG([-Werror=reorder],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=reorder"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Werror=gnu],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=gnu"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=shadow-field],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=shadow-field"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=switch],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=switch"],,[[$CXXFLAG_WERROR]]) @@ -433,6 +434,7 @@ if test "x$enable_werror" = "xyes"; then AX_CHECK_COMPILE_FLAG([-Werror=date-time],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=date-time"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=return-type],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=return-type"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Werror=conditional-uninitialized],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=conditional-uninitialized"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Werror=sign-compare],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=sign-compare"],,[[$CXXFLAG_WERROR]]) dnl -Wsuggest-override is broken with GCC before 9.2 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010 AX_CHECK_COMPILE_FLAG([-Werror=suggest-override],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=suggest-override"],,[[$CXXFLAG_WERROR]], @@ -457,6 +459,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then AX_CHECK_COMPILE_FLAG([-Wunused-member-function],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-member-function"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsign-compare"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]], [AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])]) AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]]) diff --git a/src/evo/assetlocktx.cpp b/src/evo/assetlocktx.cpp index 88ce8708a4a3..2908432f663b 100644 --- a/src/evo/assetlocktx.cpp +++ b/src/evo/assetlocktx.cpp @@ -123,7 +123,7 @@ bool CAssetUnlockPayload::VerifySig(const uint256& msgHash, gsl::not_nullnHeight < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) { + if (static_cast(pindexTip->nHeight) < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) { LogPrint(BCLog::CREDITPOOL, "Asset unlock tx %d with requested height %d could not be accepted on height: %d\n", index, requestedHeight, pindexTip->nHeight); return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-too-late"); diff --git a/src/evo/cbtx.cpp b/src/evo/cbtx.cpp index 8bfe14ab500a..8f96d5f2b067 100644 --- a/src/evo/cbtx.cpp +++ b/src/evo/cbtx.cpp @@ -398,8 +398,8 @@ bool CalcCbTxBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, co } // We check if our best CL is newer than the one from previous block Coinbase - auto curCLHeight = best_clsig.getHeight(); - auto prevCLHeight = static_cast(pindexPrev->nHeight) - prevBlockCoinbaseChainlock->second - 1; + int curCLHeight = best_clsig.getHeight(); + int prevCLHeight = pindexPrev->nHeight - static_cast(prevBlockCoinbaseChainlock->second) - 1; if (curCLHeight < prevCLHeight) { // Our best CL isn't newer: inserting CL from previous block bestCLHeightDiff = prevBlockCoinbaseChainlock->second + 1; @@ -407,7 +407,7 @@ bool CalcCbTxBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, co } else { // Our best CL is newer - bestCLHeightDiff = static_cast(pindexPrev->nHeight) - best_clsig.getHeight(); + bestCLHeightDiff = pindexPrev->nHeight - best_clsig.getHeight(); bestCLSignature = best_clsig.getSig(); } @@ -423,7 +423,7 @@ bool CalcCbTxBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, co } // Inserting our best CL - bestCLHeightDiff = static_cast(pindexPrev->nHeight) - best_clsig.getHeight(); + bestCLHeightDiff = pindexPrev->nHeight - best_clsig.getHeight(); bestCLSignature = chainlock_handler.GetBestChainLock().getSig(); return true; diff --git a/src/llmq/debug.cpp b/src/llmq/debug.cpp index 8f02c3d8d867..6e4e5677c2c6 100644 --- a/src/llmq/debug.cpp +++ b/src/llmq/debug.cpp @@ -36,11 +36,11 @@ UniValue CDKGDebugSessionStatus::ToJson(int quorumIndex, int detailLevel) const ret.pushKV("quorumHeight", (int)quorumHeight); ret.pushKV("phase", ToUnderlying(phase)); - ret.pushKV("sentContributions", sentContributions); - ret.pushKV("sentComplaint", sentComplaint); - ret.pushKV("sentJustification", sentJustification); - ret.pushKV("sentPrematureCommitment", sentPrematureCommitment); - ret.pushKV("aborted", aborted); + ret.pushKV("sentContributions", statusBits.sentContributions); + ret.pushKV("sentComplaint", statusBits.sentComplaint); + ret.pushKV("sentJustification", statusBits.sentJustification); + ret.pushKV("sentPrematureCommitment", statusBits.sentPrematureCommitment); + ret.pushKV("aborted", statusBits.aborted); struct ArrOrCount { int count{0}; @@ -81,12 +81,12 @@ UniValue CDKGDebugSessionStatus::ToJson(int quorumIndex, int detailLevel) const for (const auto i : irange::range(members.size())) { const auto& m = members[i]; - add(badMembers, i, m.bad); - add(weComplain, i, m.weComplain); - add(receivedContributions, i, m.receivedContribution); - add(receivedComplaints, i, m.receivedComplaint); - add(receivedJustifications, i, m.receivedJustification); - add(receivedPrematureCommitments, i, m.receivedPrematureCommitment); + add(badMembers, i, m.statusBits.bad); + add(weComplain, i, m.statusBits.weComplain); + add(receivedContributions, i, m.statusBits.receivedContribution); + add(receivedComplaints, i, m.statusBits.receivedComplaint); + add(receivedJustifications, i, m.statusBits.receivedJustification); + add(receivedPrematureCommitments, i, m.statusBits.receivedPrematureCommitment); } push(badMembers, "badMembers"); push(weComplain, "weComplain"); diff --git a/src/llmq/debug.h b/src/llmq/debug.h index 253faf13add3..6788bc7c60c6 100644 --- a/src/llmq/debug.h +++ b/src/llmq/debug.h @@ -37,7 +37,7 @@ class CDKGDebugMemberStatus bool receivedComplaint : 1; bool receivedJustification : 1; bool receivedPrematureCommitment : 1; - }; + } statusBits; uint8_t statusBitset; }; @@ -65,7 +65,7 @@ class CDKGDebugSessionStatus bool sentPrematureCommitment : 1; bool aborted : 1; - }; + } statusBits; uint8_t statusBitset; }; diff --git a/src/llmq/dkgsession.cpp b/src/llmq/dkgsession.cpp index 2a0b888f20be..943c28c6435a 100644 --- a/src/llmq/dkgsession.cpp +++ b/src/llmq/dkgsession.cpp @@ -202,7 +202,7 @@ void CDKGSession::SendContributions(CDKGPendingMessages& pendingMessages) logger.Flush(); dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { - status.sentContributions = true; + status.statusBits.sentContributions = true; return true; }); @@ -285,7 +285,7 @@ void CDKGSession::ReceiveMessage(const CDKGContribution& qc, bool& retBan) RelayInvToParticipants(inv); dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { - status.receivedContribution = true; + status.statusBits.receivedContribution = true; return true; }); @@ -325,7 +325,7 @@ void CDKGSession::ReceiveMessage(const CDKGContribution& qc, bool& retBan) if (complain) { member->weComplain = true; dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { - status.weComplain = true; + status.statusBits.weComplain = true; return true; }); return; @@ -393,7 +393,7 @@ void CDKGSession::VerifyPendingContributions() logger.Batch("invalid contribution from %s. will complain later", m->dmn->proTxHash.ToString()); m->weComplain = true; dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, m->idx, [&](CDKGDebugMemberStatus& status) { - status.weComplain = true; + status.statusBits.weComplain = true; return true; }); } else { @@ -520,7 +520,7 @@ void CDKGSession::SendComplaint(CDKGPendingMessages& pendingMessages) logger.Flush(); dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { - status.sentComplaint = true; + status.statusBits.sentComplaint = true; return true; }); @@ -593,7 +593,7 @@ void CDKGSession::ReceiveMessage(const CDKGComplaint& qc, bool& retBan) RelayInvToParticipants(inv); dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { - status.receivedComplaint = true; + status.statusBits.receivedComplaint = true; return true; }); @@ -714,7 +714,7 @@ void CDKGSession::SendJustification(CDKGPendingMessages& pendingMessages, const logger.Flush(); dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { - status.sentJustification = true; + status.statusBits.sentJustification = true; return true; }); @@ -804,7 +804,7 @@ void CDKGSession::ReceiveMessage(const CDKGJustification& qj, bool& retBan) RelayInvToParticipants(inv); dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { - status.receivedJustification = true; + status.statusBits.receivedJustification = true; return true; }); @@ -1026,7 +1026,7 @@ void CDKGSession::SendCommitment(CDKGPendingMessages& pendingMessages) logger.Flush(); dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { - status.sentPrematureCommitment = true; + status.statusBits.sentPrematureCommitment = true; return true; }); @@ -1163,7 +1163,7 @@ void CDKGSession::ReceiveMessage(const CDKGPrematureCommitment& qc, bool& retBan RelayInvToParticipants(inv); dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, member->idx, [&](CDKGDebugMemberStatus& status) { - status.receivedPrematureCommitment = true; + status.statusBits.receivedPrematureCommitment = true; return true; }); @@ -1298,7 +1298,7 @@ void CDKGSession::MarkBadMember(size_t idx) return; } dkgDebugManager.UpdateLocalMemberStatus(params.type, quorumIndex, idx, [&](CDKGDebugMemberStatus& status) { - status.bad = true; + status.statusBits.bad = true; return true; }); member->bad = true; diff --git a/src/llmq/dkgsessionhandler.cpp b/src/llmq/dkgsessionhandler.cpp index 3acc3539e180..4cbe4532b5a3 100644 --- a/src/llmq/dkgsessionhandler.cpp +++ b/src/llmq/dkgsessionhandler.cpp @@ -567,7 +567,7 @@ void CDKGSessionHandler::PhaseHandlerThread() HandleDKGRound(); } catch (AbortPhaseException& e) { dkgDebugManager.UpdateLocalSessionStatus(params.type, quorumIndex, [&](CDKGDebugSessionStatus& status) { - status.aborted = true; + status.statusBits.aborted = true; return true; }); LogPrint(BCLog::LLMQ_DKG, "CDKGSessionHandler::%s -- %s qi[%d] - aborted current DKG session\n", __func__, params.name, quorumIndex); diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index 0e392a9643f1..bb32fb0e3690 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -572,7 +572,7 @@ std::vector CQuorumManager::ScanQuorums(Consensus::LLMQType llmqTyp for (auto& pQuorumBaseBlockIndex : pQuorumBaseBlockIndexes) { assert(pQuorumBaseBlockIndex); // populate cache for keepOldConnections most recent quorums only - bool populate_cache = vecResultQuorums.size() < llmq_params_opt->keepOldConnections; + bool populate_cache = vecResultQuorums.size() < static_cast(llmq_params_opt->keepOldConnections); auto quorum = GetQuorum(llmqType, pQuorumBaseBlockIndex, populate_cache); assert(quorum != nullptr); vecResultQuorums.emplace_back(quorum); @@ -1077,7 +1077,7 @@ void CQuorumManager::StartCleanupOldQuorumDataThread(const CBlockIndex* pIndex) uint256 quorum_key; if (cache.get(pindex_loop->GetBlockHash(), quorum_key)) { quorum_keys.insert(quorum_key); - if (quorum_keys.size() >= params.keepOldKeys) break; // extra safety belt + if (quorum_keys.size() >= static_cast(params.keepOldKeys)) break; // extra safety belt } pindex_loop = pindex_loop->pprev; } diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp index dbd95b107fa0..a2bab832a81c 100644 --- a/src/test/blockfilter_index_tests.cpp +++ b/src/test/blockfilter_index_tests.cpp @@ -50,8 +50,8 @@ static bool CheckFilterLookups(BlockFilterIndex& filter_index, const CBlockIndex BOOST_CHECK(filter_index.LookupFilterHashRange(block_index->nHeight, block_index, filter_hashes)); - BOOST_CHECK_EQUAL(filters.size(), 1); - BOOST_CHECK_EQUAL(filter_hashes.size(), 1); + BOOST_CHECK_EQUAL(filters.size(), 1U); + BOOST_CHECK_EQUAL(filter_hashes.size(), 1U); BOOST_CHECK_EQUAL(filter.GetHash(), expected_filter.GetHash()); BOOST_CHECK_EQUAL(filter_header, expected_filter.ComputeHeader(last_header)); @@ -257,8 +257,9 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, BuildChainTestingSetup) BOOST_CHECK(filter_index.LookupFilterRange(0, tip, filters)); BOOST_CHECK(filter_index.LookupFilterHashRange(0, tip, filter_hashes)); - BOOST_CHECK_EQUAL(filters.size(), tip->nHeight + 1); - BOOST_CHECK_EQUAL(filter_hashes.size(), tip->nHeight + 1); + assert(tip->nHeight >= 0); + BOOST_CHECK_EQUAL(filters.size(), tip->nHeight + 1U); + BOOST_CHECK_EQUAL(filter_hashes.size(), tip->nHeight + 1U); filters.clear(); filter_hashes.clear(); diff --git a/src/test/blockfilter_tests.cpp b/src/test/blockfilter_tests.cpp index 1e0c30f317cb..5e418ba9e2d5 100644 --- a/src/test/blockfilter_tests.cpp +++ b/src/test/blockfilter_tests.cpp @@ -42,14 +42,14 @@ BOOST_AUTO_TEST_CASE(gcsfilter_test) BOOST_AUTO_TEST_CASE(gcsfilter_default_constructor) { GCSFilter filter; - BOOST_CHECK_EQUAL(filter.GetN(), 0); - BOOST_CHECK_EQUAL(filter.GetEncoded().size(), 1); + BOOST_CHECK_EQUAL(filter.GetN(), 0U); + BOOST_CHECK_EQUAL(filter.GetEncoded().size(), 1U); const GCSFilter::Params& params = filter.GetParams(); - BOOST_CHECK_EQUAL(params.m_siphash_k0, 0); - BOOST_CHECK_EQUAL(params.m_siphash_k1, 0); + BOOST_CHECK_EQUAL(params.m_siphash_k0, 0U); + BOOST_CHECK_EQUAL(params.m_siphash_k1, 0U); BOOST_CHECK_EQUAL(params.m_P, 0); - BOOST_CHECK_EQUAL(params.m_M, 1); + BOOST_CHECK_EQUAL(params.m_M, 1U); } BOOST_AUTO_TEST_CASE(blockfilter_basic_test) diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index 2d8df1658343..620299922911 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -574,7 +574,7 @@ BOOST_AUTO_TEST_CASE(rolling_bloom) ++nHits; } // Expect about 100 hits - BOOST_CHECK_EQUAL(nHits, 75); + BOOST_CHECK_EQUAL(nHits, 75U); BOOST_CHECK(rb1.contains(data[DATASIZE-1])); rb1.reset(); @@ -602,7 +602,7 @@ BOOST_AUTO_TEST_CASE(rolling_bloom) ++nHits; } // Expect about 5 false positives - BOOST_CHECK_EQUAL(nHits, 6); + BOOST_CHECK_EQUAL(nHits, 6U); // last-1000-entry, 0.01% false positive: CRollingBloomFilter rb2(1000, 0.001); diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp index 4bc301f583f3..7b661a0d1da9 100644 --- a/src/test/compress_tests.cpp +++ b/src/test/compress_tests.cpp @@ -70,14 +70,14 @@ BOOST_AUTO_TEST_CASE(compress_script_to_ckey_id) CPubKey pubkey = key.GetPubKey(); CScript script = CScript() << OP_DUP << OP_HASH160 << ToByteVector(pubkey.GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; - BOOST_CHECK_EQUAL(script.size(), 25); + BOOST_CHECK_EQUAL(script.size(), 25U); CompressedScript out; bool done = CompressScript(script, out); BOOST_CHECK_EQUAL(done, true); // Check compressed script - BOOST_CHECK_EQUAL(out.size(), 21); + BOOST_CHECK_EQUAL(out.size(), 21U); BOOST_CHECK_EQUAL(out[0], 0x00); BOOST_CHECK_EQUAL(memcmp(&out[1], &script[3], 20), 0); // compare the 20 relevant chars of the CKeyId in the script } @@ -87,14 +87,14 @@ BOOST_AUTO_TEST_CASE(compress_script_to_cscript_id) // case CScriptID CScript script, redeemScript; script << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL; - BOOST_CHECK_EQUAL(script.size(), 23); + BOOST_CHECK_EQUAL(script.size(), 23U); CompressedScript out; bool done = CompressScript(script, out); BOOST_CHECK_EQUAL(done, true); // Check compressed script - BOOST_CHECK_EQUAL(out.size(), 21); + BOOST_CHECK_EQUAL(out.size(), 21U); BOOST_CHECK_EQUAL(out[0], 0x01); BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 20), 0); // compare the 20 relevant chars of the CScriptId in the script } @@ -105,14 +105,14 @@ BOOST_AUTO_TEST_CASE(compress_script_to_compressed_pubkey_id) key.MakeNewKey(true); // case compressed PubKeyID CScript script = CScript() << ToByteVector(key.GetPubKey()) << OP_CHECKSIG; // COMPRESSED_PUBLIC_KEY_SIZE (33) - BOOST_CHECK_EQUAL(script.size(), 35); + BOOST_CHECK_EQUAL(script.size(), 35U); CompressedScript out; bool done = CompressScript(script, out); BOOST_CHECK_EQUAL(done, true); // Check compressed script - BOOST_CHECK_EQUAL(out.size(), 33); + BOOST_CHECK_EQUAL(out.size(), 33U); BOOST_CHECK_EQUAL(memcmp(&out[0], &script[1], 1), 0); BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 32), 0); // compare the 32 chars of the compressed CPubKey } @@ -122,14 +122,14 @@ BOOST_AUTO_TEST_CASE(compress_script_to_uncompressed_pubkey_id) CKey key; key.MakeNewKey(false); // case uncompressed PubKeyID CScript script = CScript() << ToByteVector(key.GetPubKey()) << OP_CHECKSIG; // PUBLIC_KEY_SIZE (65) - BOOST_CHECK_EQUAL(script.size(), 67); // 1 char code + 65 char pubkey + OP_CHECKSIG + BOOST_CHECK_EQUAL(script.size(), 67U); // 1 char code + 65 char pubkey + OP_CHECKSIG CompressedScript out; bool done = CompressScript(script, out); BOOST_CHECK_EQUAL(done, true); // Check compressed script - BOOST_CHECK_EQUAL(out.size(), 33); + BOOST_CHECK_EQUAL(out.size(), 33U); BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 32), 0); // first 32 chars of CPubKey are copied into out[1:] BOOST_CHECK_EQUAL(out[0], 0x04 | (script[65] & 0x01)); // least significant bit (lsb) of last char of pubkey is mapped into out[0] } diff --git a/src/test/descriptor_tests.cpp b/src/test/descriptor_tests.cpp index 9f23dea8c31c..f2430c5f72db 100644 --- a/src/test/descriptor_tests.cpp +++ b/src/test/descriptor_tests.cpp @@ -233,7 +233,7 @@ void DoCheck(const std::string& prv, const std::string& pub, int flags, const st std::vector spks_inferred; FlatSigningProvider provider_inferred; BOOST_CHECK(inferred->Expand(0, provider_inferred, spks_inferred, provider_inferred)); - BOOST_CHECK_EQUAL(spks_inferred.size(), 1); + BOOST_CHECK_EQUAL(spks_inferred.size(), 1U); BOOST_CHECK(spks_inferred[0] == spks[n]); BOOST_CHECK_EQUAL(IsSolvable(provider_inferred, spks_inferred[0]), !(flags & UNSOLVABLE)); BOOST_CHECK(provider_inferred.origins == script_provider.origins); diff --git a/src/test/flatfile_tests.cpp b/src/test/flatfile_tests.cpp index 9bb0b3ef02ba..be7484cd0b41 100644 --- a/src/test/flatfile_tests.cpp +++ b/src/test/flatfile_tests.cpp @@ -93,16 +93,16 @@ BOOST_AUTO_TEST_CASE(flatfile_allocate) bool out_of_space; - BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 0), 1, out_of_space), 100); - BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 0))), 100); + BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 0), 1, out_of_space), 100U); + BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 0))), 100U); BOOST_CHECK(!out_of_space); - BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 99), 1, out_of_space), 0); - BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 99))), 100); + BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 99), 1, out_of_space), 0U); + BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 99))), 100U); BOOST_CHECK(!out_of_space); - BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 99), 2, out_of_space), 101); - BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 99))), 200); + BOOST_CHECK_EQUAL(seq.Allocate(FlatFilePos(0, 99), 2, out_of_space), 101U); + BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 99))), 200U); BOOST_CHECK(!out_of_space); } @@ -116,11 +116,11 @@ BOOST_AUTO_TEST_CASE(flatfile_flush) // Flush without finalize should not truncate file. seq.Flush(FlatFilePos(0, 1)); - BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 1))), 100); + BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 1))), 100U); // Flush with finalize should truncate file. seq.Flush(FlatFilePos(0, 1), true); - BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 1))), 1); + BOOST_CHECK_EQUAL(fs::file_size(seq.FileName(FlatFilePos(0, 1))), 1U); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index 77250c6bb902..2e76f2d24c4c 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -547,7 +547,7 @@ BOOST_AUTO_TEST_CASE(netpermissions_test) BOOST_CHECK(NetWhitelistPermissions::TryParse("bloom,forcerelay,noban,relay,mempool@1.2.3.4/32", whitelistPermissions, error)); const auto strings = NetPermissions::ToStrings(PF_ALL); - BOOST_CHECK_EQUAL(strings.size(), 7); + BOOST_CHECK_EQUAL(strings.size(), 7U); BOOST_CHECK(std::find(strings.begin(), strings.end(), "bloomfilter") != strings.end()); BOOST_CHECK(std::find(strings.begin(), strings.end(), "forcerelay") != strings.end()); BOOST_CHECK(std::find(strings.begin(), strings.end(), "relay") != strings.end()); diff --git a/src/test/random_tests.cpp b/src/test/random_tests.cpp index 40a2378fe9ee..258a3eafeff9 100644 --- a/src/test/random_tests.cpp +++ b/src/test/random_tests.cpp @@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(shuffle_stat_test) } BOOST_CHECK(chi_score > 58.1411); // 99.9999% confidence interval BOOST_CHECK(chi_score < 210.275); - BOOST_CHECK_EQUAL(sum, 12000); + BOOST_CHECK_EQUAL(sum, 12000U); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp index 7aa4d9b3c3b1..af6e302878f0 100644 --- a/src/test/streams_tests.cpp +++ b/src/test/streams_tests.cpp @@ -72,28 +72,28 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader) std::vector vch = {1, 255, 3, 4, 5, 6}; VectorReader reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0); - BOOST_CHECK_EQUAL(reader.size(), 6); + BOOST_CHECK_EQUAL(reader.size(), 6U); BOOST_CHECK(!reader.empty()); // Read a single byte as an unsigned char. unsigned char a; reader >> a; BOOST_CHECK_EQUAL(a, 1); - BOOST_CHECK_EQUAL(reader.size(), 5); + BOOST_CHECK_EQUAL(reader.size(), 5U); BOOST_CHECK(!reader.empty()); // Read a single byte as a signed char. signed char b; reader >> b; BOOST_CHECK_EQUAL(b, -1); - BOOST_CHECK_EQUAL(reader.size(), 4); + BOOST_CHECK_EQUAL(reader.size(), 4U); BOOST_CHECK(!reader.empty()); // Read a 4 bytes as an unsigned int. unsigned int c; reader >> c; - BOOST_CHECK_EQUAL(c, 100992003); // 3,4,5,6 in little-endian base-256 - BOOST_CHECK_EQUAL(reader.size(), 0); + BOOST_CHECK_EQUAL(c, 100992003U); // 3,4,5,6 in little-endian base-256 + BOOST_CHECK_EQUAL(reader.size(), 0U); BOOST_CHECK(reader.empty()); // Reading after end of byte vector throws an error. @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader) VectorReader new_reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0); new_reader >> d; BOOST_CHECK_EQUAL(d, 67370753); // 1,255,3,4 in little-endian base-256 - BOOST_CHECK_EQUAL(new_reader.size(), 2); + BOOST_CHECK_EQUAL(new_reader.size(), 2U); BOOST_CHECK(!new_reader.empty()); // Reading after end of byte vector throws an error even if the reader is @@ -147,14 +147,14 @@ BOOST_AUTO_TEST_CASE(bitstream_reader_writer) BOOST_CHECK_EQUAL(serialized_int2, (uint16_t)0x1072); // NOTE: Serialized as LE BitStreamReader bit_reader(data_copy); - BOOST_CHECK_EQUAL(bit_reader.Read(1), 0); - BOOST_CHECK_EQUAL(bit_reader.Read(2), 2); - BOOST_CHECK_EQUAL(bit_reader.Read(3), 6); - BOOST_CHECK_EQUAL(bit_reader.Read(4), 11); - BOOST_CHECK_EQUAL(bit_reader.Read(5), 1); - BOOST_CHECK_EQUAL(bit_reader.Read(6), 32); - BOOST_CHECK_EQUAL(bit_reader.Read(7), 7); - BOOST_CHECK_EQUAL(bit_reader.Read(16), 30497); + BOOST_CHECK_EQUAL(bit_reader.Read(1), 0U); + BOOST_CHECK_EQUAL(bit_reader.Read(2), 2U); + BOOST_CHECK_EQUAL(bit_reader.Read(3), 6U); + BOOST_CHECK_EQUAL(bit_reader.Read(4), 11U); + BOOST_CHECK_EQUAL(bit_reader.Read(5), 1U); + BOOST_CHECK_EQUAL(bit_reader.Read(6), 32U); + BOOST_CHECK_EQUAL(bit_reader.Read(7), 7U); + BOOST_CHECK_EQUAL(bit_reader.Read(16), 30497U); BOOST_CHECK_THROW(bit_reader.Read(8), std::ios_base::failure); } @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file) BOOST_CHECK_EQUAL(i, 1); // After reading bytes 0 and 1, we're positioned at 2. - BOOST_CHECK_EQUAL(bf.GetPos(), 2); + BOOST_CHECK_EQUAL(bf.GetPos(), 2U); // Rewind to offset 0, ok (within the 10 byte window). BOOST_CHECK(bf.SetPos(0)); @@ -274,18 +274,18 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file) // The default argument removes the limit completely. BOOST_CHECK(bf.SetLimit()); // The read position should still be at 3 (no change). - BOOST_CHECK_EQUAL(bf.GetPos(), 3); + BOOST_CHECK_EQUAL(bf.GetPos(), 3U); // Read from current offset, 3, forward until position 10. for (uint8_t j = 3; j < 10; ++j) { bf >> i; BOOST_CHECK_EQUAL(i, j); } - BOOST_CHECK_EQUAL(bf.GetPos(), 10); + BOOST_CHECK_EQUAL(bf.GetPos(), 10U); // We're guaranteed (just barely) to be able to rewind to zero. BOOST_CHECK(bf.SetPos(0)); - BOOST_CHECK_EQUAL(bf.GetPos(), 0); + BOOST_CHECK_EQUAL(bf.GetPos(), 0U); bf >> i; BOOST_CHECK_EQUAL(i, 0); @@ -295,12 +295,12 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file) BOOST_CHECK(bf.SetPos(10)); bf >> i; BOOST_CHECK_EQUAL(i, 10); - BOOST_CHECK_EQUAL(bf.GetPos(), 11); + BOOST_CHECK_EQUAL(bf.GetPos(), 11U); // Now it's only guaranteed that we can rewind to offset 1 // (current read position, 11, minus rewind amount, 10). BOOST_CHECK(bf.SetPos(1)); - BOOST_CHECK_EQUAL(bf.GetPos(), 1); + BOOST_CHECK_EQUAL(bf.GetPos(), 1U); bf >> i; BOOST_CHECK_EQUAL(i, 1); @@ -314,7 +314,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file) BOOST_CHECK_EQUAL(a[j], 11 + j); } } - BOOST_CHECK_EQUAL(bf.GetPos(), 40); + BOOST_CHECK_EQUAL(bf.GetPos(), 40U); // We've read the entire file, the next read should throw. try { @@ -328,11 +328,11 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file) BOOST_CHECK(bf.eof()); // Still at offset 40, we can go back 10, to 30. - BOOST_CHECK_EQUAL(bf.GetPos(), 40); + BOOST_CHECK_EQUAL(bf.GetPos(), 40U); BOOST_CHECK(bf.SetPos(30)); bf >> i; BOOST_CHECK_EQUAL(i, 30); - BOOST_CHECK_EQUAL(bf.GetPos(), 31); + BOOST_CHECK_EQUAL(bf.GetPos(), 31U); // We're too far to rewind to position zero. BOOST_CHECK(!bf.SetPos(0)); diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 114fd4b8700f..d741c1bc259d 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -344,9 +344,9 @@ class CheckValueTest : public TestChain100Setup BOOST_CHECK_EQUAL(test.GetSetting("-value").write(), expect.setting.write()); auto settings_list = test.GetSettingsList("-value"); if (expect.setting.isNull() || expect.setting.isFalse()) { - BOOST_CHECK_EQUAL(settings_list.size(), 0); + BOOST_CHECK_EQUAL(settings_list.size(), 0U); } else { - BOOST_CHECK_EQUAL(settings_list.size(), 1); + BOOST_CHECK_EQUAL(settings_list.size(), 1U); BOOST_CHECK_EQUAL(settings_list[0].write(), expect.setting.write()); } @@ -2197,24 +2197,24 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector) BOOST_CHECK(t3.origin == &t3); auto v1 = Vector(t1); - BOOST_CHECK_EQUAL(v1.size(), 1); + BOOST_CHECK_EQUAL(v1.size(), 1U); BOOST_CHECK(v1[0].origin == &t1); BOOST_CHECK_EQUAL(v1[0].copies, 1); auto v2 = Vector(std::move(t2)); - BOOST_CHECK_EQUAL(v2.size(), 1); + BOOST_CHECK_EQUAL(v2.size(), 1U); BOOST_CHECK(v2[0].origin == &t2); BOOST_CHECK_EQUAL(v2[0].copies, 0); auto v3 = Vector(t1, std::move(t2)); - BOOST_CHECK_EQUAL(v3.size(), 2); + BOOST_CHECK_EQUAL(v3.size(), 2U); BOOST_CHECK(v3[0].origin == &t1); BOOST_CHECK(v3[1].origin == &t2); BOOST_CHECK_EQUAL(v3[0].copies, 1); BOOST_CHECK_EQUAL(v3[1].copies, 0); auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3)); - BOOST_CHECK_EQUAL(v4.size(), 3); + BOOST_CHECK_EQUAL(v4.size(), 3U); BOOST_CHECK(v4[0].origin == &t1); BOOST_CHECK(v4[1].origin == &t2); BOOST_CHECK(v4[2].origin == &t3); @@ -2223,7 +2223,7 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector) BOOST_CHECK_EQUAL(v4[2].copies, 0); auto v5 = Cat(v1, v4); - BOOST_CHECK_EQUAL(v5.size(), 4); + BOOST_CHECK_EQUAL(v5.size(), 4U); BOOST_CHECK(v5[0].origin == &t1); BOOST_CHECK(v5[1].origin == &t1); BOOST_CHECK(v5[2].origin == &t2); @@ -2234,7 +2234,7 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector) BOOST_CHECK_EQUAL(v5[3].copies, 1); auto v6 = Cat(std::move(v1), v3); - BOOST_CHECK_EQUAL(v6.size(), 3); + BOOST_CHECK_EQUAL(v6.size(), 3U); BOOST_CHECK(v6[0].origin == &t1); BOOST_CHECK(v6[1].origin == &t1); BOOST_CHECK(v6[2].origin == &t2); @@ -2243,7 +2243,7 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector) BOOST_CHECK_EQUAL(v6[2].copies, 1); auto v7 = Cat(v2, std::move(v4)); - BOOST_CHECK_EQUAL(v7.size(), 4); + BOOST_CHECK_EQUAL(v7.size(), 4U); BOOST_CHECK(v7[0].origin == &t2); BOOST_CHECK(v7[1].origin == &t1); BOOST_CHECK(v7[2].origin == &t2); @@ -2254,7 +2254,7 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector) BOOST_CHECK_EQUAL(v7[3].copies, 0); auto v8 = Cat(std::move(v2), std::move(v3)); - BOOST_CHECK_EQUAL(v8.size(), 3); + BOOST_CHECK_EQUAL(v8.size(), 3U); BOOST_CHECK(v8[0].origin == &t2); BOOST_CHECK(v8[1].origin == &t1); BOOST_CHECK(v8[2].origin == &t2); @@ -2301,11 +2301,11 @@ BOOST_AUTO_TEST_CASE(test_Capitalize) BOOST_AUTO_TEST_CASE(test_CRanges) { std::mt19937 gen; - for (size_t test = 0; test < 17; ++test) { + for (int test = 0; test < 17; ++test) { std::uniform_int_distribution dist_value(0, (1 << test)); CRangesSet ranges; std::unordered_set set_2; - for (size_t iter = 0; iter < (1 << test) * 2; ++iter) { + for (int iter = 0; iter < (1 << test) * 2; ++iter) { uint64_t value = dist_value(gen); BOOST_CHECK_EQUAL(ranges.Contains(value), !!set_2.count(value)); if (!ranges.Contains(value)) { @@ -2319,7 +2319,7 @@ BOOST_AUTO_TEST_CASE(test_CRanges) BOOST_CHECK_EQUAL(ranges.Size(), set_2.size()); } if (test > 4) { - BOOST_CHECK(ranges.Size() > ((1 << test) / 4)); + BOOST_CHECK(ranges.Size() > ((1u << test) / 4)); } } } diff --git a/src/test/util_threadnames_tests.cpp b/src/test/util_threadnames_tests.cpp index 7b29b3383e66..f3f9fb2bffc2 100644 --- a/src/test/util_threadnames_tests.cpp +++ b/src/test/util_threadnames_tests.cpp @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded) std::set names = RenameEnMasse(100); - BOOST_CHECK_EQUAL(names.size(), 100); + BOOST_CHECK_EQUAL(names.size(), 100U); // Names "test_thread.[n]" should exist for n = [0, 99] for (int i = 0; i < 100; ++i) { diff --git a/src/test/validation_flush_tests.cpp b/src/test/validation_flush_tests.cpp index cea4ffe0457d..0b1c35a4be41 100644 --- a/src/test/validation_flush_tests.cpp +++ b/src/test/validation_flush_tests.cpp @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate) // (prevector<28, unsigned char>) when assigned 56 bytes of data per above. // // See also: Coin::DynamicMemoryUsage(). - constexpr int COIN_SIZE = is_64_bit ? 80 : 64; + constexpr unsigned int COIN_SIZE = is_64_bit ? 80 : 64; auto print_view_mem_usage = [](CCoinsViewCache& view) { BOOST_TEST_MESSAGE("CCoinsViewCache memory usage: " << view.DynamicMemoryUsage()); @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate) } print_view_mem_usage(view); - BOOST_CHECK_EQUAL(view.DynamicMemoryUsage(), is_64_bit ? 32 : 16); + BOOST_CHECK_EQUAL(view.DynamicMemoryUsage(), is_64_bit ? 32U : 16U); // We should be able to add COINS_UNTIL_CRITICAL coins to the cache before going CRITICAL. // This is contingent not only on the dynamic memory usage of the Coins diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 5a363122e8fc..4c030fb623ac 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -987,7 +987,7 @@ void CTxMemPool::removeForBlock(const std::vector& vtx, unsigne /** * Called when a lenght of chain is increased. Removes from mempool expired asset-unlock transactions */ -void CTxMemPool::removeExpiredAssetUnlock(unsigned int nBlockHeight) +void CTxMemPool::removeExpiredAssetUnlock(int nBlockHeight) { AssertLockHeld(cs); // items to removed should be firstly collected to independed list, diff --git a/src/txmempool.h b/src/txmempool.h index cfe66c96822c..a563133b9495 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -621,7 +621,7 @@ class CTxMemPool void removeProTxKeyChangedConflicts(const CTransaction &tx, const uint256& proTxHash, const uint256& newKeyHash) EXCLUSIVE_LOCKS_REQUIRED(cs); void removeProTxConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs); void removeForBlock(const std::vector& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs); - void removeExpiredAssetUnlock(unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs); + void removeExpiredAssetUnlock(int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs); void clear(); void _clear() EXCLUSIVE_LOCKS_REQUIRED(cs); //lock free diff --git a/src/util/asmap.cpp b/src/util/asmap.cpp index 5ebbc0614583..ca9d41c09ea5 100644 --- a/src/util/asmap.cpp +++ b/src/util/asmap.cpp @@ -93,7 +93,8 @@ uint32_t Interpret(const std::vector &asmap, const std::vector &ip) jump = DecodeJump(pos, endpos); if (jump == INVALID) break; // Jump offset straddles EOF if (bits == 0) break; // No input bits left - if (jump >= endpos - pos) break; // Jumping past EOF + if (pos + jump < pos) break; // overflow + if (pos + jump >= endpos) break; // Jumping past EOF if (ip[ip.size() - bits]) { pos += jump; } @@ -155,7 +156,8 @@ bool SanityCheckASMap(const std::vector& asmap, int bits) } else if (opcode == Instruction::JUMP) { uint32_t jump = DecodeJump(pos, endpos); if (jump == INVALID) return false; // Jump offset straddles EOF - if (jump > endpos - pos) return false; // Jump out of range + if (pos + jump < pos) return false; // overflow + if (pos + jump > endpos) return false; // Jump out of range if (bits == 0) return false; // Consuming bits past the end of the input --bits; uint32_t jump_offset = pos - begin + jump; diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index dbe1350c0153..3fe6a8f633d1 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -1265,8 +1265,8 @@ BOOST_FIXTURE_TEST_CASE(CreateWalletFromFile, TestChain100Setup) BOOST_CHECK_EQUAL(addtx_count, 2); { LOCK(wallet->cs_wallet); - BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_tx.GetHash()), 1); - BOOST_CHECK_EQUAL(wallet->mapWallet.count(mempool_tx.GetHash()), 1); + BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_tx.GetHash()), 1U); + BOOST_CHECK_EQUAL(wallet->mapWallet.count(mempool_tx.GetHash()), 1U); } @@ -1303,8 +1303,8 @@ BOOST_FIXTURE_TEST_CASE(CreateWalletFromFile, TestChain100Setup) BOOST_CHECK_EQUAL(addtx_count, 4); { LOCK(wallet->cs_wallet); - BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_tx.GetHash()), 1); - BOOST_CHECK_EQUAL(wallet->mapWallet.count(mempool_tx.GetHash()), 1); + BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_tx.GetHash()), 1U); + BOOST_CHECK_EQUAL(wallet->mapWallet.count(mempool_tx.GetHash()), 1U); } TestUnloadWallet(std::move(wallet)); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ec79a82bd2d0..05090e954ed1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3569,7 +3569,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CTransac nBytes += GetSizeOfCompactSize(nExtraPayloadSize) + nExtraPayloadSize; } - if (nBytes > MAX_STANDARD_TX_SIZE) { + if (static_cast(nBytes) > MAX_STANDARD_TX_SIZE) { // Do not create oversized transactions (bad-txns-oversize). error = _("Transaction too large"); return false; diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py index 40df17e4e718..600fddb5640e 100644 --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -115,6 +115,8 @@ def _request(self, method, path, postdata): except OSError as e: retry = ( '[WinError 10053] An established connection was aborted by the software in your host machine' in str(e)) + # Workaround for a bug on macOS. See https://bugs.python.org/issue33450 + retry = retry or ('[Errno 41] Protocol wrong type for socket' in str(e)) if retry: self.__conn.close() self.__conn.request(method, path, postdata, headers) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 26cd793106c9..a0b26108d8ca 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -179,6 +179,7 @@ def main(self): sys.exit(exit_code) def parse_args(self): + previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases" parser = argparse.ArgumentParser(usage="%(prog)s [options]") parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true", help="Leave dashds and test.* datadir on exit or error") @@ -193,6 +194,9 @@ def parse_args(self): help="Print out all RPC calls as they are made") parser.add_argument("--portseed", dest="port_seed", default=os.getpid(), type=int, help="The seed to use for assigning port numbers (default: current process id)") + parser.add_argument("--previous-releases", dest="prev_releases", action="store_true", + default=os.path.isdir(previous_releases_path) and bool(os.listdir(previous_releases_path)), + help="Force test of previous releases (default: %(default)s)") parser.add_argument("--coveragedir", dest="coveragedir", help="Write tested RPC commands into this directory") parser.add_argument("--configfile", dest="configfile", @@ -216,6 +220,7 @@ def parse_args(self): self.add_options(parser) self.options = parser.parse_args() + self.options.previous_releases_path = previous_releases_path config = configparser.ConfigParser() config.read_file(open(self.options.configfile)) @@ -243,20 +248,18 @@ def setup(self): fname_bitcoind = os.path.join( config["environment"]["BUILDDIR"], "src", - "dashd" + config["environment"]["EXEEXT"] + "dashd" + config["environment"]["EXEEXT"], ) fname_bitcoincli = os.path.join( config["environment"]["BUILDDIR"], "src", - "dash-cli" + config["environment"]["EXEEXT"] + "dash-cli" + config["environment"]["EXEEXT"], ) self.options.bitcoind = os.getenv("BITCOIND", default=fname_bitcoind) self.options.bitcoincli = os.getenv("BITCOINCLI", default=fname_bitcoincli) self.extra_args_from_options = self.options.dashd_extra_args - self.options.previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases" - os.environ['PATH'] = os.pathsep.join([ os.path.join(config['environment']['BUILDDIR'], 'src'), os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH'] @@ -959,17 +962,11 @@ def skip_if_no_previous_releases(self): def has_previous_releases(self): """Checks whether previous releases are present and enabled.""" - if os.getenv("TEST_PREVIOUS_RELEASES") == "false": - # disabled - return False - if not os.path.isdir(self.options.previous_releases_path): - if os.getenv("TEST_PREVIOUS_RELEASES") == "true": - raise AssertionError("TEST_PREVIOUS_RELEASES=true but releases missing: {}".format( + if self.options.prev_releases: + raise AssertionError("Force test of previous releases but releases missing: {}".format( self.options.previous_releases_path)) - # missing - return False - return True + return self.options.prev_releases def is_cli_compiled(self): """Checks whether dash-cli was compiled.""" diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 9165e008bae4..73623c9d5051 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -435,12 +435,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab args = args or [] # Warn if dashd is already running - # pidof might fail or return an empty string if bitcoind is not running try: - pidof_output = subprocess.check_output(["pidof", "dashd"]) - if not (pidof_output is None or pidof_output == b''): + # pgrep exits with code zero when one or more matching processes found + if subprocess.run(["pgrep", "-x", "dashd"], stdout=subprocess.DEVNULL).returncode == 0: print("%sWARNING!%s There is already a dashd process running on this system. Tests may fail unexpectedly due to resource contention!" % (BOLD[1], BOLD[0])) - except (OSError, subprocess.SubprocessError): + except OSError: + # pgrep not supported pass # Warn if there is a cache directory