Skip to content

Commit fad82fe

Browse files
author
MarcoFalke
committed
ci: Reduce use of bash -c
It is confusing to treat commands as a single string. This change is also required to support paths and strings with spaces in them in the future. This requires replacing TEST_RUNNER_ENV with a global export, because it no longer works. See: ```bash $ export ENV="A=1" && $ENV ls bash: A=1: command not found... ``` Or in the CI task: + DIR_UNIT_TEST_DATA=/ci_container_base/ci/scratch/qa-assets/unit_test_data/ + LD_LIBRARY_PATH=/ci_container_base/depends/i686-pc-linux-gnu/lib + BITCOIND=bitcoin-node make -j10 check VERBOSE=1 /ci_container_base/ci/test/03_test_script.sh: line 166: BITCOIND=bitcoin-node: command not found https://github.com/bitcoin/bitcoin/pull/28954/checks?check_run_id=19096858944 https://cirrus-ci.com/task/6718317604372480
1 parent fafcee4 commit fad82fe

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

ci/test/00_setup_env.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export RUN_TIDY=${RUN_TIDY:-false}
4646
# This is needed because some ci machines have slow CPU or disk, so sanitizers
4747
# might be slow or a reindex might be waiting on disk IO.
4848
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40}
49-
export TEST_RUNNER_ENV=${TEST_RUNNER_ENV:-}
5049
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
5150

5251
# Randomize test order.

ci/test/00_setup_env_i686_multiprocess.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
1414
export GOAL="install"
1515
export BITCOIN_CONFIG="--enable-debug CC='clang -m32' CXX='clang++ -m32' \
1616
LDFLAGS='--rtlib=compiler-rt -lgcc_s' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'"
17-
export TEST_RUNNER_ENV="BITCOIND=bitcoin-node"
17+
export BITCOIND=bitcoin-node # Used in functional tests

ci/test/03_test_script.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,16 @@ if [ -n "$USE_VALGRIND" ]; then
163163
fi
164164

165165
if [ "$RUN_UNIT_TESTS" = "true" ]; then
166-
bash -c "${TEST_RUNNER_ENV} DIR_UNIT_TEST_DATA=${DIR_UNIT_TEST_DATA} LD_LIBRARY_PATH=${DEPENDS_DIR}/${HOST}/lib make $MAKEJOBS check VERBOSE=1"
166+
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" make "${MAKEJOBS}" check VERBOSE=1
167167
fi
168168

169169
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
170-
bash -c "${TEST_RUNNER_ENV} 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"
170+
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
171171
fi
172172

173173
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
174-
bash -c "LD_LIBRARY_PATH=${DEPENDS_DIR}/${HOST}/lib ${TEST_RUNNER_ENV} 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"
174+
# shellcheck disable=SC2086
175+
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
175176
fi
176177

177178
if [ "${RUN_TIDY}" = "true" ]; then
@@ -200,5 +201,6 @@ if [ "${RUN_TIDY}" = "true" ]; then
200201
fi
201202

202203
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
203-
bash -c "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"
204+
# shellcheck disable=SC2086
205+
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
204206
fi

0 commit comments

Comments
 (0)