From ebb4d82d88810c31cb5eee408e1ac6d319f7f9bb Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 30 Aug 2018 17:58:07 +0200 Subject: tests: add qmp_assert_error_class() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/libqtest.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/libqtest.h') diff --git a/tests/libqtest.h b/tests/libqtest.h index 36d5caecd4..ed88ff99d5 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -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 -- cgit 1.4.1