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

Dmitry V. Levin ldv at altlinux.org
Sat Aug 22 22:36:15 UTC 2020


On Tue, Aug 18, 2020 at 02:19:50PM +0200, Ákos Uzonyi wrote:
> On Tue, 18 Aug 2020 at 01:44, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > On Tue, Aug 18, 2020 at 01:21:18AM +0200, Ákos Uzonyi wrote:
> > > On Tue, 18 Aug 2020 at 01:12, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > > > On Tue, Aug 18, 2020 at 12:12:17AM +0200, Ákos Uzonyi wrote:
> > > > > On Sat, 15 Aug 2020 at 18:27, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > > > > > On Sat, Aug 15, 2020 at 06:23:26PM +0200, Ákos Uzonyi wrote:
> > > > > > > On Sat, 15 Aug 2020 at 14:41, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > > > > > > > On Thu, Aug 13, 2020 at 05:32:38PM +0200, Ákos Uzonyi wrote:
> > > > > > > > > is it's OK to add ../trie.c ../trie.h to libtests_a_SOURCES?
> > > > > > > >
> > > > > > > > I suppose automake should be fine with it.  What's your concern?
> > > > > > >
> > > > > > > Technically there is no problem, I just worried about including a file
> > > > > > > not in tests directory, as it hasn't been done before. But if you say
> > > > > > > it's OK, then everything is fine :).
> > > > > >
> > > > > > The only problem is that it won't be built with coverage support,
> > > > > > so it won't be shown in coverage reports.
> > > > >
> > > > > I found an another problem, github CI errors with:
> > > > >
> > > > > /usr/bin/ld: i386:x86-64 architecture of input file
> > > > > `libtests.a(libtests_a-trie.o)' is incompatible with i386 output
> > > >
> > > > Interesting.  Could you give a link to the full log?
> > >
> > > https://github.com/AkosUzonyi/strace/runs/994567416
> >
> > I see, it just built ../libtests_a-trie.o once and used it several times.
> >
> > > > However, we are probably not interested in running this test for compat
> > > > personalities.  There is a loop in ./bootstrap that creates tests-m32 and
> > > > tests-mx32 directories, we could do something there to filter it out.
> > >
> > > Yes, I was also thinking about doing something in bootstrap. But I
> > > think it's easier to add a symlink, and it also solves the coverage
> > > support problem.
> >
> > I agree adding a symlink is much easier way to fix the build, but I don't
> > see how it solves the coverage support problem.
> 
> Sorry, I was wrong about this coverage thing. However pidns tests
> already cover nearly all the lines of trie.c (except trie_free), so
> trie test's goal is not to add line coverage, but to test edge cases
> of trie.

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"


-- 
ldv


More information about the Strace-devel mailing list