summaryrefslogtreecommitdiff
path: root/tests/test-qmp-output-visitor.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-11qapi script: do not allow string discriminatorWenchao Xia1-4/+6
Since enum based discriminators provide better type-safety and ensure that future qapi additions do not forget to adjust dependent unions, forbid using string as discriminator from now on. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-03-03tests/qapi-schema: Cover flat union typesMarkus Armbruster1-0/+31
The test demonstrates a generator bug: the generated struct UserDefFlatUnion doesn't include members for the indirect base UserDefZero. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-03-03tests/qapi-schema: Cover union types with baseMarkus Armbruster1-0/+2
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-03-03tests/qapi-schema: Cover complex types with baseMarkus Armbruster1-4/+8
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-03-03tests/qapi-schema: Cover anonymous union typesMarkus Armbruster1-0/+22
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-02-17Use error_is_set() only when necessaryMarkus Armbruster1-11/+11
error_is_set(&var) is the same as var != NULL, but it takes whole-program analysis to figure that out. Unnecessarily hard for optimizers, static checkers, and human readers. Dumb it down to obvious. Gets rid of several dozen Coverity false positives. Note that the obvious form is already used in many places. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-07-27misc: Use g_assert_not_reached for code which is expected to be unreachableStefan Weil1-2/+2
The macro g_assert_not_reached is a better self documenting replacement for assert(0) or assert(false). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-30qapi: pad GenericList value fields to 64 bitsMichael Roth1-1/+4
With the introduction of native list types, we now have types such as int64List where the 'value' field is not a pointer, but the actual 64-bit value. On 32-bit architectures, this can lead to situations where 'next' field offset in GenericList does not correspond to the 'next' field in the types that we cast to GenericList when using the visit_next_list() interface, causing issues when we attempt to traverse linked list structures of these types. To fix this, pad the 'value' field of GenericList and other schema-defined/native *List types out to 64-bits. This is less memory-efficient for 32-bit architectures, but allows us to continue to rely on list-handling interfaces that target GenericList to simply visitor implementations. In the future we can improve efficiency by defaulting to using native C array backends to handle list of non-pointer types, which would be more memory efficient in itself and allow us to roll back this change. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-23qapi: add native list coverage for QMP output visitor testsMichael Roth1-0/+332
This exercises schema-generated visitors for native list types and does some sanity checking on validity of serialized data. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-12-19qapi: move include files to include/qobject/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move inclusions of qemu-common.h from headers to .c filesPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-03-30test makefile overhaulPaolo Bonzini1-0/+477
This introduces new test reporting infrastructure based on gtester and gtester-report. Also, all existing tests are moved to tests/, and tests/Makefile is reorganized to factor out the commonalities in the rules. Signed-off-by: Anthony Liguori <aliguori@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>