mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-23 16:20:49 +00:00
Merge pull request #8395 from tom-daubney-arm/modify_lcov_script_tf_psa_crypto
Modify lcov.sh to work in tf-psa-crypto as well
This commit is contained in:
commit
fc31cb28ee
@ -42,16 +42,21 @@ EOF
|
||||
|
||||
set -eu
|
||||
|
||||
# Repository detection
|
||||
in_mbedtls_build_dir () {
|
||||
test -d library
|
||||
}
|
||||
|
||||
# Collect stats and build a HTML report.
|
||||
lcov_library_report () {
|
||||
rm -rf Coverage
|
||||
mkdir Coverage Coverage/tmp
|
||||
lcov --capture --initial --directory library -o Coverage/tmp/files.info
|
||||
lcov --rc lcov_branch_coverage=1 --capture --directory library -o Coverage/tmp/tests.info
|
||||
lcov --capture --initial --directory $library_dir -o Coverage/tmp/files.info
|
||||
lcov --rc lcov_branch_coverage=1 --capture --directory $library_dir -o Coverage/tmp/tests.info
|
||||
lcov --rc lcov_branch_coverage=1 --add-tracefile Coverage/tmp/files.info --add-tracefile Coverage/tmp/tests.info -o Coverage/tmp/all.info
|
||||
lcov --rc lcov_branch_coverage=1 --remove Coverage/tmp/all.info -o Coverage/tmp/final.info '*.h'
|
||||
gendesc tests/Descriptions.txt -o Coverage/tmp/descriptions
|
||||
genhtml --title "Mbed TLS" --description-file Coverage/tmp/descriptions --keep-descriptions --legend --branch-coverage -o Coverage Coverage/tmp/final.info
|
||||
genhtml --title "$title" --description-file Coverage/tmp/descriptions --keep-descriptions --legend --branch-coverage -o Coverage Coverage/tmp/final.info
|
||||
rm -f Coverage/tmp/*.info Coverage/tmp/descriptions
|
||||
echo "Coverage report in: Coverage/index.html"
|
||||
}
|
||||
@ -59,9 +64,9 @@ lcov_library_report () {
|
||||
# Reset the traces to 0.
|
||||
lcov_reset_traces () {
|
||||
# Location with plain make
|
||||
rm -f library/*.gcda
|
||||
rm -f $library_dir/*.gcda
|
||||
# Location with CMake
|
||||
rm -f library/CMakeFiles/*.dir/*.gcda
|
||||
rm -f $library_dir/CMakeFiles/*.dir/*.gcda
|
||||
}
|
||||
|
||||
if [ $# -gt 0 ] && [ "$1" = "--help" ]; then
|
||||
@ -69,6 +74,14 @@ if [ $# -gt 0 ] && [ "$1" = "--help" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if in_mbedtls_build_dir; then
|
||||
library_dir='library'
|
||||
title='Mbed TLS'
|
||||
else
|
||||
library_dir='core'
|
||||
title='TF-PSA-Crypto'
|
||||
fi
|
||||
|
||||
main=lcov_library_report
|
||||
while getopts r OPTLET; do
|
||||
case $OPTLET in
|
||||
|
Loading…
x
Reference in New Issue
Block a user