[Spice-devel] [PATCH spice-common] test-overflow: Remove dependency from libspice-common-{server, client}
Frediano Ziglio
fziglio at redhat.com
Tue Jul 10 06:23:56 UTC 2018
>
> On 05/07/18 04:12, Frediano Ziglio wrote:
> > Remove dependency from main protocol allowing to run the
> > test independently from generation setting.
> > This is useful with Meson allowing to not generate all code.
> >
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> > tests/Makefile.am | 9 ++++++---
> > tests/meson.build | 17 ++++++++++-------
> > tests/test-marshallers.c | 6 ++++--
> > tests/test-marshallers.h | 5 +++++
> > tests/test-marshallers.proto | 5 +++++
> > tests/test-overflow.c | 8 ++++----
> > 6 files changed, 34 insertions(+), 16 deletions(-)
> >
> > diff --git a/tests/Makefile.am b/tests/Makefile.am
> > index 1021954..5367f4d 100644
> > --- a/tests/Makefile.am
> > +++ b/tests/Makefile.am
> > @@ -70,6 +70,7 @@ TEST_MARSHALLERS = \
> > generated_test_marshallers.c \
> > generated_test_marshallers.h \
> > generated_test_demarshallers.c \
> > + generated_test_enums.h \
> > $(NULL)
> >
> > BUILT_SOURCES = $(TEST_MARSHALLERS)
> > @@ -92,6 +93,8 @@ generated_test_marshallers.h:
> > $(srcdir)/test-marshallers.proto $(MARSHALLERS_DEP
> > $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> > --generate-marshallers --server --include test-marshallers.h -H $< $@
> > >/dev/null
> > generated_test_demarshallers.c: $(srcdir)/test-marshallers.proto
> > $(MARSHALLERS_DEPS)
> > $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> > --generate-demarshallers --client --include test-marshallers.h $< $@
> > >/dev/null
> > +generated_test_enums.h: $(srcdir)/test-marshallers.proto
> > $(MARSHALLERS_DEPS)
> > + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py -e $< $@ >/dev/null
> >
> > EXTRA_DIST = \
> > $(TEST_MARSHALLERS) \
> > @@ -100,7 +103,9 @@ EXTRA_DIST = \
> > $(NULL)
> >
> > TESTS += test_overflow
> > -test_overflow_SOURCES = test-overflow.c
> > +test_overflow_SOURCES = test-overflow.c \
> > + $(TEST_MARSHALLERS) \
> > + $(NULL)
> > test_overflow_CFLAGS = \
> > -I$(top_srcdir) \
> > $(GLIB2_CFLAGS) \
> > @@ -109,8 +114,6 @@ test_overflow_CFLAGS = \
> > $(NULL)
> > test_overflow_LDADD = \
> > $(top_builddir)/common/libspice-common.la \
> > - $(top_builddir)/common/libspice-common-server.la \
> > - $(top_builddir)/common/libspice-common-client.la \
> > $(NULL)
> >
> > -include $(top_srcdir)/git.mk
> > diff --git a/tests/meson.build b/tests/meson.build
> > index 94c72c6..38a4bea 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -4,11 +4,6 @@
> > tests = ['test-logging', 'test-region']
> > tests_deps = [spice_common_dep]
> >
> > -if spice_common_generate_code == 'all'
> > - tests += ['test-overflow']
> > - tests_deps += [spice_common_client_dep, spice_common_server_dep]
> > -endif
> > -
> > foreach t : tests
> > name = t.underscorify()
> > exe = executable(name, '@0 at .c'.format(t),
> > @@ -18,27 +13,35 @@ foreach t : tests
> > endforeach
> >
> > #
> > -# test_marshallers
> > +# test_marshallers and test_overflow
> > #
> > test_proto = files('test-marshallers.proto')
> >
> > test_marshallers_sources = ['test-marshallers.c', 'test-marshallers.h']
> > +test_overflow_sources = ['test-overflow.c']
> >
> > targets = [
> > ['test_marshallers', test_proto, 'generated_test_marshallers.c',
> > ['--generate-marshallers', '--server', '--include',
> > 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
> > ['test_marshallers_h', test_proto, 'generated_test_marshallers.h',
> > ['--generate-marshallers', '--server', '--include',
> > 'test-marshallers.h', '-H', '@INPUT@', '@OUTPUT@']],
> > ['test_demarshallers', test_proto, 'generated_test_demarshallers.c',
> > ['--generate-demarshallers', '--client', '--include',
> > 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
> > + ['test_enums_h', test_proto, 'generated_test_enums.h', ['-e',
> > '@INPUT@', '@OUTPUT@']],
> > ]
> >
> > foreach t : targets
> > cmd = [python, spice_codegen] + t[3]
> > - test_marshallers_sources += custom_target(t[0], input: t[1], output :
> > t[2], command: cmd, depend_files : spice_codegen_files)
> > + target = custom_target(t[0], input: t[1], output : t[2], command: cmd,
> > depend_files : spice_codegen_files)
> > + test_marshallers_sources += target
> > + test_overflow_sources += target
> > endforeach
>
> I would rather create a new list of sources that can be used by both
> test_marshallers and test_overflow, like this:
>
I think even better to join the 2 tests... sent a new patch.
> generated_sources = []
>
> foreach t : targes
> generated_sources += custom_target(...)
> endforeach
>
> executable('test_marshallers', ['test_marshallers.c',
> 'test_marshallers.h', generated_sources], ...)
>
> executable('test_overflow', ['test-overflow.c', generated_sources], ...)
>
Frediano
More information about the Spice-devel
mailing list