bashcov
bashcov copied to clipboard
Using PS4 in tested script breaks coverage results
Hi,
My current script starts like this:
declare -x PS4='+ ${FUNCNAME[0]:+${FUNCNAME[0]}() }'
PS4+='${FUNCNAME[0]:-(${BASH_SOURCE[0]}:${BASH_LINENO[0]}) }'
So bashcov seems a bit confused ... By injecting the bashcov version variable in the tested environment this issue can be avoided.
if [[ -z "${__bashcov_version__}" ]]; then
declare -x PS4='+ ${FUNCNAME[0]:+${FUNCNAME[0]}() }'
PS4+='${FUNCNAME[0]:-(${BASH_SOURCE[0]}:${BASH_LINENO[0]}) }'
fi
I did it in my script before calling bashcov and it works, however maybe your code is a better place. ;-)
declare -x __bashcov_version__
__bashcov_version__="$(bashcov --version)"
bashcov -- "./tools/bash_unit" "${test_files_lst[@]}" || retval=${?}
Thank's for your amazing work. Best regards,