mirror of https://github.com/xemu-project/xemu.git
tests/9p: simplify callers of tgetattr()
Now as tgetattr() is using a declarative approach, simplify the code of callers of this function. Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <60c6a083f320b86f3172951445df7bbc895932e2.1664917004.git.qemu_oss@crudebyte.com>
This commit is contained in:
parent
2af5be47b9
commit
28c736709b
|
@ -264,8 +264,7 @@ static void fs_walk_2nd_nonexistent(void *obj, void *data,
|
||||||
v9fs_set_allocator(t_alloc);
|
v9fs_set_allocator(t_alloc);
|
||||||
v9fs_qid root_qid;
|
v9fs_qid root_qid;
|
||||||
uint16_t nwqid;
|
uint16_t nwqid;
|
||||||
uint32_t fid, err;
|
uint32_t fid;
|
||||||
P9Req *req;
|
|
||||||
g_autofree v9fs_qid *wqid = NULL;
|
g_autofree v9fs_qid *wqid = NULL;
|
||||||
g_autofree char *path = g_strdup_printf(
|
g_autofree char *path = g_strdup_printf(
|
||||||
QTEST_V9FS_SYNTH_WALK_FILE "/non-existent", 0
|
QTEST_V9FS_SYNTH_WALK_FILE "/non-existent", 0
|
||||||
|
@ -286,14 +285,10 @@ static void fs_walk_2nd_nonexistent(void *obj, void *data,
|
||||||
g_assert(wqid && wqid[0] && !is_same_qid(root_qid, wqid[0]));
|
g_assert(wqid && wqid[0] && !is_same_qid(root_qid, wqid[0]));
|
||||||
|
|
||||||
/* expect fid being unaffected by walk above */
|
/* expect fid being unaffected by walk above */
|
||||||
req = tgetattr({
|
tgetattr({
|
||||||
.client = v9p, .fid = fid, .request_mask = P9_GETATTR_BASIC,
|
.client = v9p, .fid = fid, .request_mask = P9_GETATTR_BASIC,
|
||||||
.requestOnly = true
|
.expectErr = ENOENT
|
||||||
}).req;
|
});
|
||||||
v9fs_req_wait_for_reply(req, NULL);
|
|
||||||
v9fs_rlerror(req, &err);
|
|
||||||
|
|
||||||
g_assert_cmpint(err, ==, ENOENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fs_walk_none(void *obj, void *data, QGuestAllocator *t_alloc)
|
static void fs_walk_none(void *obj, void *data, QGuestAllocator *t_alloc)
|
||||||
|
@ -302,7 +297,6 @@ static void fs_walk_none(void *obj, void *data, QGuestAllocator *t_alloc)
|
||||||
v9fs_set_allocator(t_alloc);
|
v9fs_set_allocator(t_alloc);
|
||||||
v9fs_qid root_qid;
|
v9fs_qid root_qid;
|
||||||
g_autofree v9fs_qid *wqid = NULL;
|
g_autofree v9fs_qid *wqid = NULL;
|
||||||
P9Req *req;
|
|
||||||
struct v9fs_attr attr;
|
struct v9fs_attr attr;
|
||||||
|
|
||||||
tversion({ .client = v9p });
|
tversion({ .client = v9p });
|
||||||
|
@ -319,12 +313,10 @@ static void fs_walk_none(void *obj, void *data, QGuestAllocator *t_alloc)
|
||||||
/* special case: no QID is returned if nwname=0 was sent */
|
/* special case: no QID is returned if nwname=0 was sent */
|
||||||
g_assert(wqid == NULL);
|
g_assert(wqid == NULL);
|
||||||
|
|
||||||
req = tgetattr({
|
tgetattr({
|
||||||
.client = v9p, .fid = 1, .request_mask = P9_GETATTR_BASIC,
|
.client = v9p, .fid = 1, .request_mask = P9_GETATTR_BASIC,
|
||||||
.requestOnly = true
|
.rgetattr.attr = &attr
|
||||||
}).req;
|
});
|
||||||
v9fs_req_wait_for_reply(req, NULL);
|
|
||||||
v9fs_rgetattr(req, &attr);
|
|
||||||
|
|
||||||
g_assert(is_same_qid(root_qid, attr.qid));
|
g_assert(is_same_qid(root_qid, attr.qid));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue