aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-11-28 13:51:18 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-11-29 15:13:16 +0100
commitfad82fea2bef88c9f11e25ca43c7886a2b9b5da2 (patch)
treefcc56d56a76d82aff737f22504b2341273e19ec7
parentfafcee48748d4a4ff229ae94d2bc3a73c5c1db22 (diff)
downloadbitcoin-fad82fea2bef88c9f11e25ca43c7886a2b9b5da2.tar.xz
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
-rwxr-xr-xci/test/00_setup_env.sh1
-rwxr-xr-xci/test/00_setup_env_i686_multiprocess.sh2
-rwxr-xr-xci/test/03_test_script.sh10
3 files changed, 7 insertions, 6 deletions
diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh
index 8b2adbb096..6ba3deb121 100755
--- a/ci/test/00_setup_env.sh
+++ b/ci/test/00_setup_env.sh
@@ -46,7 +46,6 @@ export RUN_TIDY=${RUN_TIDY:-false}
# This is needed because some ci machines have slow CPU or disk, so sanitizers
# might be slow or a reindex might be waiting on disk IO.
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40}
-export TEST_RUNNER_ENV=${TEST_RUNNER_ENV:-}
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
# Randomize test order.
diff --git a/ci/test/00_setup_env_i686_multiprocess.sh b/ci/test/00_setup_env_i686_multiprocess.sh
index 647f4103e2..7b46835b57 100755
--- a/ci/test/00_setup_env_i686_multiprocess.sh
+++ b/ci/test/00_setup_env_i686_multiprocess.sh
@@ -14,4 +14,4 @@ export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
export GOAL="install"
export BITCOIN_CONFIG="--enable-debug CC='clang -m32' CXX='clang++ -m32' \
LDFLAGS='--rtlib=compiler-rt -lgcc_s' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'"
-export TEST_RUNNER_ENV="BITCOIND=bitcoin-node"
+export BITCOIND=bitcoin-node # Used in functional tests
diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
index 20464c3aea..cdcd731528 100755
--- a/ci/test/03_test_script.sh
+++ b/ci/test/03_test_script.sh
@@ -163,15 +163,16 @@ if [ -n "$USE_VALGRIND" ]; then
fi
if [ "$RUN_UNIT_TESTS" = "true" ]; then
- 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"
+ DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" make "${MAKEJOBS}" check VERBOSE=1
fi
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
- 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"
+ 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
fi
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
- 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"
+ # shellcheck disable=SC2086
+ 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
fi
if [ "${RUN_TIDY}" = "true" ]; then
@@ -200,5 +201,6 @@ if [ "${RUN_TIDY}" = "true" ]; then
fi
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
- 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"
+ # shellcheck disable=SC2086
+ 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
fi