Skip to content

Commit

Permalink
ci: run test_bitcoin with DEBUG_LOG_OUT in RUN_UNIT_TESTS_SEQUENTIAL
Browse files Browse the repository at this point in the history
Resolves bitcoin#28466
  • Loading branch information
vasild committed Oct 26, 2023
1 parent 2a349f9 commit 895e646
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion ci/test/06_script_b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,28 @@ if [ "$RUN_UNIT_TESTS" = "true" ]; then
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"
# The output of test_bitcoin with DEBUG_LOG_OUT is about 80MB. Thus redirect
# it to a file and only if errors occur, then extract the relevant snippets
# from it - between "Entering test case" and "Leaving test case".
LOG="${BASE_BUILD_DIR}/test_bitcoin.log"
bash -c "
${TEST_RUNNER_ENV}
DIR_UNIT_TEST_DATA=${DIR_UNIT_TEST_DATA}
LD_LIBRARY_PATH=${DEPENDS_DIR}/${HOST}/lib
if ! ${BASE_OUTDIR}/bin/test_bitcoin --catch_system_errors=no -l test_suite -- DEBUG_LOG_OUT > ${LOG} 2>&1 ; then
# find all lines that match 'error: in test_suite/test_case' and extract the test suite and case
for t in \$(sed -E -n 's/.*error: in \"(.+\\/.+)\":.*/\\1/p' < ${LOG}) ; do
# t is now something like net_tests/v2transport_test
test_suite=\${t%/*} # e.g. net_tests
test_case=\${t#*/} # e.g. v2transport_test
ed -s ${LOG} <<EDCOMMANDS
/Entering test suite \"\${test_suite}\"/
/Entering test case \"\${test_case}\"/,/Leaving test case \"\${test_case}\"/p
q
EDCOMMANDS
done
fi
"
fi

if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
Expand Down

0 comments on commit 895e646

Please sign in to comment.