mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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>
This commit is contained in:
parent
978382b453
commit
3bc1b8ee8c
6 changed files with 29 additions and 29 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue