aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Peskine <Gilles.Peskine@arm.com>2022-12-01 17:41:36 +0100
committerGilles Peskine <Gilles.Peskine@arm.com>2022-12-13 18:44:14 +0100
commitbb3d31659b6e66ec678862a6e6532d67b7d6466c (patch)
tree53531005801e3641af5049a716728fd2f01df8b2
parent26aae470428f6d48277584aca6761174ebc699c7 (diff)
downloadmbedtls-bb3d31659b6e66ec678862a6e6532d67b7d6466c.zip
mbedtls-bb3d31659b6e66ec678862a6e6532d67b7d6466c.tar.gz
mbedtls-bb3d31659b6e66ec678862a6e6532d67b7d6466c.tar.bz2
You need --coverage when linking as well
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
-rw-r--r--Makefile5
-rwxr-xr-xscripts/lcov.sh8
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e5dddba..5e0275a 100644
--- a/Makefile
+++ b/Makefile
@@ -100,8 +100,9 @@ check: lib tests
test: check
ifndef WINDOWS
-# note: for coverage testing, build with:
-# make CFLAGS='--coverage -g3 -O0'
+# Note: for coverage testing, build with:
+# make CFLAGS='--coverage -g3 -O0' LDFLAGS='--coverage -g3 -O0'
+# For the reference coverage measurement, see tests/scripts/basic-build-test.sh
covtest:
$(MAKE) check
programs/test/selftest
diff --git a/scripts/lcov.sh b/scripts/lcov.sh
index 718166d..8d141ee 100755
--- a/scripts/lcov.sh
+++ b/scripts/lcov.sh
@@ -6,8 +6,14 @@ Usage: $0 [-r]
Collect coverage statistics of library code into an HTML report.
General instructions:
-1. Build the library with CFLAGS="--coverage -O0 -g3".
+1. Build the library with CFLAGS="--coverage -O0 -g3" and link the test
+ programs with LDFLAGS="--coverage".
This can be an out-of-tree build.
+ For example (in-tree):
+ make CFLAGS="--coverage -O0 -g3" LDFLAGS="--coverage"
+ Or (out-of-tree):
+ mkdir build-coverage && cd build-coverage &&
+ cmake -D CMAKE_BUILD_TYPE=Coverage .. && make
2. Run whatever tests you want.
3. Run this script from the parent of the directory containing the library
object files and coverage statistics files.