Skip to content

Commit faf1c3c

Browse files
author
MarcoFalke
committed
test: Replace TEST_PREVIOUS_RELEASES env var with test_framework option
1 parent 25ad2c6 commit faf1c3c

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

ci/test/00_setup_env.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ 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}
3736
export TEST_RUNNER_ENV=${TEST_RUNNER_ENV:-}
3837
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
3938
export CONTAINER_NAME=${CONTAINER_NAME:-ci_unnamed}

ci/test/00_setup_env_native_qt5.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ export LC_ALL=C.UTF-8
99
export CONTAINER_NAME=ci_native_qt5
1010
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
1111
export DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
12-
export TEST_RUNNER_EXTRA="--coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
12+
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
1313
export RUN_UNIT_TESTS_SEQUENTIAL="true"
1414
export RUN_UNIT_TESTS="false"
1515
export GOAL="install"
16-
export TEST_PREVIOUS_RELEASES=true
1716
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.1 v0.18.1 v0.19.1"
1817
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-c++17 --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\""

ci/test/04_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=
2626
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
2727
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
2828
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
29-
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|TEST_PREVIOUS_RELEASES|PREVIOUS_RELEASES_DIR)' | tee /tmp/env
29+
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|PREVIOUS_RELEASES_DIR)' | tee /tmp/env
3030
if [[ $HOST = *-mingw32 ]]; then
3131
DOCKER_ADMIN="--cap-add SYS_ADMIN"
3232
elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)

test/functional/test_framework/test_framework.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def main(self):
140140
sys.exit(exit_code)
141141

142142
def parse_args(self):
143+
previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
143144
parser = argparse.ArgumentParser(usage="%(prog)s [options]")
144145
parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true",
145146
help="Leave bitcoinds and test.* datadir on exit or error")
@@ -154,6 +155,9 @@ def parse_args(self):
154155
help="Print out all RPC calls as they are made")
155156
parser.add_argument("--portseed", dest="port_seed", default=os.getpid(), type=int,
156157
help="The seed to use for assigning port numbers (default: current process id)")
158+
parser.add_argument("--previous-releases", dest="prev_releases", action="store_true",
159+
default=os.path.isdir(previous_releases_path),
160+
help="Force test of previous releases (default: %(default)s)")
157161
parser.add_argument("--coveragedir", dest="coveragedir",
158162
help="Write tested RPC commands into this directory")
159163
parser.add_argument("--configfile", dest="configfile",
@@ -174,6 +178,7 @@ def parse_args(self):
174178
parser.add_argument('--timeout-factor', dest="timeout_factor", type=float, default=1.0, help='adjust test timeouts by a factor. Setting it to 0 disables all timeouts')
175179
self.add_options(parser)
176180
self.options = parser.parse_args()
181+
self.options.previous_releases_path = previous_releases_path
177182

178183
def setup(self):
179184
"""Call this method to start up the test framework object with options set."""
@@ -190,18 +195,16 @@ def setup(self):
190195
fname_bitcoind = os.path.join(
191196
config["environment"]["BUILDDIR"],
192197
"src",
193-
"bitcoind" + config["environment"]["EXEEXT"]
198+
"bitcoind" + config["environment"]["EXEEXT"],
194199
)
195200
fname_bitcoincli = os.path.join(
196201
config["environment"]["BUILDDIR"],
197202
"src",
198-
"bitcoin-cli" + config["environment"]["EXEEXT"]
203+
"bitcoin-cli" + config["environment"]["EXEEXT"],
199204
)
200205
self.options.bitcoind = os.getenv("BITCOIND", default=fname_bitcoind)
201206
self.options.bitcoincli = os.getenv("BITCOINCLI", default=fname_bitcoincli)
202207

203-
self.options.previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
204-
205208
os.environ['PATH'] = os.pathsep.join([
206209
os.path.join(config['environment']['BUILDDIR'], 'src'),
207210
os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH']
@@ -684,17 +687,11 @@ def skip_if_no_previous_releases(self):
684687

685688
def has_previous_releases(self):
686689
"""Checks whether previous releases are present and enabled."""
687-
if os.getenv("TEST_PREVIOUS_RELEASES") == "false":
688-
# disabled
689-
return False
690-
691690
if not os.path.isdir(self.options.previous_releases_path):
692-
if os.getenv("TEST_PREVIOUS_RELEASES") == "true":
693-
raise AssertionError("TEST_PREVIOUS_RELEASES=true but releases missing: {}".format(
691+
if self.options.prev_releases:
692+
raise AssertionError("Force test of previous releases but releases missing: {}".format(
694693
self.options.previous_releases_path))
695-
# missing
696-
return False
697-
return True
694+
return self.options.prev_releases
698695

699696
def is_cli_compiled(self):
700697
"""Checks whether bitcoin-cli was compiled."""

0 commit comments

Comments
 (0)