Update cryptest-coverage.sh script

This commit is contained in:
Jeffrey Walton 2021-03-20 00:43:03 -04:00
parent cbf9597205
commit f7757ebde1
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
3 changed files with 52 additions and 29 deletions

View File

@ -1313,7 +1313,7 @@ android-clean:
.PHONY: distclean .PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean distclean: clean autotools-clean cmake-clean android-clean
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
-$(RM) cryptest_debug.info cryptest_noasm.info cryptest_release.info cryptest.info -$(RM) cryptest_all.info cryptest_debug.info cryptest_noasm.info cryptest_base.info cryptest.info cryptest_release.info
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~ @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/ @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj) @-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)

View File

@ -763,7 +763,7 @@ android-clean:
.PHONY: distclean .PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean distclean: clean autotools-clean cmake-clean android-clean
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
-$(RM) cryptest_debug.info cryptest_noasm.info cryptest_release.info cryptest.info -$(RM) cryptest_all.info cryptest_debug.info cryptest_noasm.info cryptest_base.info cryptest.info cryptest_release.info
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~ @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/ @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj) @-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v gcov > /dev/null; then if ! command -v gcov > /dev/null; then
echo "Please install gcov" echo "Please install gcov"
exit 1 exit 1
fi fi
if ! command -v lcov > /dev/null; then if ! command -v lcov > /dev/null; then
echo "Please install lcov" echo "Please install lcov"
exit 1 exit 1
fi fi
# Default make jobs # Default make jobs
@ -16,11 +16,11 @@ MAKE_JOBS=${MAKE_JOBS:-4}
# Default temp directory # Default temp directory
if [ -z "${TMPDIR}" ]; if [ -z "${TMPDIR}" ];
then then
if [ -d "${HOME}/tmp" ]; then if [ -d "${HOME}/tmp" ]; then
TMPDIR="${HOME}/tmp" TMPDIR="${HOME}/tmp"
else else
TMPDIR="/tmp" TMPDIR="/tmp"
fi fi
fi fi
DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage" 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 rm -rf TestCoverage/ >/dev/null
make distclean >/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 "**************************************************"
echo "***** Debug build *****" echo "***** Debug build *****"
@ -40,13 +52,15 @@ echo "**************************************************"
make clean > /dev/null make clean > /dev/null
if ! CXXFLAGS="${DEBUG_CXXFLAGS}" make -j "${MAKE_JOBS}"; if ! CXXFLAGS="${DEBUG_CXXFLAGS}" make -j "${MAKE_JOBS}";
then then
echo "Debug build failed" echo "Debug build failed"
exit 1 exit 1
fi fi
# Run test programs
./cryptest.exe v ./cryptest.exe v
./cryptest.exe tv all ./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_debug.info lcov --base-directory . --directory . -c -o cryptest_debug.info
echo "**************************************************" echo "**************************************************"
@ -56,13 +70,15 @@ echo "**************************************************"
make clean > /dev/null make clean > /dev/null
if ! CXXFLAGS="${NOASM_CXXFLAGS}" make -j "${MAKE_JOBS}"; if ! CXXFLAGS="${NOASM_CXXFLAGS}" make -j "${MAKE_JOBS}";
then then
echo "No ASM build failed" echo "No ASM build failed"
exit 1 exit 1
fi fi
# Run test programs
./cryptest.exe v ./cryptest.exe v
./cryptest.exe tv all ./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_noasm.info lcov --base-directory . --directory . -c -o cryptest_noasm.info
echo "**************************************************" echo "**************************************************"
@ -72,36 +88,43 @@ echo "**************************************************"
make clean > /dev/null make clean > /dev/null
if ! CXXFLAGS="${RELEASE_CXXFLAGS}" make -j "${MAKE_JOBS}"; if ! CXXFLAGS="${RELEASE_CXXFLAGS}" make -j "${MAKE_JOBS}";
then then
echo "Release build failed" echo "Release build failed"
exit 1 exit 1
fi fi
# Run test programs
./cryptest.exe v ./cryptest.exe v
./cryptest.exe tv all ./cryptest.exe tv all
./cryptest.exe b 0.5 ./cryptest.exe b 0.5
# Gather data
lcov --base-directory . --directory . -c -o cryptest_release.info lcov --base-directory . --directory . -c -o cryptest_release.info
echo "**************************************************" echo "**************************************************"
echo "***** HTML processing *****" echo "***** HTML processing *****"
echo "**************************************************" echo "**************************************************"
if [ ! e cryptest_debug.info ]; then if [ ! -e cryptest_debug.info ]; then
echo "WARN: cryptest_debug.info does not exist" echo "WARN: cryptest_debug.info does not exist"
fi fi
if [ ! e cryptest_noasm.info ]; then if [ ! -e cryptest_noasm.info ]; then
echo "WARN: cryptest_noasm.info does not exist" echo "WARN: cryptest_noasm.info does not exist"
fi fi
if [ ! e cryptest_release.info ]; then if [ ! -e cryptest_release.info ]; then
echo "WARN: cryptest_release.info does not exist" echo "WARN: cryptest_release.info does not exist"
fi fi
lcov --add-tracefile cryptest_debug.info --add-tracefile cryptest_noasm.info --add-tracefile cryptest_release.info -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.info "*/adhoc*.*" -o cryptest.info lcov --remove cryptest_all.info \
lcov --remove cryptest.info "*/fipstest*.*" -o cryptest.info '/usr/*' 'adhoc*.*' 'fipstest*.*' 'fips140*.*' \
lcov --remove cryptest.info "*/fips140*.*" -o cryptest.info --output-file cryptest.info
lcov --remove cryptest.info "/usr/*" -o cryptest.info
genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info