From 1e4ad99311611a7fbb5cdfe4b1b79202381dc717 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 13 Apr 2025 22:13:43 -0600 Subject: Split lib9p into lib9p_core and lib9p_srv --- lib9p/tests/testclient-sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib9p/tests/testclient-sess.c') diff --git a/lib9p/tests/testclient-sess.c b/lib9p/tests/testclient-sess.c index 437c489..764168d 100644 --- a/lib9p/tests/testclient-sess.c +++ b/lib9p/tests/testclient-sess.c @@ -15,7 +15,7 @@ #include #include -#include +#include #define MAX_MSG_SIZE (8*1024) -- cgit v1.2.3-2-g168b From ab99adc111425dd93a062e67b19943860296ecca Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 14 Apr 2025 00:45:11 -0600 Subject: lib9p_srv: Tests+fixes for Twalk --- lib9p/tests/testclient-sess.c | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'lib9p/tests/testclient-sess.c') diff --git a/lib9p/tests/testclient-sess.c b/lib9p/tests/testclient-sess.c index 764168d..ded70d1 100644 --- a/lib9p/tests/testclient-sess.c +++ b/lib9p/tests/testclient-sess.c @@ -112,6 +112,56 @@ int main(int argc, char *argv[]) { send9p(Tread, .tag=0, .fid=3, .offset=0, .count=100); recv9p(); /* Rread */ + /* walk ***************************************************************/ + send9p(Tversion, .tag=0, .max_msg_size=(8*1024), .version=lib9p_str("9P2000")); + recv9p(); /* Rversion */ + ctx.version = LIB9P_VER_9P2000; + send9p(Tattach, .tag=0, .fid=0, .afid=LIB9P_FID_NOFID, .uname=lib9p_str("nobody"), .aname=lib9p_str("")); + recv9p(); /* Rattach */ + + /* dup */ + send9p(Twalk, .tag=0, .fid=0, .newfid=1, .nwname=0); + recv9p(); /* Rwalk */ + + /* "The walk request carries as arguments an existing fid"... */ + send9p(Twalk, .tag=0, .fid=2, .newfid=3, .nwname=0); + recv9p(); /* Rerror */ + + /* ..."and a proposed newfid"... */ + send9p(Twalk, .tag=0, .fid=1, .newfid=0xffffffff, .nwname=0); + recv9p(); /* Rerror */ + + /* ..."(which must not be in use"... */ + send9p(Twalk, .tag=0, .fid=1, .newfid=0, .nwname=0); + recv9p(); /* Rerror */ + + /* ..."unless it is the same as fid)"... */ + send9p(Twalk, .tag=0, .fid=1, .newfid=1, .nwname=0); + recv9p(); /* Rwalk */ + + /* ... "that the client wishes to associate with the result of + * traversing the directory hierarchy by `walking' the heierarchy using + * the successive path name elements wname."... */ + + /* ..."The fid must represent a directory"... */ + wname[0] = lib9p_str("README.md"); send9p(Twalk, .tag=0, .fid=1, .newfid=2, .nwname=1, .wname=wname); + recv9p(); /* Rwalk */ + wname[0] = lib9p_str(".."); send9p(Twalk, .tag=0, .fid=2, .newfid=3, .nwname=1, .wname=wname); + recv9p(); /* Rerror */ + + /* ..."unless zero path name elements are specified." */ + send9p(Twalk, .tag=0, .fid=2, .newfid=3, .nwname=0); + recv9p(); /* Rwalk */ + + /* "The fid must be valid in the current session" (tested above)... */ + + /* ..."and must not have been opened for I/O by an open or create + * message."... */ + send9p(Topen, .tag=0, .fid=3, .mode=LIB9P_O_MODE_READ); + recv9p(); /* Ropen */ + send9p(Twalk, .tag=0, .fid=3, .newfid=4, .nwname=0); + recv9p(); /* Rerror */ + /* flush **************************************************************/ send9p(Tversion, .tag=0, .max_msg_size=(8*1024), .version=lib9p_str("9P2000")); recv9p(); /* Rversion */ -- cgit v1.2.3-2-g168b