aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2023-01-12 15:02:33 +0100
committerMichael S. Tsirkin <mst@redhat.com>2023-01-28 06:21:29 -0500
commit0711c2849735eb77b5082803c05cbaed99ccd852 (patch)
tree065a63f89cdf583851477626b199d2d1e7bd16ec /tests/qtest
parenteac7a7791bb6d719233deed750034042318ffd56 (diff)
downloadqemu-0711c2849735eb77b5082803c05cbaed99ccd852.zip
qemu-0711c2849735eb77b5082803c05cbaed99ccd852.tar.gz
qemu-0711c2849735eb77b5082803c05cbaed99ccd852.tar.bz2
tests: qtest: print device_add error before failing test
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20230112140312.3096331-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tests/qtest')
-rw-r--r--tests/qtest/libqtest.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 6b2216c..d658222 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1435,6 +1435,10 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv,
resp = qtest_qmp(qts, "{'execute': 'device_add', 'arguments': %p}", args);
g_assert(resp);
g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events */
+ if (qdict_haskey(resp, "error")) {
+ fprintf(stderr, "error: %s\n",
+ qdict_get_str(qdict_get_qdict(resp, "error"), "desc"));
+ }
g_assert(!qdict_haskey(resp, "error"));
qobject_unref(resp);
}