From 21cd70dfc1a6dc90511bae55a460a3a55461339a Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Wed, 18 Jun 2014 08:43:28 +0200 Subject: qapi script: add event support qapi-event.py will parse the schema and generate qapi-event.c, then the API in qapi-event.c can be used to handle events in qemu code. All API have prefix "qapi_event". The script mainly includes two parts: generate API for each event define, generate an enum type for all defined events. Since in some cases the real emit behavior may change, for example, qemu-img would not send a event, a callback layer is used to control the behavior. As a result, the stubs at compile time can be saved, the binding of block layer code and monitor code will become looser. Signed-off-by: Wenchao Xia Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- tests/Makefile | 2 +- tests/qapi-schema/event-nest-struct.err | 1 + tests/qapi-schema/event-nest-struct.exit | 1 + tests/qapi-schema/event-nest-struct.json | 2 ++ tests/qapi-schema/event-nest-struct.out | 0 5 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/qapi-schema/event-nest-struct.err create mode 100644 tests/qapi-schema/event-nest-struct.exit create mode 100644 tests/qapi-schema/event-nest-struct.json create mode 100644 tests/qapi-schema/event-nest-struct.out (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile index 4caf7deb89..1fa38a18a8 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -199,7 +199,7 @@ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \ include-simple.json include-relpath.json include-format-err.json \ include-non-file.json include-no-file.json include-before-err.json \ include-nested-err.json include-self-cycle.json include-cycle.json \ - include-repetition.json) + include-repetition.json event-nest-struct.json) GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h diff --git a/tests/qapi-schema/event-nest-struct.err b/tests/qapi-schema/event-nest-struct.err new file mode 100644 index 0000000000..e4a0faac9c --- /dev/null +++ b/tests/qapi-schema/event-nest-struct.err @@ -0,0 +1 @@ +tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported now, event 'EVENT_A', argname 'a' diff --git a/tests/qapi-schema/event-nest-struct.exit b/tests/qapi-schema/event-nest-struct.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/event-nest-struct.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/event-nest-struct.json b/tests/qapi-schema/event-nest-struct.json new file mode 100644 index 0000000000..ee6f3ecb6f --- /dev/null +++ b/tests/qapi-schema/event-nest-struct.json @@ -0,0 +1,2 @@ +{ 'event': 'EVENT_A', + 'data': { 'a' : { 'string' : 'str', 'integer': 'int' }, 'b' : 'str' } } diff --git a/tests/qapi-schema/event-nest-struct.out b/tests/qapi-schema/event-nest-struct.out new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3