On Tue, 2021-01-12 at 07:29 +0300, Dmitry V. Levin wrote:
> Implement a target for capturing code coverage using lcov.
> It is available when elfutils is configured using --enable-gcov.

Very nice.

> +$(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
> +     LC_ALL=C $(GENHTML) \
> +             --legend \
> +             --show-details \
> +             --rc=genhtml_branch_coverage=1 \
> +             --title='$(COVERAGE_TITLE)' \
> +             --prefix='$(abspath $(abs_srcdir))' \
> +             --prefix='$(abspath $(abs_builddir)/..)' \
> +             --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
> +             $<

Now that it is a top-level target the buildir /.. can be removed.
Also depending on how I build there seems to be a combination of
absolute and real paths in the coverage files (I have symlinks in my
src and build dirs to make them go on separate disks). So I am using
both:

diff --git a/Makefile.am b/Makefile.am
index 30f763a9..69edcb02 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -79,8 +79,10 @@ $(COVERAGE_OUTPUT_INDEX_HTML):
$(COVERAGE_OUTPUT_FILE)
                --show-details \
                --rc=genhtml_branch_coverage=1 \
                --title='$(COVERAGE_TITLE)' \
+               --prefix='$(realpath $(abs_srcdir))' \
                --prefix='$(abspath $(abs_srcdir))' \
-               --prefix='$(abspath $(abs_builddir)/..)' \
+               --prefix='$(realpath $(abs_builddir))' \
+               --prefix='$(abspath $(abs_builddir))' \
                --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
                $<

Make that makes sense? Either way feel free to push this.

Thanks,

Mark

Reply via email to