mirror of https://github.com/proxmox/mirror_qemu
tests: virtio-9p: improve error reporting
Signed-off-by: Greg Kurz <groug@kaod.org>master
parent
a1bf8b7414
commit
6e37f458d2
|
@ -236,6 +236,16 @@ static void v9fs_req_send(P9Req *req)
|
||||||
req->t_off = 0;
|
req->t_off = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *rmessage_name(uint8_t id)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
id == P9_RLERROR ? "RLERROR" :
|
||||||
|
id == P9_RVERSION ? "RVERSION" :
|
||||||
|
id == P9_RATTACH ? "RATTACH" :
|
||||||
|
id == P9_RWALK ? "RWALK" :
|
||||||
|
"<unknown>";
|
||||||
|
}
|
||||||
|
|
||||||
static void v9fs_req_recv(P9Req *req, uint8_t id)
|
static void v9fs_req_recv(P9Req *req, uint8_t id)
|
||||||
{
|
{
|
||||||
QVirtIO9P *v9p = req->v9p;
|
QVirtIO9P *v9p = req->v9p;
|
||||||
|
@ -258,11 +268,15 @@ static void v9fs_req_recv(P9Req *req, uint8_t id)
|
||||||
g_assert_cmpint(hdr.size, <=, P9_MAX_SIZE);
|
g_assert_cmpint(hdr.size, <=, P9_MAX_SIZE);
|
||||||
g_assert_cmpint(hdr.tag, ==, req->tag);
|
g_assert_cmpint(hdr.tag, ==, req->tag);
|
||||||
|
|
||||||
if (hdr.id != id && hdr.id == P9_RLERROR) {
|
if (hdr.id != id) {
|
||||||
uint32_t err;
|
g_printerr("Received response %d (%s) instead of %d (%s)\n",
|
||||||
v9fs_uint32_read(req, &err);
|
hdr.id, rmessage_name(hdr.id), id, rmessage_name(id));
|
||||||
g_printerr("Received Rlerror (%d) instead of Response %d\n", err, id);
|
|
||||||
g_assert_not_reached();
|
if (hdr.id == P9_RLERROR) {
|
||||||
|
uint32_t err;
|
||||||
|
v9fs_uint32_read(req, &err);
|
||||||
|
g_printerr("Rlerror has errno %d (%s)\n", err, strerror(err));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
g_assert_cmpint(hdr.id, ==, id);
|
g_assert_cmpint(hdr.id, ==, id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue