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>
This commit is contained in:
Marc-André Lureau 2018-08-30 17:58:07 +02:00 committed by Thomas Huth
parent b8e1f74b0a
commit ebb4d82d88
5 changed files with 46 additions and 61 deletions

View file

@ -1004,4 +1004,13 @@ void qtest_qmp_device_del(const char *id);
*/
bool qmp_rsp_is_err(QDict *rsp);
/**
* qmp_assert_error_class:
* @rsp: QMP response to check for error
* @class: an error class
*
* Assert the response has the given error class and discard @rsp.
*/
void qmp_assert_error_class(QDict *rsp, const char *class);
#endif