From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL 14/18] tests: add a test to check invalid args
Date: Mon, 19 Sep 2016 18:41:30 +0200 [thread overview]
Message-ID: <1474303294-13952-15-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1474303294-13952-1-git-send-email-armbru@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Check that invalid args on commands without arguments returns an error.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20160912091913.15831-15-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
tests/test-qga.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 21f44f8..40af649 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -198,6 +198,26 @@ static void test_qga_ping(gconstpointer fix)
QDECREF(ret);
}
+static void test_qga_invalid_args(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ QDict *ret, *error;
+ const gchar *class, *desc;
+
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', "
+ "'arguments': {'foo': 42 }}");
+ g_assert_nonnull(ret);
+
+ error = qdict_get_qdict(ret, "error");
+ class = qdict_get_try_str(error, "class");
+ desc = qdict_get_try_str(error, "desc");
+
+ g_assert_cmpstr(class, ==, "GenericError");
+ g_assert_cmpstr(desc, ==, "QMP input object member 'foo' is unexpected");
+
+ QDECREF(ret);
+}
+
static void test_qga_invalid_cmd(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -911,6 +931,7 @@ int main(int argc, char **argv)
g_test_add_data_func("/qga/file-write-read", &fix, test_qga_file_write_read);
g_test_add_data_func("/qga/get-time", &fix, test_qga_get_time);
g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd);
+ g_test_add_data_func("/qga/invalid-args", &fix, test_qga_invalid_args);
g_test_add_data_func("/qga/fsfreeze-status", &fix,
test_qga_fsfreeze_status);
--
2.5.5
next prev parent reply other threads:[~2016-09-19 16:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 16:41 [Qemu-devel] [PULL 00/18] QAPI patches for 2016-09-19 Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 01/18] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO} Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 02/18] qapi-schema: use generated marshaller for 'qmp_capabilities' Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 03/18] qapi-schema: add 'device_add' Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 04/18] monitor: simplify invalid_qmp_mode() Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 05/18] monitor: register gen:false commands manually Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 06/18] qapi: Support unregistering QMP commands Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 07/18] qmp: Hack to keep commands configuration-specific Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 08/18] qapi: export the marshallers Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 09/18] monitor: use qmp_find_command() (using generated qapi code) Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 10/18] monitor: implement 'qmp_query_commands' without qmp_cmds Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 11/18] monitor: remove mhandler.cmd_new Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 12/18] qapi: remove the "middle" mode Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 13/18] qapi: check invalid arguments on no-args commands Markus Armbruster
2016-09-19 16:41 ` Markus Armbruster [this message]
2016-09-19 16:41 ` [Qemu-devel] [PULL 15/18] monitor: use qmp_dispatch() Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 16/18] build-sys: remove qmp-commands-old.h Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 17/18] qmp-commands.hx: fix some styling Markus Armbruster
2016-09-19 16:41 ` [Qemu-devel] [PULL 18/18] Replace qmp-commands.hx by docs/qmp-commands.txt Markus Armbruster
2016-09-19 18:05 ` [Qemu-devel] [PULL 00/18] QAPI patches for 2016-09-19 Peter Maydell
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=1474303294-13952-15-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=marcandre.lureau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).