Re: [Qemu-devel] [PATCH V5 04/28] test: add test cases for qapi event

2014-05-01 Thread Eric Blake
On 04/30/2014 10:26 PM, Wenchao Xia wrote:
 These cases will verify whether the expected qdict is built.
 
 Signed-off-by: Wenchao Xia wenchaoq...@gmail.com
 ---
  tests/Makefile  |   14 ++-
  tests/qapi-schema/qapi-schema-test.json |   12 ++
  tests/qapi-schema/qapi-schema-test.out  |   10 +-
  tests/test-qmp-event.c  |  265 
 +++
  4 files changed, 296 insertions(+), 5 deletions(-)
  create mode 100644 tests/test-qmp-event.c
 

 @@ -232,12 +236,16 @@ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
 $(SRC_PATH)/scripts/qapi-typ
  tests/test-qapi-visit.c tests/test-qapi-visit.h :\
  $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
 $(SRC_PATH)/scripts/qapi-visit.py
   $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py 
 $(gen-out-type) -o tests -p test-  $,   GEN   $@)
 +tests/test-qapi-event.c tests/test-qapi-event.h :\
 +$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
 $(SRC_PATH)/scripts/qapi-event.py
 + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py 
 $(gen-out-type) -o tests -p test-  $,   GEN   $@)

I'd like to see LluĂ­s' modularization patches go in first, which means
this should be rebased to break into shorter lines and to pass the name
of the file as an input parameter rather than parsing it from stdin.

https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg05069.html

But everything else here seems okay.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH V5 04/28] test: add test cases for qapi event

2014-04-30 Thread Wenchao Xia
These cases will verify whether the expected qdict is built.

Signed-off-by: Wenchao Xia wenchaoq...@gmail.com
---
 tests/Makefile  |   14 ++-
 tests/qapi-schema/qapi-schema-test.json |   12 ++
 tests/qapi-schema/qapi-schema-test.out  |   10 +-
 tests/test-qmp-event.c  |  265 +++
 4 files changed, 296 insertions(+), 5 deletions(-)
 create mode 100644 tests/test-qmp-event.c

diff --git a/tests/Makefile b/tests/Makefile
index e477f14..6daa7e4 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -27,6 +27,8 @@ check-unit-y += tests/test-string-input-visitor$(EXESUF)
 gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
 check-unit-y += tests/test-string-output-visitor$(EXESUF)
 gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
+check-unit-y += tests/test-qmp-event$(EXESUF)
+gcov-files-test-qmp-event-y += qapi/qmp-event.c
 check-unit-y += tests/test-opts-visitor$(EXESUF)
 gcov-files-test-opts-visitor-y = qapi/opts-visitor.c
 check-unit-y += tests/test-coroutine$(EXESUF)
@@ -178,7 +180,8 @@ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
 flat-union-string-discriminator.json \
 event-nest-struct.json)
 
-GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h 
tests/test-qmp-commands.h
+GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h \
+ tests/test-qapi-event.h tests/test-qmp-commands.h
 
 test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
@@ -187,9 +190,10 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o 
tests/check-qdict.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-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
-   tests/test-opts-visitor.o
+   tests/test-opts-visitor.o tests/test-qmp-event.o
 
-test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o
+test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
+  tests/test-qapi-event.o
 
 $(test-obj-y): QEMU_INCLUDES += -Itests
 QEMU_CFLAGS += -I$(SRC_PATH)/tests
@@ -232,12 +236,16 @@ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
$(SRC_PATH)/scripts/qapi-typ
 tests/test-qapi-visit.c tests/test-qapi-visit.h :\
 $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
$(SRC_PATH)/scripts/qapi-visit.py
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py 
$(gen-out-type) -o tests -p test-  $,   GEN   $@)
+tests/test-qapi-event.c tests/test-qapi-event.h :\
+$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
$(SRC_PATH)/scripts/qapi-event.py
+   $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py 
$(gen-out-type) -o tests -p test-  $,   GEN   $@)
 tests/test-qmp-commands.h tests/test-qmp-marshal.c :\
 $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json 
$(SRC_PATH)/scripts/qapi-commands.py
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py 
$(gen-out-type) -o tests -p test-  $,   GEN   $@)
 
 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o 
$(test-qapi-obj-y) libqemuutil.a libqemustub.a
 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o 
$(test-qapi-obj-y) libqemuutil.a libqemustub.a
+tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) 
libqemuutil.a libqemustub.a
 tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o 
$(test-qapi-obj-y) libqemuutil.a libqemustub.a
 tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o 
$(test-qapi-obj-y) libqemuutil.a libqemustub.a
 tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o 
$(test-qapi-obj-y) libqemuutil.a libqemustub.a
diff --git a/tests/qapi-schema/qapi-schema-test.json 
b/tests/qapi-schema/qapi-schema-test.json
index 818c06d..ab4d3d9 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -89,3 +89,15 @@
 '*u16' : [ 'uint16' ],
 '*i64x':   'int' ,
 '*u64x':   'uint64'  } }
+
+# testing event
+{ 'type': 'EventStructOne',
+  'data': { 'struct1': 'UserDefOne', 'string': 'str', '*enum2': 'EnumOne' } }
+
+{ 'event': 'EVENT_A' }
+{ 'event': 'EVENT_B',
+  'data': { } }
+{ 'event': 'EVENT_C',
+  'data': { '*a': 'int', '*b': 'UserDefOne', 'c': 'str' } }
+{ 'event': 'EVENT_D',
+  'data': { 'a' : 'EventStructOne', 'b' : 'str', '*c': 'str', '*enum3': 
'EnumOne' } }
diff --git a/tests/qapi-schema/qapi-schema-test.out 
b/tests/qapi-schema/qapi-schema-test.out
index 6cd03f3..95e9899 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -15,7 +15,12 @@
  OrderedDict([('command', 'user_def_cmd1'), ('data', OrderedDict([('ud1a', 
'UserDefOne')]))]),
  OrderedDict([('command',