diff options
author | Jeffrey Walton <noloader@gmail.com> | 2021-03-20 00:43:03 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2021-03-20 00:43:03 -0400 |
commit | f7757ebde11350d7e752a2b9177f83b201b4de25 (patch) | |
tree | 22403522345ba7df0b4b98a73dbb975e6729ba70 /TestScripts/cryptest-coverage.sh | |
parent | cbf9597205db23ba40009fa5a24d334fd6d8c6d5 (diff) | |
download | cryptopp-git-f7757ebde11350d7e752a2b9177f83b201b4de25.tar.gz |
Update cryptest-coverage.sh script
Diffstat (limited to 'TestScripts/cryptest-coverage.sh')
-rwxr-xr-x | TestScripts/cryptest-coverage.sh | 79 |
1 files changed, 51 insertions, 28 deletions
diff --git a/TestScripts/cryptest-coverage.sh b/TestScripts/cryptest-coverage.sh index 634c5fc0..164c9e08 100755 --- a/TestScripts/cryptest-coverage.sh +++ b/TestScripts/cryptest-coverage.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash if ! command -v gcov > /dev/null; then - echo "Please install gcov" - exit 1 + echo "Please install gcov" + exit 1 fi if ! command -v lcov > /dev/null; then - echo "Please install lcov" - exit 1 + echo "Please install lcov" + exit 1 fi # Default make jobs @@ -16,11 +16,11 @@ MAKE_JOBS=${MAKE_JOBS:-4} # Default temp directory if [ -z "${TMPDIR}" ]; then - if [ -d "${HOME}/tmp" ]; then - TMPDIR="${HOME}/tmp" - else - TMPDIR="/tmp" - fi + if [ -d "${HOME}/tmp" ]; then + TMPDIR="${HOME}/tmp" + else + TMPDIR="/tmp" + fi fi DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage" @@ -31,7 +31,19 @@ RELEASE_CXXFLAGS="-DNDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage" rm -rf TestCoverage/ >/dev/null make distclean >/dev/null -lcov --base-directory . --directory . --zerocounters -q +echo "**************************************************" +echo "***** Baseline build *****" +echo "**************************************************" + +make clean > /dev/null +if ! make -j "${MAKE_JOBS}"; +then + echo "Baseline build failed" + exit 1 +fi + +# Create a baseline +lcov --base-directory . --directory . -i -c -o cryptest_base.info echo "**************************************************" echo "***** Debug build *****" @@ -40,13 +52,15 @@ echo "**************************************************" make clean > /dev/null if ! CXXFLAGS="${DEBUG_CXXFLAGS}" make -j "${MAKE_JOBS}"; then - echo "Debug build failed" - exit 1 + echo "Debug build failed" + exit 1 fi +# Run test programs ./cryptest.exe v ./cryptest.exe tv all +# Gather data lcov --base-directory . --directory . -c -o cryptest_debug.info echo "**************************************************" @@ -56,13 +70,15 @@ echo "**************************************************" make clean > /dev/null if ! CXXFLAGS="${NOASM_CXXFLAGS}" make -j "${MAKE_JOBS}"; then - echo "No ASM build failed" - exit 1 + echo "No ASM build failed" + exit 1 fi +# Run test programs ./cryptest.exe v ./cryptest.exe tv all +# Gather data lcov --base-directory . --directory . -c -o cryptest_noasm.info echo "**************************************************" @@ -72,36 +88,43 @@ echo "**************************************************" make clean > /dev/null if ! CXXFLAGS="${RELEASE_CXXFLAGS}" make -j "${MAKE_JOBS}"; then - echo "Release build failed" - exit 1 + echo "Release build failed" + exit 1 fi +# Run test programs ./cryptest.exe v ./cryptest.exe tv all ./cryptest.exe b 0.5 +# Gather data lcov --base-directory . --directory . -c -o cryptest_release.info echo "**************************************************" echo "***** HTML processing *****" echo "**************************************************" -if [ ! e cryptest_debug.info ]; then - echo "WARN: cryptest_debug.info does not exist" +if [ ! -e cryptest_debug.info ]; then + echo "WARN: cryptest_debug.info does not exist" fi -if [ ! e cryptest_noasm.info ]; then - echo "WARN: cryptest_noasm.info does not exist" +if [ ! -e cryptest_noasm.info ]; then + echo "WARN: cryptest_noasm.info does not exist" fi -if [ ! e cryptest_release.info ]; then - echo "WARN: cryptest_release.info does not exist" +if [ ! -e cryptest_release.info ]; then + echo "WARN: cryptest_release.info does not exist" fi -lcov --add-tracefile cryptest_debug.info --add-tracefile cryptest_noasm.info --add-tracefile cryptest_release.info -o cryptest.info - -lcov --remove cryptest.info "*/adhoc*.*" -o cryptest.info -lcov --remove cryptest.info "*/fipstest*.*" -o cryptest.info -lcov --remove cryptest.info "*/fips140*.*" -o cryptest.info -lcov --remove cryptest.info "/usr/*" -o cryptest.info +# The man page at https://linux.die.net/man/1/lcov says to add cryptest_base.info, +# but it causes an error in the command below. +# --add-tracefile cryptest_base.info +lcov --add-tracefile cryptest_debug.info \ + --add-tracefile cryptest_noasm.info \ + --add-tracefile cryptest_release.info \ + --output-file cryptest_all.info + +lcov --remove cryptest_all.info \ + '/usr/*' 'adhoc*.*' 'fipstest*.*' 'fips140*.*' \ + --output-file cryptest.info genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info |