From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug
Date: Fri, 21 Dec 2012 13:40:09 +0100 [thread overview]
Message-ID: <50D458A9.2060705@redhat.com> (raw)
In-Reply-To: <50D4534F.9000107@redhat.com>
Il 21/12/2012 13:17, Gerd Hoffmann ha scritto:
> { 'type': 'ChardevDummy', 'data': { } }
>
> { 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile',
> 'port' : 'ChardevPort',
> 'socket' : 'ChardevSocket',
> 'pty' : 'ChardevDummy',
> 'null' : 'ChardevDummy' } }
>
> { 'command': 'chardev-add', 'data': {'id' : 'str',
> 'backend' : 'ChardevBackend' },
>
> ... should accept ...
>
> {'id': 'test-null', 'backend': {'data': {}, 'type': 'null'}}
>
> ... as parameters for chardev-add, no? But I get back ...
>
> {u'error': {u'class': u'GenericError', u'desc': u"Invalid parameter
> 'backend'"}}
>
> ... and can't see what is wrong there ...
Me neither, but this quick test seems to work here:
$ tests/test-qmp-commands
/gerd: test-null 1
OK
diff --git a/qapi-schema-test.json b/qapi-schema-test.json
index 9eae350..c2e9316 100644
--- a/qapi-schema-test.json
+++ b/qapi-schema-test.json
@@ -36,3 +36,12 @@
{ 'command': 'user_def_cmd', 'data': {} }
{ 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} }
{ 'command': 'user_def_cmd2', 'data': {'ud1a': 'UserDefOne', 'ud1b': 'UserDefOne'}, 'returns': 'UserDefTwo' }
+
+
+{ 'type': 'ChardevDummy', 'data': { } }
+
+{ 'union': 'ChardevBackend', 'data': { 'pty' : 'ChardevDummy',
+ 'null' : 'ChardevDummy' } }
+
+{ 'command': 'chardev-add', 'data': {'id' : 'str',
+ 'backend' : 'ChardevBackend' } }
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index 5a3e82a..96396db 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -55,6 +55,11 @@ static void test_dispatch_cmd(void)
QDECREF(req);
}
+void qmp_chardev_add(const char *id, ChardevBackend *backend, Error **errp)
+{
+ printf("%s %d\n", id, backend->kind);
+}
+
/* test commands that return an error due to invalid parameters */
static void test_dispatch_cmd_error(void)
{
@@ -71,6 +76,20 @@ static void test_dispatch_cmd_error(void)
QDECREF(req);
}
+static void test_dispatch_gerd(void)
+{
+ QObject *req = qobject_from_json(
+ "{'execute': 'chardev-add', "
+ " 'arguments': {'id': 'test-null', "
+ " 'backend': {'data': {}, 'type': 'null'}}} ");
+ QObject *resp = qmp_dispatch(req);
+ assert(resp != NULL);
+ assert(!qdict_haskey(qobject_to_qdict(resp), "error"));
+
+ qobject_decref(resp);
+ qobject_decref(req);
+}
+
/* test commands that involve both input parameters and return values */
static void test_dispatch_cmd_io(void)
{
@@ -174,6 +193,7 @@ int main(int argc, char **argv)
g_test_add_func("/0.15/dispatch_cmd_io", test_dispatch_cmd_io);
g_test_add_func("/0.15/dealloc_types", test_dealloc_types);
g_test_add_func("/0.15/dealloc_partial", test_dealloc_partial);
+ g_test_add_func("/gerd", test_dispatch_gerd);
module_call_init(MODULE_INIT_QAPI);
g_test_run();
Paolo
next prev parent reply other threads:[~2012-12-21 12:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 15:58 [Qemu-devel] [PATCH RfC 0/9] chardev hotplug Gerd Hoffmann
2012-12-19 15:58 ` [Qemu-devel] [PATCH 1/9] chardev: add error reporting for qemu_chr_new_from_opts Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 2/9] chardev: fix QemuOpts lifecycle Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 3/9] chardev: reduce chardev ifdef mess a bit Gerd Hoffmann
2012-12-19 20:04 ` Blue Swirl
2012-12-19 15:59 ` [Qemu-devel] [PATCH 4/9] chardev: hotplug, qmp, null Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 5/9] chardev: hotplug, hmp Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 6/9] chardev: hotplug, qmp, file Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 7/9] chardev: hotplug, qmp, tty Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 8/9] chardev: hotplug, qmp, serial Gerd Hoffmann
2012-12-19 16:21 ` Paolo Bonzini
2012-12-20 7:09 ` Gerd Hoffmann
2012-12-19 15:59 ` [Qemu-devel] [PATCH 9/9] chardev: hotplug, qmp, parallel Gerd Hoffmann
2012-12-20 10:49 ` [Qemu-devel] [PATCH RfC 0/9] chardev hotplug Michal Privoznik
2012-12-20 10:56 ` Daniel P. Berrange
2012-12-20 11:10 ` Paolo Bonzini
2012-12-20 11:45 ` Gerd Hoffmann
2012-12-20 13:02 ` Gerd Hoffmann
2012-12-21 11:45 ` Gerd Hoffmann
2012-12-21 11:53 ` Paolo Bonzini
2012-12-21 12:17 ` Gerd Hoffmann
2012-12-21 12:40 ` Paolo Bonzini [this message]
2012-12-21 14:21 ` Gerd Hoffmann
2012-12-20 16:44 ` Daniel P. Berrange
2012-12-21 9:01 ` Gerd Hoffmann
2012-12-21 9:28 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50D458A9.2060705@redhat.com \
--to=pbonzini@redhat.com \
--cc=kraxel@redhat.com \
--cc=mprivozn@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.