summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile2
-rw-r--r--GNUmakefile-cross2
-rwxr-xr-xTestScripts/cryptest-coverage.sh79
3 files changed, 53 insertions, 30 deletions
diff --git a/GNUmakefile b/GNUmakefile
index a2c30cc9..182f45c9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1313,7 +1313,7 @@ android-clean:
.PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean
-$(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) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
diff --git a/GNUmakefile-cross b/GNUmakefile-cross
index 284a126e..518917c4 100644
--- a/GNUmakefile-cross
+++ b/GNUmakefile-cross
@@ -763,7 +763,7 @@ android-clean:
.PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean
-$(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) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
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