BOOST_TEST_RUN_FILTERS="$(IFS=":";echo"!${NON_DETERMINISTIC_TESTS[*]}"| sed 's/:/:!/g')"
else
echo"Using Boost test filter: ${BOOST_TEST_RUN_FILTERS}"
echo
fi
if ! command -v gcov > /dev/null;then
echo"Error: gcov not installed. Exiting."
exit1
fi
if ! command -v gcovr > /dev/null;then
echo"Error: gcovr not installed. Exiting."
exit1
fi
if[[ ! -e ${TEST_BITCOIN_BINARY}]];then
echo"Error: Executable ${TEST_BITCOIN_BINARY} not found. Run \"./configure --enable-lcov\" and compile."
exit1
fi
get_file_suffix_count(){
find src/ -type f -name "*.$1"| wc -l
}
if[[$(get_file_suffix_count gcno)==0]];then
echo"Error: Could not find any *.gcno files. The *.gcno files are generated by the compiler. Run \"./configure --enable-lcov\" and re-compile."
exit1
fi
get_covr_filename(){
echo"gcovr.run-$1.txt"
}
TEST_RUN_ID=0
while[[${TEST_RUN_ID} -lt ${N_TEST_RUNS}]];do
TEST_RUN_ID=$((TEST_RUN_ID +1))
echo"[$(date +"%Y-%m-%d %H:%M:%S")] Measuring coverage, run #${TEST_RUN_ID} of ${N_TEST_RUNS}"
find src/ -type f -name "*.gcda" -exec rm {}\;
if[[$(get_file_suffix_count gcda) !=0]];then
echo"Error: Stale *.gcda files found. Exiting."
exit1
fi
TEST_OUTPUT_TEMPFILE=$(mktemp)
if ! BOOST_TEST_RUN_FILTERS="${BOOST_TEST_RUN_FILTERS}"${TEST_BITCOIN_BINARY} > "${TEST_OUTPUT_TEMPFILE}" 2>&1;then
cat "${TEST_OUTPUT_TEMPFILE}"
rm "${TEST_OUTPUT_TEMPFILE}"
exit1
fi
rm "${TEST_OUTPUT_TEMPFILE}"
if[[$(get_file_suffix_count gcda)==0]];then
echo"Error: Running the test suite did not create any *.gcda files. The gcda files are generated when the instrumented test programs are executed. Run \"./configure --enable-lcov\" and re-compile."
exit1
fi
GCOVR_TEMPFILE=$(mktemp)
if ! gcovr --gcov-executable "${GCOV_EXECUTABLE}" -r src/ > "${GCOVR_TEMPFILE}";then
echo"Error: gcovr failed. Output written to ${GCOVR_TEMPFILE}. Exiting."