Skip to content

Commit caa2f3a

Browse files
author
MarcoFalke
committed
Merge #12134: Build previous releases and run functional tests
c456145 [test] add 0.19 backwards compatibility tests (Sjors Provoost) b769cd1 [test] add v0.17.1 wallet upgrade test (Sjors Provoost) 9d9390d [tests] add wallet backwards compatility tests (Sjors Provoost) c7ca630 [scripts] support release candidates of earlier releases (Sjors Provoost) 8b1460d [tests] check v0.17.1 and v0.18.1 backwards compatibility (Sjors Provoost) ae379cf [scripts] build earlier releases (Sjors Provoost) Pull request description: This PR adds binaries for 0.17, 0.18 and 0.19 to Travis and runs a basic block propagation test. Includes test for upgrading v0.17.1 wallets and opening master wallets with older versions. Usage: ```sh contrib/devtools/previous_release.sh -f -b v0.19.0.1 v0.18.1 v0.17.1 test/functional/backwards_compatibility.py ``` Travis caches these earlier releases, so it should be able to run these tests with little performance impact. Additional scenarios where it might be useful to run tests against earlier releases: * creating a wallet with #11403's segwit implementation, copying it to an older node and making sure the user didn't lose any funds (although this PR doesn't support `v0.15.1`) * future consensus changes * P2P changes (e.g. to make sure we don't accidentally ban old nodes) ACKs for top commit: MarcoFalke: ACK c456145 🔨 Tree-SHA512: 360bd870603f95b14dc0cd629532cc147344f632b808617c18e1b585dfb1f082b401e5d493a48196b719e0aeaee533ae0a773dfc9f217f704aae898576c19232
2 parents 73a396e + c456145 commit caa2f3a

File tree

12 files changed

+521
-8
lines changed

12 files changed

+521
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ qrc_*.cpp
108108
.DS_Store
109109
build
110110

111+
# Previous releases
112+
releases
113+
111114
#lcov
112115
*.gcno
113116
*.gcda

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ cache:
3535
- $TRAVIS_BUILD_DIR/depends/built
3636
- $TRAVIS_BUILD_DIR/depends/sdk-sources
3737
- $TRAVIS_BUILD_DIR/ci/scratch/.ccache
38+
- $TRAVIS_BUILD_DIR/releases/$HOST
3839
# macOS
3940
- $HOME/Library/Caches/Homebrew
4041
- /usr/local/Homebrew
@@ -108,7 +109,7 @@ jobs:
108109
FILE_ENV="./ci/test/00_setup_env_i686_centos.sh"
109110
110111
- stage: test
111-
name: 'x86_64 Linux [GOAL: install] [bionic] [uses qt5 dev package and some depends packages] [unsigned char]'
112+
name: 'x86_64 Linux [GOAL: install] [bionic] [previous releases, uses qt5 dev package and some depends packages] [unsigned char]'
112113
env: >-
113114
FILE_ENV="./ci/test/00_setup_env_native_qt5.sh"
114115

ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If the repository is not a fresh git clone, you might have to clean files from p
1313

1414
The ci needs to perform various sysadmin tasks such as installing packages or writing to the user's home directory.
1515
While most of the actions are done inside a docker container, this is not possible for all. Thus, cache directories,
16-
such as the depends cache or ccache, are mounted as read-write into the docker container. While it should be fine to run
16+
such as the depends cache, previous release binaries, or ccache, are mounted as read-write into the docker container. While it should be fine to run
1717
the ci system locally on you development box, the ci scripts can generally be assumed to have received less review and
1818
testing compared to other parts of the codebase. If you want to keep the work tree clean, you might want to run the ci
1919
system in a virtual machine with a Linux operating system of your choice.

ci/test/00_setup_env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")}
3333
export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
3434
export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
3535
export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
36+
export TEST_PREVIOUS_RELEASES=${TEST_PREVIOUS_RELEASES:-false}
3637
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
3738
export CONTAINER_NAME=${CONTAINER_NAME:-ci_unnamed}
3839
export DOCKER_NAME_TAG=${DOCKER_NAME_TAG:-ubuntu:18.04}
@@ -50,6 +51,7 @@ export CCACHE_DIR=${CCACHE_DIR:-$BASE_SCRATCH_DIR/.ccache}
5051
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
5152
# Folder where the build is done (bin and lib).
5253
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out/$HOST}
54+
export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/releases/$HOST}
5355
export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
5456
export WINEDEBUG=${WINEDEBUG:-fixme-all}
5557
export DOCKER_PACKAGES=${DOCKER_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git procps}

ci/test/00_setup_env_native_qt5.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libhar
1111
export DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
1212
export TEST_RUNNER_EXTRA="--coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
1313
export GOAL="install"
14+
export TEST_PREVIOUS_RELEASES=true
1415
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\""

ci/test/04_install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ fi
4040

4141
mkdir -p "${BASE_SCRATCH_DIR}"
4242
mkdir -p "${CCACHE_DIR}"
43+
mkdir -p "${PREVIOUS_RELEASES_DIR}"
4344

4445
export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
4546
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
4647
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
4748
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
48-
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
49+
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|TEST_PREVIOUS_RELEASES|PREVIOUS_RELEASES_DIR)' | tee /tmp/env
4950
if [[ $HOST = *-mingw32 ]]; then
5051
DOCKER_ADMIN="--cap-add SYS_ADMIN"
5152
elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)
@@ -62,6 +63,7 @@ if [ -z "$RUN_CI_ON_HOST" ]; then
6263
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
6364
--mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR \
6465
--mount type=bind,src=$DEPENDS_DIR,dst=$DEPENDS_DIR \
66+
--mount type=bind,src=$PREVIOUS_RELEASES_DIR,dst=$PREVIOUS_RELEASES_DIR \
6567
-w $BASE_ROOT_DIR \
6668
--env-file /tmp/env \
6769
--name $CONTAINER_NAME \

ci/test/05_before_script.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ if [ -z "$NO_DEPENDS" ]; then
3535
fi
3636
DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
3737
fi
38+
if [ "$TEST_PREVIOUS_RELEASES" = "true" ]; then
39+
BEGIN_FOLD previous-versions
40+
DOCKER_EXEC contrib/devtools/previous_release.sh -b -t "$PREVIOUS_RELEASES_DIR" v0.17.1 v0.18.1 v0.19.0.1
41+
END_FOLD
42+
fi

contrib/devtools/previous_release.sh

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2018-2019 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
#
7+
# Build previous releases.
8+
9+
export LC_ALL=C
10+
11+
CONFIG_FLAGS=""
12+
FUNCTIONAL_TESTS=0
13+
DELETE_EXISTING=0
14+
USE_DEPENDS=0
15+
DOWNLOAD_BINARY=0
16+
CONFIG_FLAGS=""
17+
TARGET="releases"
18+
19+
while getopts ":hfrdbt:" opt; do
20+
case $opt in
21+
h)
22+
echo "Usage: .previous_release.sh [options] tag1 tag2"
23+
echo " options:"
24+
echo " -h Print this message"
25+
echo " -f Configure for functional tests"
26+
echo " -r Remove existing directory"
27+
echo " -d Use depends"
28+
echo " -b Download release binary"
29+
echo " -t Target directory (default: releases)"
30+
exit 0
31+
;;
32+
f)
33+
FUNCTIONAL_TESTS=1
34+
CONFIG_FLAGS="$CONFIG_FLAGS --without-gui --disable-tests --disable-bench"
35+
;;
36+
r)
37+
DELETE_EXISTING=1
38+
;;
39+
d)
40+
USE_DEPENDS=1
41+
;;
42+
b)
43+
DOWNLOAD_BINARY=1
44+
;;
45+
t)
46+
TARGET=$OPTARG
47+
;;
48+
\?)
49+
echo "Invalid option: -$OPTARG" >&2
50+
exit 1
51+
;;
52+
esac
53+
done
54+
55+
shift $((OPTIND-1))
56+
57+
if [ -z "$1" ]; then
58+
echo "Specify release tag(s), e.g.: .previous_release v0.15.1"
59+
exit 1
60+
fi
61+
62+
if [ ! -d "$TARGET" ]; then
63+
mkdir -p $TARGET
64+
fi
65+
66+
if [ "$DOWNLOAD_BINARY" -eq "1" ]; then
67+
HOST="${HOST:-$(./depends/config.guess)}"
68+
case "$HOST" in
69+
x86_64-*-linux*)
70+
PLATFORM=x86_64-linux-gnu
71+
;;
72+
x86_64-apple-darwin*)
73+
PLATFORM=osx64
74+
;;
75+
*)
76+
echo "Not sure which binary to download for $HOST."
77+
exit 1
78+
;;
79+
esac
80+
fi
81+
82+
echo "Releases directory: $TARGET"
83+
pushd "$TARGET" || exit 1
84+
{
85+
for tag in "$@"
86+
do
87+
if [ "$DELETE_EXISTING" -eq "1" ]; then
88+
if [ -d "$tag" ]; then
89+
rm -r "$tag"
90+
fi
91+
fi
92+
93+
if [ "$DOWNLOAD_BINARY" -eq "0" ]; then
94+
95+
if [ ! -d "$tag" ]; then
96+
if [ -z $(git tag -l "$tag") ]; then
97+
echo "Tag $tag not found"
98+
exit 1
99+
fi
100+
101+
git clone https://github.com/bitcoin/bitcoin "$tag"
102+
pushd "$tag" || exit 1
103+
{
104+
git checkout "$tag"
105+
if [ "$USE_DEPENDS" -eq "1" ]; then
106+
pushd depends || exit 1
107+
{
108+
if [ "$FUNCTIONAL_TESTS" -eq "1" ]; then
109+
make NO_QT=1
110+
else
111+
make
112+
fi
113+
HOST="${HOST:-$(./config.guess)}"
114+
}
115+
popd || exit 1
116+
CONFIG_FLAGS="--prefix=$PWD/depends/$HOST $CONFIG_FLAGS"
117+
fi
118+
./autogen.sh
119+
./configure $CONFIG_FLAGS
120+
make
121+
# Move binaries, so they're in the same place as in the release download:
122+
mkdir bin
123+
mv src/bitcoind src/bitcoin-cli src/bitcoin-tx bin
124+
if [ "$FUNCTIONAL_TESTS" -eq "0" ]; then
125+
mv src/qt/bitcoin-qt bin
126+
fi
127+
}
128+
popd || exit 1
129+
fi
130+
else
131+
if [ -d "$tag" ]; then
132+
echo "Using cached $tag"
133+
else
134+
mkdir "$tag"
135+
if [[ "$tag" =~ v(.*)(rc[0-9]+)$ ]]; then
136+
BIN_PATH="bin/bitcoin-core-${BASH_REMATCH[1]}/test.${BASH_REMATCH[2]}"
137+
else
138+
BIN_PATH="bin/bitcoin-core-${tag:1}"
139+
fi
140+
URL="https://bitcoin.org/$BIN_PATH/bitcoin-${tag:1}-$PLATFORM.tar.gz"
141+
echo "Fetching: $URL"
142+
curl -O $URL
143+
tar -zxf "bitcoin-${tag:1}-$PLATFORM.tar.gz" -C "$tag" --strip-components=1 "bitcoin-${tag:1}"
144+
rm "bitcoin-${tag:1}-$PLATFORM.tar.gz"
145+
fi
146+
fi
147+
done
148+
}
149+
popd || exit 1

0 commit comments

Comments
 (0)