aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore9
-rw-r--r--tests/Makefile.include70
-rw-r--r--tests/qapi-schema/comments.out3
-rw-r--r--tests/qapi-schema/doc-bad-section.out5
-rw-r--r--tests/qapi-schema/doc-good.out33
-rw-r--r--tests/qapi-schema/doc-good.texi3
-rw-r--r--tests/qapi-schema/empty.out2
-rw-r--r--tests/qapi-schema/event-case.out3
-rw-r--r--tests/qapi-schema/ident-with-escape.out7
-rw-r--r--tests/qapi-schema/include-no-file.err2
-rw-r--r--tests/qapi-schema/include-relpath.out7
-rw-r--r--tests/qapi-schema/include-repetition.out12
-rw-r--r--tests/qapi-schema/include-simple.out5
-rw-r--r--tests/qapi-schema/indented-expr.out3
-rw-r--r--tests/qapi-schema/qapi-schema-test.out319
-rw-r--r--tests/qapi-schema/test-qapi.py19
-rw-r--r--tests/qmp-test.c3
-rw-r--r--tests/test-char.c2
-rw-r--r--tests/test-hmp.c2
-rw-r--r--tests/test-qmp-cmds.c (renamed from tests/test-qmp-commands.c)2
-rw-r--r--tests/test-qmp-event.c3
-rw-r--r--tests/test-qobject-input-visitor.c8
-rw-r--r--tests/test-visitor-serialization.c1
23 files changed, 278 insertions, 245 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index e5c744b7ed..18e58b2183 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -60,7 +60,8 @@ test-keyval
test-logging
test-mul64
test-opts-visitor
-test-qapi-event.[ch]
+test-qapi-commands.[ch]
+test-qapi-events.[ch]
test-qapi-types.[ch]
test-qapi-util
test-qapi-visit.[ch]
@@ -70,13 +71,11 @@ test-qdist
test-qga
test-qht
test-qht-par
-test-qmp-commands
-test-qmp-commands.h
+test-qmp-cmds
test-qmp-event
test-qobject-input-strict
test-qobject-input-visitor
-test-qmp-introspect.[ch]
-test-qmp-marshal.c
+test-qapi-introspect.[ch]
test-qobject-output-visitor
test-rcu-list
test-replication
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 937cbd874a..fdca062591 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -23,7 +23,16 @@ check-help:
ifneq ($(wildcard config-host.mak),)
export SRC_PATH
-qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
+# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
+qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \
+$(SRC_PATH)/scripts/qapi/events.py \
+$(SRC_PATH)/scripts/qapi/introspect.py \
+$(SRC_PATH)/scripts/qapi/types.py \
+$(SRC_PATH)/scripts/qapi/visit.py \
+$(SRC_PATH)/scripts/qapi/common.py \
+$(SRC_PATH)/scripts/qapi/doc.py \
+$(SRC_PATH)/scripts/ordereddict.py \
+$(SRC_PATH)/scripts/qapi-gen.py
# Get the list of all supported sysemu targets
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
@@ -52,8 +61,8 @@ check-unit-y += tests/test-clone-visitor$(EXESUF)
gcov-files-test-clone-visitor-y = qapi/qapi-clone-visitor.c
check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
gcov-files-test-qobject-input-visitor-y = qapi/qobject-input-visitor.c
-check-unit-y += tests/test-qmp-commands$(EXESUF)
-gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
+check-unit-y += tests/test-qmp-cmds$(EXESUF)
+gcov-files-test-qmp-cmds-y = qapi/qmp-dispatch.c
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)
@@ -561,8 +570,8 @@ qapi-schema += unknown-expr-key.json
check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
- tests/test-qmp-commands.h tests/test-qapi-event.h \
- tests/test-qmp-introspect.h
+ tests/test-qapi-commands.h tests/test-qapi-events.h \
+ tests/test-qapi-introspect.h
test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
tests/check-qlist.o tests/check-qnull.o tests/check-qobject.o \
@@ -571,7 +580,7 @@ test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
tests/test-string-input-visitor.o tests/test-qobject-output-visitor.o \
tests/test-clone-visitor.o \
tests/test-qobject-input-visitor.o \
- tests/test-qmp-commands.o tests/test-visitor-serialization.o \
+ tests/test-qmp-cmds.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-qmp-event.o \
tests/rcutorture.o tests/test-rcu-list.o \
@@ -587,7 +596,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests
test-util-obj-y = libqemuutil.a
test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
- tests/test-qapi-event.o tests/test-qmp-introspect.o \
+ tests/test-qapi-events.o tests/test-qapi-introspect.o \
$(test-qom-obj-y)
benchmark-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
test-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
@@ -649,34 +658,24 @@ tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
$(test-block-obj-y)
-tests/test-qapi-types.c tests/test-qapi-types.h :\
-$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
- $(gen-out-type) -o tests -p "test-" $<, \
+tests/test-qapi-types.c tests/test-qapi-types.h \
+tests/test-qapi-visit.c tests/test-qapi-visit.h \
+tests/test-qapi-commands.h tests/test-qapi-commands.c \
+tests/test-qapi-events.c tests/test-qapi-events.h \
+tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
+tests/test-qapi-gen-timestamp ;
+tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
+ -o tests -p "test-" $<, \
+ "GEN","$(@:%-timestamp=%)")
+ @>$@
+
+tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
+ -o tests/qapi-schema -p "doc-good-" $<, \
"GEN","$@")
-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 $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.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 $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.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 $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
- $(gen-out-type) -o tests -p "test-" $<, \
- "GEN","$@")
-tests/test-qmp-introspect.c tests/test-qmp-introspect.h :\
-$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
- $(gen-out-type) -o tests -p "test-" $<, \
- "GEN","$@")
-
-tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
+ @mv tests/qapi-schema/doc-good-qapi-doc.texi $@
+ @rm -f tests/qapi-schema/doc-good-qapi-*.[ch] tests/qapi-schema/doc-good-qmp-*.[ch]
tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
@@ -684,7 +683,7 @@ tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
+tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o $(test-qapi-obj-y)
tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
@@ -954,6 +953,7 @@ check-clean:
$(MAKE) -C tests/tcg clean
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
+ rm -f tests/test-qapi-gen-timestamp
clean: check-clean
diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out
index 17e652535c..8d2f1ce8a2 100644
--- a/tests/qapi-schema/comments.out
+++ b/tests/qapi-schema/comments.out
@@ -1,4 +1,5 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module comments.json
enum Status ['good', 'bad', 'ugly']
-object q_empty
diff --git a/tests/qapi-schema/doc-bad-section.out b/tests/qapi-schema/doc-bad-section.out
index 089bde1381..cd28721568 100644
--- a/tests/qapi-schema/doc-bad-section.out
+++ b/tests/qapi-schema/doc-bad-section.out
@@ -1,7 +1,8 @@
-enum Enum ['one', 'two']
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
-object q_empty
+module doc-bad-section.json
+enum Enum ['one', 'two']
doc symbol=Enum
body=
== Produces *invalid* texinfo
diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out
index 1d2c250527..430b5a87db 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -1,35 +1,36 @@
+object q_empty
+enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
+ prefix QTYPE
+module doc-good.json
+enum Enum ['one', 'two']
object Base
member base1: Enum optional=False
-enum Enum ['one', 'two']
+object Variant1
+ member var1: str optional=False
+object Variant2
object Object
base Base
tag base1
case one: Variant1
case two: Variant2
-enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
- prefix QTYPE
+object q_obj_Variant1-wrapper
+ member data: Variant1 optional=False
+object q_obj_Variant2-wrapper
+ member data: Variant2 optional=False
+enum SugaredUnionKind ['one', 'two']
object SugaredUnion
member type: SugaredUnionKind optional=False
tag type
case one: q_obj_Variant1-wrapper
case two: q_obj_Variant2-wrapper
-enum SugaredUnionKind ['one', 'two']
-object Variant1
- member var1: str optional=False
-object Variant2
-command cmd q_obj_cmd-arg -> Object
- gen=True success_response=True boxed=False
-command cmd-boxed Object -> None
- gen=True success_response=True boxed=True
-object q_empty
-object q_obj_Variant1-wrapper
- member data: Variant1 optional=False
-object q_obj_Variant2-wrapper
- member data: Variant2 optional=False
object q_obj_cmd-arg
member arg1: int optional=False
member arg2: str optional=True
member arg3: bool optional=False
+command cmd q_obj_cmd-arg -> Object
+ gen=True success_response=True boxed=False
+command cmd-boxed Object -> None
+ gen=True success_response=True boxed=True
doc freeform
body=
= Section
diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi
index 1778312581..0aed2300a5 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -1,3 +1,5 @@
+@c AUTOMATICALLY GENERATED, DO NOT MODIFY
+
@section Section
@subsection Subsection
@@ -231,4 +233,3 @@ If you're bored enough to read this, go see a video of boxed cats
@end deftypefn
-
diff --git a/tests/qapi-schema/empty.out b/tests/qapi-schema/empty.out
index 40b886ddae..0ec234eec4 100644
--- a/tests/qapi-schema/empty.out
+++ b/tests/qapi-schema/empty.out
@@ -1,3 +1,3 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
-object q_empty
diff --git a/tests/qapi-schema/event-case.out b/tests/qapi-schema/event-case.out
index 313c0fe7be..88c0964917 100644
--- a/tests/qapi-schema/event-case.out
+++ b/tests/qapi-schema/event-case.out
@@ -1,5 +1,6 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module event-case.json
event oops None
boxed=False
-object q_empty
diff --git a/tests/qapi-schema/ident-with-escape.out b/tests/qapi-schema/ident-with-escape.out
index b5637cb2e0..ee3b34e623 100644
--- a/tests/qapi-schema/ident-with-escape.out
+++ b/tests/qapi-schema/ident-with-escape.out
@@ -1,7 +1,8 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
-command fooA q_obj_fooA-arg -> None
- gen=True success_response=True boxed=False
-object q_empty
+module ident-with-escape.json
object q_obj_fooA-arg
member bar1: str optional=False
+command fooA q_obj_fooA-arg -> None
+ gen=True success_response=True boxed=False
diff --git a/tests/qapi-schema/include-no-file.err b/tests/qapi-schema/include-no-file.err
index d5b9b22d85..e42bcf4bc1 100644
--- a/tests/qapi-schema/include-no-file.err
+++ b/tests/qapi-schema/include-no-file.err
@@ -1 +1 @@
-tests/qapi-schema/include-no-file.json:1: No such file or directory: include-no-file-sub.json
+tests/qapi-schema/include-no-file.json:1: No such file or directory: tests/qapi-schema/include-no-file-sub.json
diff --git a/tests/qapi-schema/include-relpath.out b/tests/qapi-schema/include-relpath.out
index 17e652535c..ebbabd7a18 100644
--- a/tests/qapi-schema/include-relpath.out
+++ b/tests/qapi-schema/include-relpath.out
@@ -1,4 +1,9 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module include-relpath.json
+include include/relpath.json
+module include/relpath.json
+include include-relpath-sub.json
+module include-relpath-sub.json
enum Status ['good', 'bad', 'ugly']
-object q_empty
diff --git a/tests/qapi-schema/include-repetition.out b/tests/qapi-schema/include-repetition.out
index 17e652535c..7235e055bc 100644
--- a/tests/qapi-schema/include-repetition.out
+++ b/tests/qapi-schema/include-repetition.out
@@ -1,4 +1,14 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module include-repetition.json
+include comments.json
+module comments.json
enum Status ['good', 'bad', 'ugly']
-object q_empty
+module include-repetition.json
+include include-repetition-sub.json
+module include-repetition-sub.json
+include comments.json
+include comments.json
+module include-repetition.json
+include comments.json
diff --git a/tests/qapi-schema/include-simple.out b/tests/qapi-schema/include-simple.out
index 17e652535c..006f723eeb 100644
--- a/tests/qapi-schema/include-simple.out
+++ b/tests/qapi-schema/include-simple.out
@@ -1,4 +1,7 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module include-simple.json
+include include-simple-sub.json
+module include-simple-sub.json
enum Status ['good', 'bad', 'ugly']
-object q_empty
diff --git a/tests/qapi-schema/indented-expr.out b/tests/qapi-schema/indented-expr.out
index 586795f44d..a79935e8c3 100644
--- a/tests/qapi-schema/indented-expr.out
+++ b/tests/qapi-schema/indented-expr.out
@@ -1,7 +1,8 @@
+object q_empty
enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
+module indented-expr.json
command eins None -> None
gen=True success_response=True boxed=False
-object q_empty
command zwei None -> None
gen=True success_response=True boxed=False
diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
index 3b1e9082d3..012e7fc06a 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -1,87 +1,130 @@
-alternate AltEnumBool
- tag type
- case e: EnumOne
- case b: bool
-alternate AltEnumInt
- tag type
- case e: EnumOne
- case i: int
-alternate AltEnumNum
- tag type
- case e: EnumOne
- case n: number
-alternate AltNumEnum
- tag type
- case n: number
- case e: EnumOne
-alternate AltStrObj
- tag type
- case s: str
- case o: TestStruct
-event EVENT_A None
- boxed=False
-event EVENT_B None
- boxed=False
-event EVENT_C q_obj_EVENT_C-arg
- boxed=False
-event EVENT_D q_obj_EVENT_D-arg
- boxed=False
-event EVENT_E UserDefZero
- boxed=True
-event EVENT_F UserDefAlternate
- boxed=True
-object Empty1
-object Empty2
- base Empty1
-enum EnumOne ['value1', 'value2', 'value3']
-object EventStructOne
- member struct1: UserDefOne optional=False
+object q_empty
+enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
+ prefix QTYPE
+module qapi-schema-test.json
+object TestStruct
+ member integer: int optional=False
+ member boolean: bool optional=False
member string: str optional=False
- member enum2: EnumOne optional=True
-object ForceArrays
- member unused1: UserDefOneList optional=False
- member unused2: UserDefTwoList optional=False
- member unused3: TestStructList optional=False
-enum MyEnum []
object NestedEnumsOne
member enum1: EnumOne optional=False
member enum2: EnumOne optional=True
member enum3: EnumOne optional=False
member enum4: EnumOne optional=True
+enum MyEnum []
+object Empty1
+object Empty2
+ base Empty1
+command user_def_cmd0 Empty2 -> Empty2
+ gen=True success_response=True boxed=False
enum QEnumTwo ['value1', 'value2']
prefix QENUM_TWO
-enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
- prefix QTYPE
-object TestStruct
+object UserDefOne
+ base UserDefZero
+ member string: str optional=False
+ member enum1: EnumOne optional=True
+enum EnumOne ['value1', 'value2', 'value3']
+object UserDefZero
member integer: int optional=False
- member boolean: bool optional=False
+object UserDefTwoDictDict
+ member userdef: UserDefOne optional=False
member string: str optional=False
+object UserDefTwoDict
+ member string1: str optional=False
+ member dict2: UserDefTwoDictDict optional=False
+ member dict3: UserDefTwoDictDict optional=True
+object UserDefTwo
+ member string0: str optional=False
+ member dict1: UserDefTwoDict optional=False
+object ForceArrays
+ member unused1: UserDefOneList optional=False
+ member unused2: UserDefTwoList optional=False
+ member unused3: TestStructList optional=False
object UserDefA
member boolean: bool optional=False
member a_b: int optional=True
-alternate UserDefAlternate
- tag type
- case udfu: UserDefFlatUnion
- case e: EnumOne
- case i: int
- case n: null
object UserDefB
member intb: int optional=False
member a-b: bool optional=True
-object UserDefC
- member string1: str optional=False
- member string2: str optional=False
object UserDefFlatUnion
base UserDefUnionBase
tag enum1
case value1: UserDefA
case value2: UserDefB
case value3: UserDefB
+object UserDefUnionBase
+ base UserDefZero
+ member string: str optional=False
+ member enum1: EnumOne optional=False
+object q_obj_UserDefFlatUnion2-base
+ member integer: int optional=True
+ member string: str optional=False
+ member enum1: QEnumTwo optional=False
object UserDefFlatUnion2
base q_obj_UserDefFlatUnion2-base
tag enum1
case value1: UserDefC
case value2: UserDefB
+object WrapAlternate
+ member alt: UserDefAlternate optional=False
+alternate UserDefAlternate
+ tag type
+ case udfu: UserDefFlatUnion
+ case e: EnumOne
+ case i: int
+ case n: null
+object UserDefC
+ member string1: str optional=False
+ member string2: str optional=False
+alternate AltEnumBool
+ tag type
+ case e: EnumOne
+ case b: bool
+alternate AltEnumNum
+ tag type
+ case e: EnumOne
+ case n: number
+alternate AltNumEnum
+ tag type
+ case n: number
+ case e: EnumOne
+alternate AltEnumInt
+ tag type
+ case e: EnumOne
+ case i: int
+alternate AltStrObj
+ tag type
+ case s: str
+ case o: TestStruct
+object q_obj_intList-wrapper
+ member data: intList optional=False
+object q_obj_int8List-wrapper
+ member data: int8List optional=False
+object q_obj_int16List-wrapper
+ member data: int16List optional=False
+object q_obj_int32List-wrapper
+ member data: int32List optional=False
+object q_obj_int64List-wrapper
+ member data: int64List optional=False
+object q_obj_uint8List-wrapper
+ member data: uint8List optional=False
+object q_obj_uint16List-wrapper
+ member data: uint16List optional=False
+object q_obj_uint32List-wrapper
+ member data: uint32List optional=False
+object q_obj_uint64List-wrapper
+ member data: uint64List optional=False
+object q_obj_numberList-wrapper
+ member data: numberList optional=False
+object q_obj_boolList-wrapper
+ member data: boolList optional=False
+object q_obj_strList-wrapper
+ member data: strList optional=False
+object q_obj_sizeList-wrapper
+ member data: sizeList optional=False
+object q_obj_anyList-wrapper
+ member data: anyList optional=False
+enum UserDefNativeListUnionKind ['integer', 's8', 's16', 's32', 's64', 'u8', 'u16', 'u32', 'u64', 'number', 'boolean', 'string', 'sizes', 'any']
object UserDefNativeListUnion
member type: UserDefNativeListUnionKind optional=False
tag type
@@ -99,133 +142,91 @@ object UserDefNativeListUnion
case string: q_obj_strList-wrapper
case sizes: q_obj_sizeList-wrapper
case any: q_obj_anyList-wrapper
-enum UserDefNativeListUnionKind ['integer', 's8', 's16', 's32', 's64', 'u8', 'u16', 'u32', 'u64', 'number', 'boolean', 'string', 'sizes', 'any']
-object UserDefOne
- base UserDefZero
- member string: str optional=False
- member enum1: EnumOne optional=True
+command user_def_cmd None -> None
+ gen=True success_response=True boxed=False
+object q_obj_user_def_cmd1-arg
+ member ud1a: UserDefOne optional=False
+command user_def_cmd1 q_obj_user_def_cmd1-arg -> None
+ gen=True success_response=True boxed=False
+object q_obj_user_def_cmd2-arg
+ member ud1a: UserDefOne optional=False
+ member ud1b: UserDefOne optional=True
+command user_def_cmd2 q_obj_user_def_cmd2-arg -> UserDefTwo
+ gen=True success_response=True boxed=False
+object q_obj_guest-get-time-arg
+ member a: int optional=False
+ member b: int optional=True
+command guest-get-time q_obj_guest-get-time-arg -> int
+ gen=True success_response=True boxed=False
+object q_obj_guest-sync-arg
+ member arg: any optional=False
+command guest-sync q_obj_guest-sync-arg -> any
+ gen=True success_response=True boxed=False
+command boxed-struct UserDefZero -> None
+ gen=True success_response=True boxed=True
+command boxed-union UserDefNativeListUnion -> None
+ gen=True success_response=True boxed=True
object UserDefOptions
member i64: intList optional=True
member u64: uint64List optional=True
member u16: uint16List optional=True
member i64x: int optional=True
member u64x: uint64 optional=True
-object UserDefTwo
- member string0: str optional=False
- member dict1: UserDefTwoDict optional=False
-object UserDefTwoDict
- member string1: str optional=False
- member dict2: UserDefTwoDictDict optional=False
- member dict3: UserDefTwoDictDict optional=True
-object UserDefTwoDictDict
- member userdef: UserDefOne optional=False
- member string: str optional=False
-object UserDefUnionBase
- base UserDefZero
+object EventStructOne
+ member struct1: UserDefOne optional=False
member string: str optional=False
- member enum1: EnumOne optional=False
-object UserDefZero
- member integer: int optional=False
-object WrapAlternate
- member alt: UserDefAlternate optional=False
-event __ORG.QEMU_X-EVENT __org.qemu_x-Struct
+ member enum2: EnumOne optional=True
+event EVENT_A None
boxed=False
-alternate __org.qemu_x-Alt
- tag type
- case __org.qemu_x-branch: str
- case b: __org.qemu_x-Base
+event EVENT_B None
+ boxed=False
+object q_obj_EVENT_C-arg
+ member a: int optional=True
+ member b: UserDefOne optional=True
+ member c: str optional=False
+event EVENT_C q_obj_EVENT_C-arg
+ boxed=False
+object q_obj_EVENT_D-arg
+ member a: EventStructOne optional=False
+ member b: str optional=False
+ member c: str optional=True
+ member enum3: EnumOne optional=True
+event EVENT_D q_obj_EVENT_D-arg
+ boxed=False
+event EVENT_E UserDefZero
+ boxed=True
+event EVENT_F UserDefAlternate
+ boxed=True
+enum __org.qemu_x-Enum ['__org.qemu_x-value']
object __org.qemu_x-Base
member __org.qemu_x-member1: __org.qemu_x-Enum optional=False
-enum __org.qemu_x-Enum ['__org.qemu_x-value']
object __org.qemu_x-Struct
base __org.qemu_x-Base
member __org.qemu_x-member2: str optional=False
member wchar-t: int optional=True
-object __org.qemu_x-Struct2
- member array: __org.qemu_x-Union1List optional=False
+object q_obj_str-wrapper
+ member data: str optional=False
+enum __org.qemu_x-Union1Kind ['__org.qemu_x-branch']
object __org.qemu_x-Union1
member type: __org.qemu_x-Union1Kind optional=False
tag type
case __org.qemu_x-branch: q_obj_str-wrapper
-enum __org.qemu_x-Union1Kind ['__org.qemu_x-branch']
+object __org.qemu_x-Struct2
+ member array: __org.qemu_x-Union1List optional=False
object __org.qemu_x-Union2
base __org.qemu_x-Base
tag __org.qemu_x-member1
case __org.qemu_x-value: __org.qemu_x-Struct2
-command __org.qemu_x-command q_obj___org.qemu_x-command-arg -> __org.qemu_x-Union1
- gen=True success_response=True boxed=False
-command boxed-struct UserDefZero -> None
- gen=True success_response=True boxed=True
-command boxed-union UserDefNativeListUnion -> None
- gen=True success_response=True boxed=True
-command guest-get-time q_obj_guest-get-time-arg -> int
- gen=True success_response=True boxed=False
-command guest-sync q_obj_guest-sync-arg -> any
- gen=True success_response=True boxed=False
-object q_empty
-object q_obj_EVENT_C-arg
- member a: int optional=True
- member b: UserDefOne optional=True
- member c: str optional=False
-object q_obj_EVENT_D-arg
- member a: EventStructOne optional=False
- member b: str optional=False
- member c: str optional=True
- member enum3: EnumOne optional=True
-object q_obj_UserDefFlatUnion2-base
- member integer: int optional=True
- member string: str optional=False
- member enum1: QEnumTwo optional=False
+alternate __org.qemu_x-Alt
+ tag type
+ case __org.qemu_x-branch: str
+ case b: __org.qemu_x-Base
+event __ORG.QEMU_X-EVENT __org.qemu_x-Struct
+ boxed=False
object q_obj___org.qemu_x-command-arg
member a: __org.qemu_x-EnumList optional=False
member b: __org.qemu_x-StructList optional=False
member c: __org.qemu_x-Union2 optional=False
member d: __org.qemu_x-Alt optional=False
-object q_obj_anyList-wrapper
- member data: anyList optional=False
-object q_obj_boolList-wrapper
- member data: boolList optional=False
-object q_obj_guest-get-time-arg
- member a: int optional=False
- member b: int optional=True
-object q_obj_guest-sync-arg
- member arg: any optional=False
-object q_obj_int16List-wrapper
- member data: int16List optional=False
-object q_obj_int32List-wrapper
- member data: int32List optional=False
-object q_obj_int64List-wrapper
- member data: int64List optional=False
-object q_obj_int8List-wrapper
- member data: int8List optional=False
-object q_obj_intList-wrapper
- member data: intList optional=False
-object q_obj_numberList-wrapper
- member data: numberList optional=False
-object q_obj_sizeList-wrapper
- member data: sizeList optional=False
-object q_obj_str-wrapper
- member data: str optional=False
-object q_obj_strList-wrapper
- member data: strList optional=False
-object q_obj_uint16List-wrapper
- member data: uint16List optional=False
-object q_obj_uint32List-wrapper
- member data: uint32List optional=False
-object q_obj_uint64List-wrapper
- member data: uint64List optional=False
-object q_obj_uint8List-wrapper
- member data: uint8List optional=False
-object q_obj_user_def_cmd1-arg
- member ud1a: UserDefOne optional=False
-object q_obj_user_def_cmd2-arg
- member ud1a: UserDefOne optional=False
- member ud1b: UserDefOne optional=True
-command user_def_cmd None -> None
- gen=True success_response=True boxed=False
-command user_def_cmd0 Empty2 -> Empty2
- gen=True success_response=True boxed=False
-command user_def_cmd1 q_obj_user_def_cmd1-arg -> None
- gen=True success_response=True boxed=False
-command user_def_cmd2 q_obj_user_def_cmd2-arg -> UserDefTwo
+command __org.qemu_x-command q_obj___org.qemu_x-command-arg -> __org.qemu_x-Union1
gen=True success_response=True boxed=False
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index ac43d3458e..67e417e298 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -11,13 +11,18 @@
#
from __future__ import print_function
-from qapi import *
-from pprint import pprint
-import os
import sys
+from qapi.common import QAPIError, QAPISchema, QAPISchemaVisitor
class QAPISchemaTestVisitor(QAPISchemaVisitor):
+
+ def visit_module(self, name):
+ print('module %s' % name)
+
+ def visit_include(self, name, info):
+ print('include %s' % name)
+
def visit_enum_type(self, name, info, values, prefix):
print('enum %s %s' % (name, values))
if prefix:
@@ -54,7 +59,13 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
for v in variants.variants:
print(' case %s: %s' % (v.name, v.type.name))
-schema = QAPISchema(sys.argv[1])
+
+try:
+ schema = QAPISchema(sys.argv[1])
+except QAPIError as err:
+ print(err, file=sys.stderr)
+ exit(1)
+
schema.visit(QAPISchemaTestVisitor())
for doc in schema.docs:
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index 580848307a..22445d9ec2 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -12,8 +12,9 @@
#include "qemu/osdep.h"
#include "libqtest.h"
-#include "qapi-visit.h"
#include "qapi/error.h"
+#include "qapi/qapi-visit-introspect.h"
+#include "qapi/qapi-visit-misc.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qlist.h"
#include "qapi/qobject-input-visitor.h"
diff --git a/tests/test-char.c b/tests/test-char.c
index b358620911..b3a77af085 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -8,9 +8,9 @@
#include "chardev/char-mux.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
+#include "qapi/qapi-commands-char.h"
#include "qapi/qmp/qdict.h"
#include "qom/qom-qobject.h"
-#include "qmp-commands.h"
static bool quit;
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 5b7e447b6a..5352c9c088 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -37,10 +37,8 @@ static const char *hmp_cmds[] = {
"dump-guest-memory /dev/null 0 4096",
"dump-guest-memory /dev/null",
"gdbserver",
- "host_net_add user id=net0",
"hostfwd_add tcp::43210-:43210",
"hostfwd_remove tcp::43210-:43210",
- "host_net_remove 0 net0",
"i /w 0",
"log all",
"log none",
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-cmds.c
index 24660d0868..5b1cee6912 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-cmds.c
@@ -3,12 +3,12 @@
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
-#include "test-qmp-commands.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qapi/qobject-input-visitor.h"
#include "tests/test-qapi-types.h"
#include "tests/test-qapi-visit.h"
+#include "test-qapi-commands.h"
static QmpCommandList qmp_commands;
diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
index 8012341343..31f35b3e66 100644
--- a/tests/test-qmp-event.c
+++ b/tests/test-qmp-event.c
@@ -14,14 +14,13 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "test-qapi-visit.h"
-#include "test-qapi-event.h"
#include "qapi/error.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
#include "qapi/qmp-event.h"
+#include "test-qapi-events.h"
typedef struct TestEventData {
QDict *expect;
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 3900be2610..79b1a8cb17 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -15,6 +15,7 @@
#include "qemu-common.h"
#include "qapi/error.h"
+#include "qapi/qapi-visit-introspect.h"
#include "qapi/qobject-input-visitor.h"
#include "test-qapi-visit.h"
#include "qapi/qmp/qbool.h"
@@ -23,9 +24,8 @@
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
#include "qapi/qmp/qjson.h"
-#include "test-qmp-introspect.h"
-#include "qmp-introspect.h"
-#include "qapi-visit.h"
+#include "test-qapi-introspect.h"
+#include "qapi/qapi-introspect.h"
typedef struct TestInputVisitorData {
QObject *obj;
@@ -1376,7 +1376,7 @@ int main(int argc, char **argv)
NULL, test_visitor_in_fail_alternate);
input_visitor_test_add("/visitor/input/fail/union-native-list",
NULL, test_visitor_in_fail_union_native_list);
- input_visitor_test_add("/visitor/input/qmp-introspect",
+ input_visitor_test_add("/visitor/input/qapi-introspect",
NULL, test_visitor_in_qmp_introspect);
g_test_run();
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index dd7e51d4f5..438c18a0d6 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -23,7 +23,6 @@
#include "qapi/qobject-output-visitor.h"
#include "qapi/string-input-visitor.h"
#include "qapi/string-output-visitor.h"
-#include "qapi-visit.h"
#include "qapi/dealloc-visitor.h"
enum PrimitiveTypeKind {