diff options
author | Aaron Merey <amerey@redhat.com> | 2024-05-06 16:30:46 -0400 |
---|---|---|
committer | Aaron Merey <amerey@redhat.com> | 2024-05-06 16:30:46 -0400 |
commit | ca8ad4648197bdf26712ff2841227fbcd23840ab (patch) | |
tree | 7fb90333f7f19ee060d621bbac6fefdff1684807 | |
parent | eeea53b41b12dc9633ce6a3b1eb5c7d0ba0e057f (diff) |
Fix 'make coverage' when used with lcov version 2.0+upstream/main
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 <amerey@redhat.com>
-rw-r--r-- | Makefile.am | 30 | ||||
-rw-r--r-- | configure.ac | 4 |
2 files changed, 33 insertions, 1 deletions
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 diff --git a/configure.ac b/configure.ac index a279bb52..2aa728bd 100644 --- a/configure.ac +++ b/configure.ac @@ -322,6 +322,10 @@ if test "$use_gcov" = yes; then fi AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) +# Check if lcov/genhtml supports ignoring additional errors. +AM_CONDITIONAL([LCOV_OLD], + [test "$LCOV" = "lcov" && lcov --version | grep -E -q "version 0|version 1"]) + AC_ARG_ENABLE([sanitize-undefined], AS_HELP_STRING([--enable-sanitize-undefined], [Use gcc undefined behaviour sanitizer]), |