diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-08-10 23:33:47 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-09-28 08:50:02 -0400 |
commit | 504923a0ed5c75775196c8ed0cd59b15d55cd39b (patch) | |
tree | cabfd7f5ef254105438742e17f72ab1b5f3a93ea /src | |
parent | 7769fc000aa3b959d3e1c7d7c3c2555aba7722c3 (diff) | |
download | postgresql-504923a0ed5c75775196c8ed0cd59b15d55cd39b.tar.gz postgresql-504923a0ed5c75775196c8ed0cd59b15d55cd39b.zip |
Run only top-level recursive lcov
This is the way lcov was intended to be used. It is much faster and
more robust and makes the makefiles simpler than running it in each
subdirectory.
The previous coding ran gcov before lcov, but that is useless because
lcov/geninfo call gcov internally and use that information. Moreover,
this led to complications and failures during parallel make. This
separates the two targets: You either use "make coverage" to get
textual output from gcov or "make coverage-html" to get an HTML report
via lcov. (Using both is still problematic because they write the same
output files.)
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.global.in | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in index fae8068150d..f352ba20e20 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -874,25 +874,29 @@ endif # enable_nls ifeq ($(enable_coverage), yes) -# There is a strange interaction between lcov and existing .gcov -# output files. Hence the rm command and the ordering dependency. +# make coverage -- text output -gcda_files := $(wildcard *.gcda) +local_gcda_files = $(wildcard *.gcda) -lcov.info: $(gcda_files) - rm -f *.gcov .*.gcov - $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV)) +coverage: $(local_gcda_files:.gcda=.c.gcov) -%.c.gcov: %.gcda | lcov.info +%.c.gcov: %.gcda $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out -coverage: $(gcda_files:.gcda=.c.gcov) lcov.info +# make coverage-html -- HTML output via lcov .PHONY: coverage-html -coverage-html: coverage +coverage-html: coverage-html-stamp + +coverage-html-stamp: lcov.info rm -rf coverage - mkdir coverage - $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print` + $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) $< + touch $@ + +all_gcda_files = $(shell find . -name '*.gcda' -print) + +lcov.info: $(all_gcda_files) + $(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV) # hook for clean-up @@ -900,7 +904,7 @@ clean distclean maintainer-clean: clean-coverage .PHONY: clean-coverage clean-coverage: - rm -rf coverage + rm -rf coverage coverage-html-stamp rm -f *.gcda *.gcno lcov.info *.gcov .*.gcov *.gcov.out |