[Skiboot] [PATCH v2 05/52] Makefile: Paper over gard and pflash coverage issues

Andrew Jeffery andrew at aj.id.au
Thu Feb 21 17:28:04 AEDT 2019


`make coverage-report` gave the following error:

    (cd external/pflash; lcov -q -c -d . -o pflash.info --rc lcov_branch_coverage=1; sed -i -e 's%external/pflash/libflash%libflash%; s%external/pflash/ccan%ccan%' pflash.info)
    (cd external/gard; lcov -q -c -d . -o gard.info --rc lcov_branch_coverage=1; sed -i -e 's%external/gard/libflash%libflash%; s%external/gard/ccan%ccan%' gard.info)
    geninfo: WARNING: no .gcda files found in . - skipping!
    geninfo: WARNING: no .gcda files found in . - skipping!
    lcov -q -c -d . -d ccan/check_type/test/  -d ccan/str/test/  -d ccan/str/test/  -d ccan/list/test/  -d ccan/list/test/  -d ccan/list/test/  -d ccan/list/test/  -d ccan/list/test/  -d ccan/build_assert/test/  -d ccan/short_types/test/  -d ccan/short_types/test/  -d ccan/array_size/test/  -d ccan/container_of/test/  -d ccan/endian/test/  -d libc/test/  -d libc/test/  -d libc/test/  -d libc/test/  -o skiboot.info --rc lcov_branch_coverage=1
    lcov -q -r skiboot.info 'external/pflash/*' -o skiboot.info
    lcov -q -r skiboot.info 'external/gard/*' -o skiboot.info
    lcov -q -a skiboot.info -a external/pflash/pflash.info -o skiboot.info
    lcov: ERROR: no valid records found in tracefile external/pflash/pflash.info
    make: *** [/home/andrew/src/open-power/skiboot/Makefile.main:315: skiboot.info] Error 255

And similar again for the gard tool. We should really untangle the build
strategy for tools in external/, but in the mean time paper over the
problem of generating the lcov output at the top level by ensuring we
have a means to generate the necessary gcda files for lcov to consume.

Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 Makefile.main            | 8 ++++++++
 external/gard/Makefile   | 4 ++++
 external/pflash/Makefile | 4 ++++
 3 files changed, 16 insertions(+)

diff --git a/Makefile.main b/Makefile.main
index 15c906752f6d..096a58d56986 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -225,9 +225,17 @@ include $(SRC)/libstb/Makefile.inc
 gard:
 	(cd external/gard; CROSS_COMPILE="" CFLAGS="$(HOSTCFLAGS) $(HOSTGCOVCFLAGS)" make)
 
+coverage: gard-coverage
+gard-coverage:
+	(cd external/gard; CROSS_COMPILE="" CFLAGS="$(HOSTCFLAGS) $(HOSTGCOVCFLAGS)" make coverage)
+
 pflash:
 	(cd external/pflash; CROSS_COMPILE="" CFLAGS="$(HOSTCFLAGS) $(HOSTGCOVCFLAGS)" make)
 
+coverage: pflash-coverage
+pflash-coverage:
+	(cd external/pflash; CROSS_COMPILE="" CFLAGS="$(HOSTCFLAGS) $(HOSTGCOVCFLAGS)" make coverage)
+
 pflash-coverity:
 	(cd external/pflash; ./build-all-arch.sh)
 
diff --git a/external/gard/Makefile b/external/gard/Makefile
index 2ccd1440df6b..50589cf482cd 100644
--- a/external/gard/Makefile
+++ b/external/gard/Makefile
@@ -5,6 +5,10 @@ include ../../external/common/rules.mk
 
 all: links arch_links $(EXE)
 
+.PHONY: coverage
+coverage: CFLAGS += -fprofile-arcs -ftest-coverage
+coverage: check
+
 #Rebuild version.o so that the the version always matches
 #what the test suite will get from ./make_version.sh
 check: version.o all
diff --git a/external/pflash/Makefile b/external/pflash/Makefile
index 5395bdfa533b..243de6ee0670 100644
--- a/external/pflash/Makefile
+++ b/external/pflash/Makefile
@@ -4,6 +4,10 @@ include ../../external/common/rules.mk
 
 all: links arch_links $(EXE)
 
+.PHONY: coverage
+coverage: CFLAGS += -fprofile-arcs -ftest-coverage
+coverage: check
+
 #Rebuild version.o so that the the version always matches
 #what the test suite will get from ./make_version.sh
 check: version.o all
-- 
2.19.1



More information about the Skiboot mailing list