Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#28954: ci: Reduce use of bash -c
Browse files Browse the repository at this point in the history
fad82fe ci: Reduce use of bash -c (MarcoFalke)
fafcee4 ci: Rename test script to 03_test_script.sh (MarcoFalke)

Pull request description:

  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.

ACKs for top commit:
  RandyMcMillan:
    utACK fad82fe
  vasild:
    ACK fad82fe

Tree-SHA512: fb79469d809400739e53da203842fda838f2ec9ab8dcd5e622ccd3db651d629161323bfcc04301562f13f5c407e8865036478a4ac7f6b5265dc4dda1a320c23d
  • Loading branch information
fanquake committed Nov 30, 2023
2 parents c4d47d2 + fad82fe commit d80318d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion ci/test/00_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_i686_multiprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ci/test/02_run_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CI_EXEC git config --global --add safe.directory \"*\"

CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"

CI_EXEC "${BASE_ROOT_DIR}/ci/test/06_script_b.sh"
CI_EXEC "${BASE_ROOT_DIR}/ci/test/03_test_script.sh"

if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
echo "Stop and remove CI container by ID"
Expand Down
10 changes: 6 additions & 4 deletions ci/test/06_script_b.sh → ci/test/03_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit d80318d

Please sign in to comment.