aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/qmp-cmd-test.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-09-02 13:57:33 +0200
committerThomas Huth <thuth@redhat.com>2020-09-03 12:47:33 +0200
commit3bc1b8ee8cea6823295d161c0313e8441b7321f7 (patch)
tree4a35048416f6e668341d4569179e8c106073d8d2 /tests/qtest/qmp-cmd-test.c
parent978382b453b0e40cc17a983b8c1676386fd3cc5e (diff)
downloadqemu-3bc1b8ee8cea6823295d161c0313e8441b7321f7.zip
qemu-3bc1b8ee8cea6823295d161c0313e8441b7321f7.tar.gz
qemu-3bc1b8ee8cea6823295d161c0313e8441b7321f7.tar.bz2
libqtest: Rename qmp_assert_error_class() to qmp_expect_error_and_unref()
qmp_assert_error_class() does more than just assert: it also unrefs the @rsp argument. Rename to qmp_expect_error_and_unref() to reduce confusion. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200902115733.1229537-1-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/qmp-cmd-test.c')
-rw-r--r--tests/qtest/qmp-cmd-test.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index f34e688..3109a9f 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -210,19 +210,19 @@ static void test_object_add_failure_modes(void)
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
" {'qom-type': 'memory-backend-ram', 'id': 'ram1' } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* attempt to create an object without qom-type */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* attempt to delete an object that does not exist */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* attempt to create 2 objects with duplicate id */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -236,7 +236,7 @@ static void test_object_add_failure_modes(void)
" {'qom-type': 'memory-backend-ram', 'id': 'ram1',"
" 'props': {'size': 1048576 } } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* delete ram1 object */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
@@ -251,7 +251,7 @@ static void test_object_add_failure_modes(void)
" 'props': {'size': '1048576' } } }");
g_assert_nonnull(resp);
/* now do it right */
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
" {'qom-type': 'memory-backend-ram', 'id': 'ram1',"
@@ -272,7 +272,7 @@ static void test_object_add_failure_modes(void)
" {'qom-type': 'memory-backend-ram',"
" 'props': {'size': 1048576 } } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* now do it right */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -294,7 +294,7 @@ static void test_object_add_failure_modes(void)
" {'qom-type': 'memory-backend-ram', 'id': 'ram1',"
" 'props': {'sized': 1048576 } } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
/* now do it right */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -321,7 +321,7 @@ static void test_object_add_failure_modes(void)
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
- qmp_assert_error_class(resp, "GenericError");
+ qmp_expect_error_and_unref(resp, "GenericError");
qtest_quit(qts);
}