commit 999096d35f452f1594c10b4b2822d6c3e7f08813 parent 11a1e2b9c41e87270850da65b4203f8a270b8384 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Mon, 2 Jan 2023 15:11:51 +0100 build: Add coverage target for gcov This target calls all the tools involved to generate a html output. Diffstat:
M | Makefile | | | 3 | ++- |
M | scripts/build/tool/gcov.mk | | | 7 | ++++++- |
M | scripts/rules.mk | | | 1 | - |
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile @@ -41,7 +41,8 @@ dirs: $(SCRIPTDIR)/libc-dirs clean: xargs rm -rf < $(SCRIPTDIR)/libc-dirs - rm -f dirs + find . -name '*.gcno' -o -name '*.gcda' | xargs rm -f + rm -rf dirs coverage distclean: clean rm -f include/scc/scc/sysld.h diff --git a/scripts/build/tool/gcov.mk b/scripts/build/tool/gcov.mk @@ -1,3 +1,8 @@ -PROFILE_CFLAGS = -fprofile-arcs -ftest-coverage -fprofile-abs-path +PROFILE_CFLAGS = -fprofile-arcs -ftest-coverage PROFILE_LDLIBS = -lgcov include $(BUILDDIR)/tool/gnu.mk + +coverage: + mkdir -p coverage + lcov -c -d . -o coverage/cov.info + genhtml -o coverage coverage/cov.info diff --git a/scripts/rules.mk b/scripts/rules.mk @@ -201,7 +201,6 @@ clean-dirs: clean-files: rm -f *.i *.d *.o *.a *.elf $(TARGET) - rm -f *.gcno *.gcda dep: inc-dep $(FORALL)