Skip to content

Commit fa0081b

Browse files
author
MarcoFalke
committed
ci: Place datadirs for tests under tmpfs
Also, includes a fixup to the fuzz/test_runner.py to pass on the env var.
1 parent 15c1f47 commit fa0081b

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

ci/test/00_setup_env.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright (c) 2019-2022 The Bitcoin Core developers
3+
# Copyright (c) 2019-present The Bitcoin Core developers
44
# Distributed under the MIT software license, see the accompanying
55
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
66

@@ -19,10 +19,15 @@ export BASE_ROOT_DIR="${BASE_ROOT_DIR:-/ci_container_base}"
1919
# The depends dir.
2020
# This folder exists only on the ci guest, and on the ci host as a volume.
2121
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
22-
# A folder for the ci system to put temporary files (build result, datadirs for tests, ...)
22+
# A folder for the ci system to put temporary files (build result, qa-assets, ...)
2323
# This folder only exists on the ci guest.
2424
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
25-
# A folder for the ci system to put executables.
25+
# A folder for the ci system to put temporary test files (datadirs for tests, ...)
26+
# The folder is mounted as tmpfs with a size of MIN_NO_CLEANUP_SPACE, however,
27+
# with default ci settings the real usage should be lower and closer to 3GB.
28+
# This folder only exists on the ci guest.
29+
export BASE_TEST_TEMP_DIR="${BASE_ROOT_DIR}/ci_test_temp"
30+
# A folder for the ci system to put executables (busybox, ...).
2631
# This folder only exists on the ci guest.
2732
export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/"
2833

ci/test/02_run_container.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
9797
--mount "${CI_DEPENDS_MOUNT}" \
9898
--mount "${CI_DEPENDS_SOURCES_MOUNT}" \
9999
--mount "${CI_PREVIOUS_RELEASES_MOUNT}" \
100+
--mount "type=tmpfs,destination=${BASE_TEST_TEMP_DIR},tmpfs-size=12G" \
100101
--env-file /tmp/env-$USER-$CONTAINER_NAME \
101102
--name "$CONTAINER_NAME" \
102103
--network ci-ip6net \
@@ -108,6 +109,7 @@ else
108109
echo "Create missing folders"
109110
mkdir -p "${CCACHE_DIR}"
110111
mkdir -p "${PREVIOUS_RELEASES_DIR}"
112+
mkdir -p "${BASE_TEST_TEMP_DIR}"
111113
fi
112114

113115
if [ "$CI_OS_NAME" == "macos" ]; then

ci/test/03_test_script.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ if [ "$RUN_CHECK_DEPS" = "true" ]; then
145145
fi
146146

147147
if [ "$RUN_UNIT_TESTS" = "true" ]; then
148-
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
148+
TMPDIR="${BASE_TEST_TEMP_DIR}" DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
149149
fi
150150

151151
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
152-
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_OUTDIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite
152+
TMPDIR="${BASE_TEST_TEMP_DIR}" DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_OUTDIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite
153153
fi
154154

155155
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
156156
# parses TEST_RUNNER_EXTRA as an array which allows for multiple arguments such as TEST_RUNNER_EXTRA='--exclude "rpc_bind.py --ipv6"'
157157
eval "TEST_RUNNER_EXTRA=($TEST_RUNNER_EXTRA)"
158-
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/functional/test_runner.py --ci "${MAKEJOBS}" --tmpdirprefix "${BASE_SCRATCH_DIR}"/test_runner/ --ansi --combinedlogslen=99999999 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" "${TEST_RUNNER_EXTRA[@]}" --quiet --failfast
158+
TMPDIR="${BASE_TEST_TEMP_DIR}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/functional/test_runner.py --ci "${MAKEJOBS}" --ansi --combinedlogslen=99999999 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" "${TEST_RUNNER_EXTRA[@]}" --quiet --failfast
159159
fi
160160

161161
if [ "${RUN_TIDY}" = "true" ]; then
@@ -187,5 +187,5 @@ fi
187187

188188
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
189189
# shellcheck disable=SC2086
190-
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} "${MAKEJOBS}" -l DEBUG "${DIR_FUZZ_IN}" --empty_min_time=60
190+
TMPDIR="${BASE_TEST_TEMP_DIR}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} "${MAKEJOBS}" -l DEBUG "${DIR_FUZZ_IN}" --empty_min_time=60
191191
fi

test/fuzz/test_runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def get_fuzz_env(*, target, source_dir):
3131
if platform.system() == "Windows":
3232
# On Windows, `env` option must include valid `SystemRoot`.
3333
fuzz_env = {**fuzz_env, 'SystemRoot': os.environ.get('SystemRoot')}
34+
if (tmpdir := os.environ.get("TMPDIR")) is not None:
35+
fuzz_env = {**fuzz_env, "TMPDIR": tmpdir} # Required to modify the test datadir location
3436
return fuzz_env
3537

3638

0 commit comments

Comments
 (0)