[RFC PATCH 0/4] [PIDNS] Trie and pidns-cache tests

Dmitry V. Levin ldv at altlinux.org
Sun Aug 23 21:55:13 UTC 2020


On Sun, Aug 23, 2020 at 11:30:37PM +0200, Ákos Uzonyi wrote:
> On Sun, 23 Aug 2020 at 00:36, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > OK, I've found a way to work this around and squeeze some coverage
> > out of the test, feel free to squash it in:
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index f4bd0e0d9..f79d93437 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -409,7 +409,7 @@ endif
> >  CODE_COVERAGE_BRANCH_COVERAGE = 1
> >  CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \
> >         --prefix $(shell cd $(abs_top_srcdir)/.. && pwd || echo .)
> > -CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*'
> > +CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*' '*/tests/*' '*/tests-m32/*' '*/tests-mx32/*'
> >  strace_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
> >  strace_CFLAGS += $(CODE_COVERAGE_CFLAGS)
> >  strace_LDADD += $(CODE_COVERAGE_LIBS)
> > diff --git a/tests/Makefile.am b/tests/Makefile.am
> > index 39d948cf4..56e0e8eea 100644
> > --- a/tests/Makefile.am
> > +++ b/tests/Makefile.am
> > @@ -66,7 +66,6 @@ libtests_a_SOURCES = \
> >         test_ucopy.h \
> >         tests.h \
> >         tprintf.c \
> > -       trie.c \
> >         # end of libtests_a_SOURCES
> >  libtests_a_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
> >  check_LIBRARIES = libtests.a
> > @@ -308,6 +307,11 @@ stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
> >         stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
> >         stack-fcall-mangled-2.c stack-fcall-mangled-3.c
> >
> > +trie_test_SOURCES = trie_test.c trie_for_tests.c
> > +trie_test_CPPFLAGS = $(AM_CPPFLAGS) $(CODE_COVERAGE_CPPFLAGS)
> > +trie_test_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS)
> > +trie_test_LDADD = $(LDADD) $(CODE_COVERAGE_LIBS)
> > +
> >  include gen_tests.am
> >
> >  if ENABLE_STACKTRACE
> > diff --git a/tests/trie.c b/tests/trie.c
> > deleted file mode 120000
> > index 0dd9cab45..000000000
> > --- a/tests/trie.c
> > +++ /dev/null
> > @@ -1 +0,0 @@
> > -../trie.c
> > \ No newline at end of file
> > diff --git a/tests/trie_for_tests.c b/tests/trie_for_tests.c
> > new file mode 100644
> > index 000000000..13e564c4f
> > --- /dev/null
> > +++ b/tests/trie_for_tests.c
> > @@ -0,0 +1 @@
> > +#include "trie.c"
> 
> I didn't know very well how this code coverage is configured, so thank
> you for helping with this.

The idea was to compile tests/trie_for_tests.c (which is trie.c) along
with the test with coverage options.  For this reason I had to take
tests/trie_for_tests.c out of libtests_a_SOURCES and convert it from a
symlink into a real file so that the original trie.c is covered instead of
a symlinked file.


-- 
ldv


More information about the Strace-devel mailing list