You need --coverage when linking as well
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
749a0d7be8
commit
202b1a07ba
2 changed files with 10 additions and 3 deletions
5
Makefile
5
Makefile
|
@ -136,8 +136,9 @@ check: lib tests
|
||||||
test: check
|
test: check
|
||||||
|
|
||||||
ifndef WINDOWS
|
ifndef WINDOWS
|
||||||
# note: for coverage testing, build with:
|
# Note: for coverage testing, build with:
|
||||||
# make CFLAGS='--coverage -g3 -O0'
|
# make CFLAGS='--coverage -g3 -O0' LDFLAGS='--coverage -g3 -O0'
|
||||||
|
# For the reference coverage measurement, see tests/scripts/basic-build-test.sh
|
||||||
covtest:
|
covtest:
|
||||||
$(MAKE) check
|
$(MAKE) check
|
||||||
programs/test/selftest
|
programs/test/selftest
|
||||||
|
|
|
@ -6,8 +6,14 @@ Usage: $0 [-r]
|
||||||
Collect coverage statistics of library code into an HTML report.
|
Collect coverage statistics of library code into an HTML report.
|
||||||
|
|
||||||
General instructions:
|
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.
|
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.
|
2. Run whatever tests you want.
|
||||||
3. Run this script from the parent of the directory containing the library
|
3. Run this script from the parent of the directory containing the library
|
||||||
object files and coverage statistics files.
|
object files and coverage statistics files.
|
||||||
|
|
Loading…
Reference in a new issue