summaryrefslogtreecommitdiff
path: root/tests/test-qga.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-08-30 17:58:07 +0200
committerThomas Huth <thuth@redhat.com>2018-08-31 09:53:10 +0200
commitebb4d82d88810c31cb5eee408e1ac6d319f7f9bb (patch)
tree3c58c804ec1f08f2da77bd3cae154caeb894947a /tests/test-qga.c
parentb8e1f74b0a258db394a35272a44d14ec0b6e0be9 (diff)
downloadqemu-ebb4d82d88810c31cb5eee408e1ac6d319f7f9bb.zip
tests: add qmp_assert_error_class()
This helper will simplify a bunch of code checking for QMP errors and can be shared by various tests. Note that test-qga does check for error description as well, so don't replace the code there for now. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r--tests/test-qga.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c
index f69cdf6c03..3d6377436a 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -244,17 +244,12 @@ static void test_qga_invalid_id(gconstpointer fix)
static void test_qga_invalid_oob(gconstpointer fix)
{
const TestFixture *fixture = fix;
- QDict *ret, *error;
- const char *class;
+ QDict *ret;
ret = qmp_fd(fixture->fd, "{'exec-oob': 'guest-ping'}");
g_assert_nonnull(ret);
- error = qdict_get_qdict(ret, "error");
- class = qdict_get_try_str(error, "class");
- g_assert_cmpstr(class, ==, "GenericError");
-
- qobject_unref(ret);
+ qmp_assert_error_class(ret, "GenericError");
}
static void test_qga_invalid_args(gconstpointer fix)