diff options
-rwxr-xr-x | ci/test/00_setup_env.sh | 2 | ||||
-rw-r--r-- | ci/test/00_setup_env_arm.sh | 3 | ||||
-rwxr-xr-x | ci/test/04_install.sh | 17 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | contrib/init/bitcoind.conf | 2 | ||||
-rw-r--r-- | contrib/init/bitcoind.init | 2 | ||||
-rw-r--r-- | contrib/init/bitcoind.openrcconf | 2 | ||||
-rw-r--r-- | contrib/init/bitcoind.service | 1 | ||||
-rwxr-xr-x | contrib/linearize/linearize-data.py | 7 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/sync.h | 4 | ||||
-rw-r--r-- | src/test/fuzz/deserialize.cpp | 2 | ||||
-rw-r--r-- | src/test/fuzz/fuzz.cpp | 3 | ||||
-rw-r--r-- | src/test/fuzz/fuzz.h | 2 | ||||
-rw-r--r-- | src/test/fuzz/script_flags.cpp | 2 | ||||
-rw-r--r-- | src/txdb.cpp | 2 | ||||
-rw-r--r-- | src/util/macros.h | 11 | ||||
-rw-r--r-- | test/functional/test_framework/util.py | 3 |
18 files changed, 52 insertions, 29 deletions
diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index 94598835ac..8bc50da2c3 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -22,6 +22,8 @@ export MAKEJOBS=${MAKEJOBS:--j4} # A folder for the ci system to put temporary files (ccache, datadirs for tests, ...) export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch/} export HOST=${HOST:-x86_64-unknown-linux-gnu} +# Whether to prefer BusyBox over GNU utilities +export USE_BUSY_BOX=${USE_BUSY_BOX:-false} export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true} export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true} export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false} diff --git a/ci/test/00_setup_env_arm.sh b/ci/test/00_setup_env_arm.sh index ac7ace8c3b..db640015b1 100644 --- a/ci/test/00_setup_env_arm.sh +++ b/ci/test/00_setup_env_arm.sh @@ -7,7 +7,8 @@ export LC_ALL=C.UTF-8 export HOST=arm-linux-gnueabihf -export PACKAGES="python3 g++-arm-linux-gnueabihf" +export PACKAGES="python3 g++-arm-linux-gnueabihf busybox" +export USE_BUSY_BOX=true export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="install" diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 4459d6f4ce..409e87ce04 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -33,18 +33,29 @@ if [ -z "$RUN_CI_ON_HOST" ]; then DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$BASE_BUILD_DIR,dst=$BASE_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $BASE_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) DOCKER_EXEC () { - docker exec $DOCKER_ID bash -c "cd $PWD && $*" + docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*" } else echo "Running on host system without docker wrapper" DOCKER_EXEC () { - bash -c "cd $PWD && $*" + bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*" } fi DOCKER_EXEC free -m -h -DOCKER_EXEC echo "Number of CPUs \(nproc\): $(nproc)" +DOCKER_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\) ${CI_RETRY_EXE} DOCKER_EXEC apt-get update ${CI_RETRY_EXE} DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $DOCKER_PACKAGES +if [ "$USE_BUSY_BOX" = "true" ]; then + echo "Setup to use BusyBox utils" + DOCKER_EXEC mkdir -p $BASE_SCRATCH_DIR/bins/ + # tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version) + # find excluded for now because it does not recognize the -delete option in ./depends (fixed in later BusyBox version) + # ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed) + # shellcheck disable=SC1010 + DOCKER_EXEC for util in \$\(busybox --list \| grep -v "^ar$" \| grep -v "^tar$" \| grep -v "^find$"\)\; do ln -s \$\(command -v busybox\) $BASE_SCRATCH_DIR/bins/\$util\; done + # Print BusyBox version + DOCKER_EXEC patch --help +fi diff --git a/configure.ac b/configure.ac index 8af9a986d2..d25e0f4496 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,10 @@ fi AC_PROG_OBJCXX ]) +dnl Since libtool 1.5.2 (released 2004-01-25), on Linux libtool no longer +dnl sets RPATH for any directories in the dynamic linker search path. +dnl See more: https://wiki.debian.org/RpathIssue +LT_PREREQ([1.5.2]) dnl Libtool init checks. LT_INIT([pic-only]) @@ -1660,17 +1664,6 @@ AC_CONFIG_SUBDIRS([src/secp256k1]) AC_OUTPUT -dnl Taken from https://wiki.debian.org/RpathIssue -case $host in - *-*-linux-gnu) - AC_MSG_RESULT([Fixing libtool for -rpath problems.]) - sed < libtool > libtool-2 \ - 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' - mv libtool-2 libtool - chmod 755 libtool - ;; -esac - dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows case ${OS} in *Windows*) diff --git a/contrib/init/bitcoind.conf b/contrib/init/bitcoind.conf index de4ea0ed52..dde1bd0c4d 100644 --- a/contrib/init/bitcoind.conf +++ b/contrib/init/bitcoind.conf @@ -16,7 +16,7 @@ expect fork respawn respawn limit 5 120 -kill timeout 60 +kill timeout 600 pre-start script # this will catch non-existent config files diff --git a/contrib/init/bitcoind.init b/contrib/init/bitcoind.init index 0c95baf3a1..19e1f76d09 100644 --- a/contrib/init/bitcoind.init +++ b/contrib/init/bitcoind.init @@ -39,7 +39,7 @@ start() { stop() { echo -n $"Stopping $prog: " - killproc $prog + killproc $prog -t600 RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile diff --git a/contrib/init/bitcoind.openrcconf b/contrib/init/bitcoind.openrcconf index f70e25cb5f..c8a22a08d9 100644 --- a/contrib/init/bitcoind.openrcconf +++ b/contrib/init/bitcoind.openrcconf @@ -30,4 +30,4 @@ # Note that this will be mapped as argument to start-stop-daemon's # '--retry' option, which means you can specify a retry schedule # here. For more information see man 8 start-stop-daemon. -BITCOIND_SIGTERM_TIMEOUT=60 +BITCOIND_SIGTERM_TIMEOUT=600 diff --git a/contrib/init/bitcoind.service b/contrib/init/bitcoind.service index 34c3e7b3ab..8b308644b1 100644 --- a/contrib/init/bitcoind.service +++ b/contrib/init/bitcoind.service @@ -29,6 +29,7 @@ ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin Type=forking PIDFile=/run/bitcoind/bitcoind.pid Restart=on-failure +TimeoutStopSec=600 # Directory creation and permissions #################################### diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index 95754ab937..863b22f6b1 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -213,8 +213,11 @@ class BlockDataCopier: inMagic = inhdr[:4] if (inMagic != self.settings['netmagic']): - print("Invalid magic: " + inMagic.hex()) - return + # Seek backwards 7 bytes (skipping the first byte in the previous search) + # and continue searching from the new position if the magic bytes are not + # found. + self.inF.seek(-7, os.SEEK_CUR) + continue inLenLE = inhdr[4:] su = struct.unpack("<I", inLenLE) inLen = su[0] - 80 # length without header diff --git a/src/Makefile.am b/src/Makefile.am index d25f7ebe87..84254e45d1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -209,6 +209,7 @@ BITCOIN_CORE_H = \ util/error.h \ util/fees.h \ util/system.h \ + util/macros.h \ util/memory.h \ util/moneystr.h \ util/rbf.h \ diff --git a/src/sync.h b/src/sync.h index bdbdde1a2a..8ff6173142 100644 --- a/src/sync.h +++ b/src/sync.h @@ -7,6 +7,7 @@ #define BITCOIN_SYNC_H #include <threadsafety.h> +#include <util/macros.h> #include <condition_variable> #include <thread> @@ -176,9 +177,6 @@ public: template<typename MutexArg> using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>; -#define PASTE(x, y) x ## y -#define PASTE2(x, y) PASTE(x, y) - #define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__) #define LOCK2(cs1, cs2) \ DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \ diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp index 9364ac4a32..3a74143dc2 100644 --- a/src/test/fuzz/deserialize.cpp +++ b/src/test/fuzz/deserialize.cpp @@ -23,7 +23,7 @@ #include <test/fuzz/fuzz.h> -void test_one_input(std::vector<uint8_t> buffer) +void test_one_input(const std::vector<uint8_t>& buffer) { CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); try { diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 0709da5563..cfa160dde2 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -30,7 +30,8 @@ static void initialize() // This function is used by libFuzzer extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - test_one_input(std::vector<uint8_t>(data, data + size)); + const std::vector<uint8_t> input(data, data + size); + test_one_input(input); return 0; } diff --git a/src/test/fuzz/fuzz.h b/src/test/fuzz/fuzz.h index 4e009d9b54..573bd572db 100644 --- a/src/test/fuzz/fuzz.h +++ b/src/test/fuzz/fuzz.h @@ -9,6 +9,6 @@ #include <vector> -void test_one_input(std::vector<uint8_t> buffer); +void test_one_input(const std::vector<uint8_t>& buffer); #endif // BITCOIN_TEST_FUZZ_FUZZ_H diff --git a/src/test/fuzz/script_flags.cpp b/src/test/fuzz/script_flags.cpp index 9b90d66755..0bf5cd5c72 100644 --- a/src/test/fuzz/script_flags.cpp +++ b/src/test/fuzz/script_flags.cpp @@ -11,7 +11,7 @@ /** Flags that are not forbidden by an assert */ static bool IsValidFlagCombination(unsigned flags); -void test_one_input(std::vector<uint8_t> buffer) +void test_one_input(const std::vector<uint8_t>& buffer) { CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); try { diff --git a/src/txdb.cpp b/src/txdb.cpp index 18be07e6db..536bfee901 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -145,7 +145,7 @@ size_t CCoinsViewDB::EstimateSize() const return db.EstimateSize(DB_COIN, (char)(DB_COIN+1)); } -CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(gArgs.IsArgSet("-blocksdir") ? GetDataDir() / "blocks" / "index" : GetBlocksDir() / "index", nCacheSize, fMemory, fWipe) { +CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) { } bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) { diff --git a/src/util/macros.h b/src/util/macros.h new file mode 100644 index 0000000000..36ea87c0fe --- /dev/null +++ b/src/util/macros.h @@ -0,0 +1,11 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_UTIL_MACROS_H +#define BITCOIN_UTIL_MACROS_H + +#define PASTE(x, y) x ## y +#define PASTE2(x, y) PASTE(x, y) + +#endif // BITCOIN_UTIL_MACROS_H diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 2bed8c3231..cde99a2219 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -244,7 +244,7 @@ class PortSeed: # Must be initialized with a unique integer for each process n = None -def get_rpc_proxy(url, node_number, timeout=None, coveragedir=None): +def get_rpc_proxy(url, node_number, *, timeout=None, coveragedir=None): """ Args: url (str): URL of the RPC server to call @@ -252,6 +252,7 @@ def get_rpc_proxy(url, node_number, timeout=None, coveragedir=None): Kwargs: timeout (int): HTTP timeout in seconds + coveragedir (str): Directory Returns: AuthServiceProxy. convenience object for making RPC calls. |