qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com,
	blauwirbel@gmail.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 26/26] qidl: unit tests and build infrastructure
Date: Thu, 25 Oct 2012 16:37:44 -0500	[thread overview]
Message-ID: <20121025213744.GE16157@illuin> (raw)
In-Reply-To: <20121025212750.GD16157@illuin>

On Thu, Oct 25, 2012 at 04:27:50PM -0500, Michael Roth wrote:
> On Thu, Oct 18, 2012 at 09:42:20PM -0500, Michael Roth wrote:
> > 
> > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > ---
> >  Makefile                     |    3 +
> >  configure                    |    1 +
> >  rules.mak                    |   27 ++-
> >  tests/Makefile               |    8 +-
> >  tests/test-qidl-included.h   |   25 +++
> >  tests/test-qidl-linked.c     |  101 +++++++++++
> >  tests/test-qidl-pub-linked.c |   18 ++
> >  tests/test-qidl-pub-linked.h |   29 ++++
> >  tests/test-qidl.c            |  393 ++++++++++++++++++++++++++++++++++++++++++
> >  tests/test-qidl.h            |   36 ++++
> >  10 files changed, 638 insertions(+), 3 deletions(-)
> >  create mode 100644 tests/test-qidl-included.h
> >  create mode 100644 tests/test-qidl-linked.c
> >  create mode 100644 tests/test-qidl-pub-linked.c
> >  create mode 100644 tests/test-qidl-pub-linked.h
> >  create mode 100644 tests/test-qidl.c
> >  create mode 100644 tests/test-qidl.h
> > 
> > diff --git a/Makefile b/Makefile
> > index da4360f..0332f41 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -236,6 +236,8 @@ clean:
> >  	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
> >  	rm -f $$d/qemu-options.def; \
> >          done
> > +	find -name '*.qidl.c' -exec rm -f {} \;
> > +	find -name '*.qidl.schema' -exec rm -f {} \;
> >  
> >  VERSION ?= $(shell cat VERSION)
> >  
> > @@ -405,6 +407,7 @@ qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
> >  # rebuilt before other object files
> >  Makefile: $(GENERATED_HEADERS)
> >  
> > +
> >  # Include automatically generated dependency files
> >  # Dependencies in Makefile.objs files come from our recursive subdir rules
> >  -include $(wildcard *.d tests/*.d)
> > diff --git a/configure b/configure
> > index 353d788..c547b79 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3235,6 +3235,7 @@ if test "$debug_tcg" = "yes" ; then
> >  fi
> >  if test "$debug" = "yes" ; then
> >    echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
> > +  echo "CONFIG_DEBUG_QIDL=y" >> $config_host_mak
> >  fi
> >  if test "$strip_opt" = "yes" ; then
> >    echo "STRIP=${strip}" >> $config_host_mak
> > diff --git a/rules.mak b/rules.mak
> > index 1b173aa..ce04aeb 100644
> > --- a/rules.mak
> > +++ b/rules.mak
> > @@ -14,8 +14,33 @@ MAKEFLAGS += -rR
> >  # Flags for dependency generation
> >  QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
> >  
> > +# Debug options for QIDL
> > +ifdef CONFIG_DEBUG_QIDL
> > +QIDL_FLAGS = --schema-filepath=$(*D)/$(*F).qidl.schema
> > +endif
> > +
> > +.SECONDARY:
> > +
> >  %.o: %.c
> > -	$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
> > +
> > +%.qidl.c: %.c $(SRC_PATH)/qidl.h $(addprefix $(SRC_PATH)/scripts/,lexer.py qidl.py qidl_parser.py qapi.py qapi_visit.py)
> > +	@rm -f $(*D)/$(*F).qidl.*
> > +	$(if $(strip $(shell grep "QIDL_ENABLE()" $< 1>/dev/null && echo "true")), \
> > +	  $(call quiet-command, \
> > +	    $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(CFLAGS) -E -c -DQIDL_GEN $< | \
> > +	    $(PYTHON) $(SRC_PATH)/scripts/qidl.py $(QIDL_FLAGS) \
> > +	    --output-filepath=$(*D)/$(*F).qidl.c || [ "$$?" -eq 2 ], \
> > +	    "qidl PP $(*D)/$(*F).c"),)
> > +
> > +%.o: %.c %.qidl.c
> > +	$(if $(strip $(shell test -f $(*D)/$(*F).qidl.c && echo "true")), \
> > +	  $(call quiet-command, \
> > +	    $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c \
> > +		-DQIDL_ENABLED -include $< -o $@ $(*D)/$(*F).qidl.c, \
> > +		"qidl CC $@"), \
> > +	  $(call quiet-command, \
> > +	    $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c \
> > +	      -o $@ $<,"  CC    $@"))
> 
> *sigh*, there seems to be a problem here with gcc-generated deps not
> being pulled in for qidl CC'd files:
> 
> mdroth@loki:~/w/qemu-build$ rm -rf * && ../qemu.git/configure
> --target-list=x86_64-softmmu
> 
> mdroth@loki:~/w/qemu-build$ make -j4 && make check
> 
> If you then modify tests/test-qidl.h, which is pulled in by tests/test-qidl.c,
> tests/test-qidl.o and tests/test-qidl are not regenerated. So need to
> look into this more before this can go in.

Actually, ignore this, i needed to run make check not make. But there is
something not quite right I noticed in testing so I need to look at this
more.

> 
> >  
> >  ifeq ($(LIBTOOL),)
> >  %.lo: %.c
> > diff --git a/tests/Makefile b/tests/Makefile
> > index e10aaed..0c8eceb 100644
> > --- a/tests/Makefile
> > +++ b/tests/Makefile
> > @@ -15,6 +15,7 @@ check-unit-y += tests/test-string-output-visitor$(EXESUF)
> >  check-unit-y += tests/test-coroutine$(EXESUF)
> >  check-unit-y += tests/test-visitor-serialization$(EXESUF)
> >  check-unit-y += tests/test-iov$(EXESUF)
> > +check-unit-y += tests/test-qidl$(EXESUF)
> >  
> >  check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
> >  
> > @@ -34,11 +35,12 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
> >  	tests/test-coroutine.o tests/test-string-output-visitor.o \
> >  	tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
> >  	tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
> > -	tests/test-qmp-commands.o tests/test-visitor-serialization.o
> > +	tests/test-qmp-commands.o tests/test-visitor-serialization.o \
> > +	tests/test-qidl.o
> >  
> >  test-qapi-obj-y =  $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y)
> >  test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o
> > -test-qapi-obj-y += module.o
> > +test-qapi-obj-y += module.o $(qom-obj-y)
> >  
> >  $(test-obj-y): QEMU_INCLUDES += -Itests
> >  
> > @@ -84,6 +86,8 @@ check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)
> >  qtest-obj-y = tests/libqtest.o $(oslib-obj-y) $(tools-obj-y)
> >  $(check-qtest-y): $(qtest-obj-y)
> >  
> > +tests/test-qidl$(EXESUF): tests/test-qidl.o tests/test-qidl-linked.o tests/test-qidl-pub-linked.o $(test-qapi-obj-y) qapi/misc-qapi-visit.o
> > +
> >  .PHONY: check-help
> >  check-help:
> >  	@echo "Regression testing targets:"
> > diff --git a/tests/test-qidl-included.h b/tests/test-qidl-included.h
> > new file mode 100644
> > index 0000000..3ee8487
> > --- /dev/null
> > +++ b/tests/test-qidl-included.h
> > @@ -0,0 +1,25 @@
> > +/*
> > + * Unit-tests for QIDL-generated visitors/code
> > + *
> > + * Copyright IBM, Corp. 2012
> > + *
> > + * Authors:
> > + *  Michael Roth <mdroth@linux.vnet.ibm.com>
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> > + * See the COPYING file in the top-level directory.
> > + */
> > +
> > +#ifndef TEST_QIDL_INCLUDED_H
> > +#define TEST_QIDL_INCLUDED_H
> > +
> > +#include "qidl.h"
> > +#include "test-qidl.h"
> > +
> > +typedef struct TestStructIncluded TestStructIncluded;
> > +
> > +QIDL_DECLARE(TestStructIncluded) {
> > +    TEST_QIDL_STRUCT_BODY
> > +};
> > +
> > +#endif
> > diff --git a/tests/test-qidl-linked.c b/tests/test-qidl-linked.c
> > new file mode 100644
> > index 0000000..0499bc1

      reply	other threads:[~2012-10-25 21:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19  2:41 [Qemu-devel] [PATCH v5 00/26] Add infrastructure for QIDL-based device serialization Michael Roth
2012-10-19  2:41 ` [Qemu-devel] [PATCH 01/26] qapi: qapi-visit.py -> qapi_visit.py so we can import Michael Roth
2012-10-19  2:41 ` [Qemu-devel] [PATCH 02/26] qapi: qapi-types.py -> qapi_types.py Michael Roth
2012-10-19  2:41 ` [Qemu-devel] [PATCH 03/26] qapi: qapi-commands.py -> qapi_commands.py Michael Roth
2012-10-19  2:41 ` [Qemu-devel] [PATCH 04/26] qapi: qapi_visit.py, make code useable as module Michael Roth
2012-10-19  2:41 ` [Qemu-devel] [PATCH 05/26] qapi: qapi_visit.py, support arrays and complex qapi definitions Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 06/26] qapi: qapi_visit.py, support generating static functions Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 07/26] qapi: qapi_visit.py, support for visiting non-pointer/embedded structs Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 08/26] qapi: add visitor interfaces for C arrays Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 09/26] qapi: QmpOutputVisitor, implement array handling Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 10/26] qapi: QmpInputVisitor, " Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 11/26] qapi: QmpInputVisitor, don't re-allocate memory in start_struct Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 12/26] qapi: fix potential segfault for visit_type_size() Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 13/26] qapi: ordereddict, add to_json() method Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 14/26] qapi: qapi.py, make json parser more robust Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 15/26] qapi: add open-coded visitor for struct tm types Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 16/26] qapi: Improve existing docs and document annotated QAPI types Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 17/26] qom-fuse: force single-threaded mode to avoid QMP races Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 18/26] qom-fuse: workaround for truncated properties > 4096 Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 19/26] module additions for schema registration Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 20/26] qdev: move Property-related declarations to qdev-properties.h Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 21/26] qidl: add documentation Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 22/26] qidl: add lexer library (based on QC parser) Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 23/26] qidl: add C parser " Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 24/26] qidl: add QAPI-based code generator Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 25/26] qidl: qidl.h, definitions for qidl annotations Michael Roth
2012-10-19  2:42 ` [Qemu-devel] [PATCH 26/26] qidl: unit tests and build infrastructure Michael Roth
2012-10-25 21:27   ` Michael Roth
2012-10-25 21:37     ` Michael Roth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121025213744.GE16157@illuin \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).