summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-05-04 09:05:19 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-05-05 18:39:01 +0200
commitd708cdbe8792a55f53e90c1c787e871d527e8d4b (patch)
tree9728fa21413b9a9ec3360db47593e920d2aa6bec /scripts
parente53188ada516c814a729551be2448684d6d8ce08 (diff)
downloadqemu-d708cdbe8792a55f53e90c1c787e871d527e8d4b.tar.gz
qemu-d708cdbe8792a55f53e90c1c787e871d527e8d4b.tar.bz2
qemu-d708cdbe8792a55f53e90c1c787e871d527e8d4b.zip
qapi: Unify type bypass and add tests
For a few QMP commands, we are forced to pass an arbitrary type without tracking it properly in QAPI. Among the existing clients, this unnamed type was spelled 'dict', 'visitor', and '**'; this patch standardizes on '**', matching the documentation changes earlier in the series. Meanwhile, for the 'gen' key, we have been ignoring the value, although the schema consistently used "'no'" ('success-response' was hard-coded to checking for 'no'). But now that we can support a literal "false" in the schema, we might as well use that rather than ignoring the value or special-casing a random string. Note that these are one-way switches (use of 'gen':true is not the same as omitting 'gen'). Also, the use of '**' requires 'gen':false, but the use of 'gen':false does not mandate the use of '**'. There is no difference to the generated code. Add some tests on what we'd like to guarantee, although it will take later patches to clean up test results and actually enforce the use of a bool parameter. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-commands.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 053ba85b5f..cb786825ee 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -2,7 +2,7 @@
# QAPI command marshaller generator
#
# Copyright IBM, Corp. 2011
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014-2015 Red Hat, Inc.
#
# Authors:
# Anthony Liguori <aliguori@us.ibm.com>
@@ -293,17 +293,12 @@ out:
return ret
-def option_value_matches(opt, val, cmd):
- if opt in cmd and cmd[opt] == val:
- return True
- return False
-
def gen_registry(commands):
registry=""
push_indent()
for cmd in commands:
options = 'QCO_NO_OPTIONS'
- if option_value_matches('success-response', 'no', cmd):
+ if not cmd.get('success-response', True):
options = 'QCO_NO_SUCCESS_RESP'
registry += mcgen('''