aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-07-03 10:53:34 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-07-03 23:18:56 +0200
commitb5f8431040549da931b31892cbbde73b8724ff48 (patch)
tree842ad0d5658b51220a41945f8c9d2e8540f35309 /tests
parent80cd93bd966bbb0907caa7f1d5676342f27f8f9e (diff)
downloadqemu-b5f8431040549da931b31892cbbde73b8724ff48.zip
qemu-b5f8431040549da931b31892cbbde73b8724ff48.tar.gz
qemu-b5f8431040549da931b31892cbbde73b8724ff48.tar.bz2
tests/test-qga: Demonstrate the guest-agent ignores "id"
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180703085358.13941-9-armbru@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-qga.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 30c9643..6b632e3 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -227,6 +227,25 @@ static void test_qga_ping(gconstpointer fix)
qobject_unref(ret);
}
+static void test_qga_invalid_id(gconstpointer fix)
+{
+ /*
+ * FIXME "id" is ignored; it should either be repeated in the
+ * reply, or rejected on input
+ */
+ const TestFixture *fixture = fix;
+ QDict *ret, *val;
+
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', 'id': 1}");
+ g_assert_nonnull(ret);
+ qmp_assert_no_error(ret);
+
+ val = qdict_get_qdict(ret, "return");
+ g_assert(!qdict_haskey(val, "id"));
+
+ qobject_unref(ret);
+}
+
static void test_qga_invalid_args(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -934,6 +953,7 @@ int main(int argc, char **argv)
g_test_add_data_func("/qga/file-ops", &fix, test_qga_file_ops);
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-id", &fix, test_qga_invalid_id);
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,