[Skiboot] [PATCH v2] gcov: properly handle gard and pflash code coverage

Stewart Smith stewart at linux.vnet.ibm.com
Tue Jul 18 14:10:46 AEST 2017


We end up with a bit of a nasty hack to count the libflash symlinks
in gard and pflash as part of libflash code coverage, but it does
work and is unlikely to break anytime soon.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
Changes since v1: clean .info files
---
 Makefile.main                     | 13 ++++++++++++-
 external/gard/test/Makefile.check |  8 +++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Makefile.main b/Makefile.main
index 7275ae6fe4da..438dcb27905f 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -255,8 +255,18 @@ extract-gcov: extract-gcov.c
 coverage-report: skiboot.info
 	genhtml --branch-coverage -q -o $@ $<
 
-skiboot.info: coverage
+# A rather nasty hack here that relies on the lcov file format
+external/pflash/pflash.info: coverage
+	(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)
+external/gard/gard.info: coverage
+	(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)
+
+skiboot.info: coverage external/pflash/pflash.info external/gard/gard.info
 	lcov -q -c -d . $(LCOV_DIRS) -o $@ --rc lcov_branch_coverage=1
+	lcov -q -r $@ 'external/pflash/*' -o $@
+	lcov -q -r $@ 'external/gard/*' -o $@
+	lcov -q -a $@ -a external/pflash/pflash.info -o $@
+	lcov -q -a $@ -a external/gard/gard.info -o $@
 	lcov -q -r $@ $(LCOV_EXCLUDE) -o $@ --rc lcov_branch_coverage=1
 
 tags:
@@ -274,6 +284,7 @@ clean:
 	$(RM) *.[odsa] $(SUBDIRS:%=%/*.[odsa])
 	$(RM) *.elf $(TARGET).lid *.map $(TARGET).lds $(TARGET).lid.xz
 	$(RM) include/asm-offsets.h version.c .version
+	$(RM) skiboot.info external/gard/gard.info external/pflash/pflash.info
 	$(RM) extract-gcov $(TARGET).lid.stb $(TARGET).lid.xz.stb
 
 distclean: clean
diff --git a/external/gard/test/Makefile.check b/external/gard/test/Makefile.check
index 10cb7d10468c..593d0530ddb3 100644
--- a/external/gard/test/Makefile.check
+++ b/external/gard/test/Makefile.check
@@ -6,7 +6,7 @@ check: check-gard
 #make clean before checking. If not, .o files for different
 #architectures might be lying around and clean once done to
 #avoid the opposite
-check-gard: gard-test-clean
+check-gard: gard-test-clean gard
 	$(call QTEST, RUN-TEST , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ check, $@)
 	$(call QTEST, CLEANUP , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ clean, $@)
 
@@ -14,6 +14,12 @@ check-gard: gard-test-clean
 
 clean: gard-test-clean
 
+.PHONY: gard-coverage
+
+coverage: gard-coverage
+
+gard-coverage: check-gard
+
 gard-test-clean:
 	$(call QTEST, CLEANUP , make -C external/gard clean, $@)
 
-- 
2.13.0



More information about the Skiboot mailing list