aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-01-10 15:32:21 +0100
committerGreg Kurz <groug@kaod.org>2017-01-25 09:34:35 +0100
commit6e37f458d2381d3572f94fa0ce5487a3e17209fa (patch)
tree18d8f31d86daf3e6285e8db1c38c4619e55f7a61
parenta1bf8b7414a336c9d26bf62efecdbe64b3617d76 (diff)
tests: virtio-9p: improve error reporting
Signed-off-by: Greg Kurz <groug@kaod.org>
-rw-r--r--tests/virtio-9p-test.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c
index 060407b20e..9556291567 100644
--- a/tests/virtio-9p-test.c
+++ b/tests/virtio-9p-test.c
@@ -236,6 +236,16 @@ static void v9fs_req_send(P9Req *req)
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)
{
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.tag, ==, req->tag);
- if (hdr.id != id && hdr.id == P9_RLERROR) {
- uint32_t err;
- v9fs_uint32_read(req, &err);
- g_printerr("Received Rlerror (%d) instead of Response %d\n", err, id);
- g_assert_not_reached();
+ if (hdr.id != id) {
+ g_printerr("Received response %d (%s) instead of %d (%s)\n",
+ hdr.id, rmessage_name(hdr.id), id, rmessage_name(id));
+
+ 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);
}