diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-02-20 16:42:53 +0100 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2019-03-18 10:48:06 -0500 |
commit | 4eaca8de268d74ac5daaf8938abcb69d37ba2889 (patch) | |
tree | 1723cafb6a59b7e4df3d266fb4e2d0b196b56a15 /tests | |
parent | 781f2b3d1e5ef389b44016a897fd55e7a780bf35 (diff) |
qmp: common 'id' handling & make QGA conform to QMP spec
Let qmp_dispatch() copy the 'id' field. That way any qmp client will
conform to the specification, including QGA. Furthermore, it
simplifies the work for qemu monitor.
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-qga.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c index 3d6377436a..891aa3d322 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -225,18 +225,15 @@ static void test_qga_ping(gconstpointer fix) qobject_unref(ret); } -static void test_qga_invalid_id(gconstpointer fix) +static void test_qga_id(gconstpointer fix) { const TestFixture *fixture = fix; - QDict *ret, *error; - const char *class; + QDict *ret; ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', 'id': 1}"); g_assert_nonnull(ret); - - error = qdict_get_qdict(ret, "error"); - class = qdict_get_try_str(error, "class"); - g_assert_cmpstr(class, ==, "GenericError"); + qmp_assert_no_error(ret); + g_assert_cmpint(qdict_get_int(ret, "id"), ==, 1); qobject_unref(ret); } @@ -992,7 +989,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/id", &fix, test_qga_id); g_test_add_data_func("/qga/invalid-oob", &fix, test_qga_invalid_oob); 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); |