Hi, On Mon, May 06, 2024 at 04:45:27PM -0400, Aaron Merey wrote: > Starting with version 2.0, various lcov warnings now trigger an error > exit. This results in 'make coverage' terminating before completion. > > Fix this by invoking lcov and genhtml with --ignore-errors to prevent > the error exit when version 2.0+ is in use. > > Manually tested by running elfutils-htdocs/update-coverage.sh with > lcov 1.14 and 2.0. > > Signed-off-by: Aaron Merey <ame...@redhat.com> > --- > Makefile.am | 30 +++++++++++++++++++++++++++++- > configure.ac | 4 ++++ > 2 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/Makefile.am b/Makefile.am > index c9d59d4a..a1f0b0c3 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -77,6 +77,7 @@ coverage-clean: > coverage: $(COVERAGE_OUTPUT_INDEX_HTML) > @echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)' > > +if LCOV_OLD > $(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE) > LC_ALL=C $(GENHTML) \ > --legend \ > @@ -89,7 +90,23 @@ $(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE) > --prefix='$(realpath $(abs_builddir)/..)' \ > --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \ > $< > +else > +$(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE) > + LC_ALL=C $(GENHTML) \ > + --legend \ > + --show-details \ > + --ignore-errors empty,negative \ > + --rc=genhtml_branch_coverage=1 \ > + --title='$(COVERAGE_TITLE)' \ > + --prefix='$(abspath $(abs_srcdir))' \ > + --prefix='$(realpath $(abs_srcdir))' \ > + --prefix='$(abspath $(abs_builddir)/..)' \ > + --prefix='$(realpath $(abs_builddir)/..)' \ > + --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \ > + $< > +endif > > +if LCOV_OLD > $(COVERAGE_OUTPUT_FILE): > $(LCOV) \ > --capture \ > @@ -99,7 +116,18 @@ $(COVERAGE_OUTPUT_FILE): > --gcov-tool='$(GCOV)' \ > --output-file='$@' \ > $(LCOV_DIRS_ARGS) > - > +else > +$(COVERAGE_OUTPUT_FILE): > + $(LCOV) \ > + --capture \ > + --no-external \ > + --no-checksum \ > + --ignore-errors empty,negative \ > + --rc=lcov_branch_coverage=1 \ > + --gcov-tool='$(GCOV)' \ > + --output-file='$@' \ > + $(LCOV_DIRS_ARGS) > +endif > endif > > # Tell version 3.79 and up of GNU make to not build goals in this
Would it be possible to avoid code duplication by parametrizing just the difference? -- ldv