|
From: | Wenchao Xia |
Subject: | Re: [Qemu-devel] [PATCH RFC 3/3] tests: add test cases for qapi event support |
Date: | Mon, 16 Dec 2013 11:12:50 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
于 2013/12/16 10:55, Wenchao Xia 写道:
于 2013/12/13 21:36, Eric Blake 写道:On 11/12/2013 06:44 PM, Wenchao Xia wrote:Signed-off-by: Wenchao Xia <address@hidden> ---+++ b/tests/qapi-schema/qapi-schema-test.json @@ -93,3 +93,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': { } }Do we really have events with no associated information (the mere name of the event carrying the full data?)I guess EVENT_SHUDDOWN is one example, that have no associated info, except time stamp.
I think you questioned why EVENT_B is needed? I added it before to allow that, both define can work.
+{ 'event': 'EVENT_C', + 'data': { '*a': 'int', '*b': 'UserDefOne', 'c': 'str' } } +{ 'event': 'EVENT_D', + 'data': { 'a' : 'EventStructOne', 'b' : 'str', '*c': 'str', '*enum3': 'EnumOne' } }Looks like reasonable support for encoding existing events.+ OrderedDict([('event', 'EVENT_A')]), + OrderedDict([('event', 'EVENT_B'), ('data', OrderedDict())]),Shouldn't the omission of 'data' be the same as 'data':{}?I didn't touch the "{ }" parsing part, maybe an existing parsing style, will check it.+++ b/tests/test-qmp-event.c @@ -0,0 +1,250 @@ +/* + * QMP Input Visitor unit-tests. + * + * Copyright (C) 2011 Red Hat Inc.Unusual choice of copyright year and ownership.yep, will fix.
[Prev in Thread] | Current Thread | [Next in Thread] |