Hi Dmitry,

On Mon, 2021-01-11 at 18:33 +0300, Dmitry V. Levin wrote:
> On Mon, Jan 11, 2021 at 04:07:38PM +0100, Mark Wielaard wrote:
> > 
> lcov --exclude was introduced by lcov commit v1.14~19; yes, we can check
> whether e.g. "lcov --exclude=/ --version" works.  Alternatively, we could
> use --directory option, but that would require some discipline in
> maintaining the list of directories.  What's your preferred choice?

Could we somehow base it on the toplevel SUBDIRS?
Maybe (untested)

  COVDIRS = $(subst tests,,$(SUBDIRS))
  COVDARGS = $(patsubst %,-d%,$(COVDIRS))

> > > +COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME)-$(PACKAGE_VERSION).lcov
> > > +COVERAGE_OUTPUT_DIRECTORY = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-
> > > coverage
> 
> By the way, I'm not sure whether we need -$(PACKAGE_VERSION) in
> COVERAGE_OUTPUT_FILE and COVERAGE_OUTPUT_DIRECTORY.

Maybe not in the output dir/file, but it is nice to have in the title.

> > Note that the elfutils-htdocs git repo (which holds the website)
> > contains an update-coverage.sh script that does:
> > 
> >    # Note we want srcdir == builddir for better output.
> >    ${tempdir}/elfutils/configure --enable-maintainer-mode --enable-gcov
> >    make -j$(nproc)
> >    make check
> >    lcov -c -d backends -d lib -d libasm -d libcpu -d libdw -d libdwelf
> >    \
> >         -d libdwfl -d libebl -d libelf -d src -d debuginfod \
> >         --no-external > lcov.out
> >    genhtml -s --legend -t "elfutils-${version}" -o coverage lcov.out
> > 
> >    So that is executed at the top-level instead of inside the tests dir
> >    and instead of --exclude it uses -d which IMHO gives slightly nicer
> >    output by only showing the top-level dirs.
> 
> I suppose the difference between --exclude and -d is only visible when
> srcdir != builddir.  If these directories are different, then
> update-coverage.sh will likely miss some information because of this
> explicit list of directories.

Yeah, so if using --exclude fixes that, then please do use that
instead.

Cheers,

Mark

Reply via email to