Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bb5a25

Browse files
committed
Add lcov --initial
By just running lcov on the produced .gcda data files, we don't accountfor source files that are not touched by tests at all. To fix that, runlcov --initial to create a base line info file with all zero counters,and merge that with the actual counters when creating the final report.Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent22d9764 commit4bb5a25

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

‎.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ objfiles.txt
2121
*.gcda
2222
*.gcov
2323
*.gcov.out
24-
lcov.info
24+
lcov*.info
2525
coverage/
2626
coverage-html-stamp
2727
*.vcproj

‎src/Makefile.global.in

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,13 @@ endif # enable_nls
869869
#gcov from foo.gcda (by "make coverage")
870870
# foo.c.gcov.out stdout captured when foo.c.gcov is created, mildly
871871
#interesting
872-
# lcov.infolcov tracefile, built from gcda files in one directory,
872+
# lcov_test.info
873+
#lcov tracefile, built from gcda files in one directory,
873874
#later collected by "make coverage-html"
875+
# lcov_base.info
876+
#tracefile for zero counters for every file, so that
877+
#even files that are not touched by tests are counted
878+
#for the overall coverage rate
874879

875880
ifeq ($(enable_coverage), yes)
876881

@@ -888,15 +893,23 @@ coverage: $(local_gcda_files:.gcda=.c.gcov)
888893
.PHONY: coverage-html
889894
coverage-html: coverage-html-stamp
890895

891-
coverage-html-stamp:lcov.info
896+
coverage-html-stamp:lcov_base.info lcov_test.info
892897
rm -rf coverage
893-
$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir)$<
898+
$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir)$^
894899
touch$@
895900

901+
LCOV += --gcov-tool$(GCOV)
902+
LCOVFLAGS = --no-external
903+
904+
all_gcno_files =$(shell find . -name '*.gcno' -print)
905+
906+
lcov_base.info:$(all_gcno_files)
907+
$(LCOV)$(LCOVFLAGS) -c -i -d. -o$@
908+
896909
all_gcda_files =$(shell find . -name '*.gcda' -print)
897910

898-
lcov.info:$(all_gcda_files)
899-
$(LCOV)-d. -c -o$@$(LCOVFLAGS) --gcov-tool$(GCOV) --no-external
911+
lcov_test.info:$(all_gcda_files)
912+
$(LCOV)$(LCOVFLAGS) -c -d. -o$@
900913

901914

902915
# hook for clean-up
@@ -905,7 +918,7 @@ clean distclean maintainer-clean: clean-coverage
905918
.PHONY: clean-coverage
906919
clean-coverage:
907920
rm -rf coverage coverage-html-stamp
908-
rm -f*.gcda*.gcno lcov.info*.gcov .*.gcov*.gcov.out
921+
rm -f*.gcda*.gcno lcov*.info*.gcov .*.gcov*.gcov.out
909922

910923

911924
# User-callable target to reset counts between test runs

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp