summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib9p/tests/test_server/main.c29
-rwxr-xr-xlib9p/tests/testclient-p9p2
-rw-r--r--lib9p/tests/testclient-p9p.explog32
-rw-r--r--lib9p/tests/testclient-sess.explog16
4 files changed, 38 insertions, 41 deletions
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index e5e54e9..2743629 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -49,35 +49,32 @@ struct {
/* file tree ******************************************************************/
-enum { PATH_BASE = __COUNTER__ };
-#define PATH_COUNTER __COUNTER__ - PATH_BASE
-
-#define STATIC_FILE(STRNAME, SYMNAME) \
- UTIL9P_STATIC_FILE(PATH_COUNTER, STRNAME, \
+#define STATIC_FILE(N, STRNAME, SYMNAME) \
+ UTIL9P_STATIC_FILE(N, STRNAME, \
.data_start = _binary_static_##SYMNAME##_start, \
.data_end = _binary_static_##SYMNAME##_end)
-#define STATIC_DIR(STRNAME, ...) \
- UTIL9P_STATIC_DIR(PATH_COUNTER, STRNAME, __VA_ARGS__)
+#define STATIC_DIR(N, STRNAME, ...) \
+ UTIL9P_STATIC_DIR(N, STRNAME, __VA_ARGS__)
-#define API_FILE(STRNAME, SYMNAME, ...) \
+#define API_FILE(N, STRNAME, SYMNAME, ...) \
lo_box_##SYMNAME##_file_as_lib9p_srv_file(&((struct SYMNAME##_file){ \
.name = STRNAME, \
- .pathnum = PATH_COUNTER \
+ .pathnum = N \
__VA_OPT__(,) __VA_ARGS__ \
}))
struct lib9p_srv_file root =
- STATIC_DIR("",
- STATIC_DIR("Documentation",
- STATIC_FILE("x", Documentation_x_txt),
+ STATIC_DIR(1, "",
+ STATIC_DIR(2, "Documentation",
+ STATIC_FILE(3, "x", Documentation_x_txt),
),
- STATIC_FILE("README.md", README_md),
- API_FILE("shutdown", shutdown,
+ STATIC_FILE(4, "README.md", README_md),
+ API_FILE(5, "shutdown", shutdown,
.listeners = globals.listeners,
.nlisteners = LM_ARRAY_LEN(globals.listeners)),
- API_FILE("slowread", slowread,
+ API_FILE(6, "slowread", slowread,
.flushable = false),
- API_FILE("slowread-flushable", slowread,
+ API_FILE(7, "slowread-flushable", slowread,
.flushable = true),
);
diff --git a/lib9p/tests/testclient-p9p b/lib9p/tests/testclient-p9p
index 55ca069..81a7e50 100755
--- a/lib9p/tests/testclient-p9p
+++ b/lib9p/tests/testclient-p9p
@@ -55,7 +55,7 @@ expect_lines \
out=$("${client[@]}" stat 'Documentation/x')
expect_lines \
- "'x' 'root' 'root' 'root' q (0000000000000001 1 ) m 0444 at 1728337905 mt 1728337904 l 166 t 0 d 0"
+ "'x' 'root' 'root' 'root' q (0000000000000003 1 ) m 0444 at 1728337905 mt 1728337904 l 166 t 0 d 0"
out=$("${client[@]}" write 'shutdown' <<<1)
expect_lines ''
diff --git a/lib9p/tests/testclient-p9p.explog b/lib9p/tests/testclient-p9p.explog
index 7874de4..3bfb0b0 100644
--- a/lib9p/tests/testclient-p9p.explog
+++ b/lib9p/tests/testclient-p9p.explog
@@ -7,17 +7,17 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=0 wname=[ ] }
< Rwalk { tag=0 nwqid=0 wqid=[ ] }
> Tstat { tag=0 fid=1 }
-< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(DIR) vers=1 path=7 } file_mode=(DIR|0555) file_atime=1728337905 file_mtime=1728337904 file_size=0 file_name="" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } }
+< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(DIR) vers=1 path=1 } file_mode=(DIR|0555) file_atime=1728337905 file_mtime=1728337904 file_size=0 file_name="" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } }
> Tclunk { tag=0 fid=1 }
< Rclunk { tag=0 }
> Twalk { tag=0 fid=0 newfid=1 nwname=0 wname=[ ] }
< Rwalk { tag=0 nwqid=0 wqid=[ ] }
> Topen { tag=0 fid=1 mode=(MODE_READ) }
-< Ropen { tag=0 qid={ type=(DIR) vers=1 path=7 } iounit=0 }
+< Ropen { tag=0 qid={ type=(DIR) vers=1 path=1 } iounit=0 }
> Tread { tag=0 fid=1 offset=0 count=4096 }
< Rread { tag=0 count=361 data=<bytedata> }
> Tread { tag=0 fid=1 offset=361 count=4096 }
@@ -29,7 +29,7 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["Documentation" ] }
< Rwalk { tag=0 nwqid=1 wqid=[{ type=(DIR) vers=1 path=2 } ] }
> Tstat { tag=0 fid=1 }
@@ -51,11 +51,11 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["README.md" ] }
-< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=3 } ] }
+< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=4 } ] }
> Topen { tag=0 fid=1 mode=(MODE_READ) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=3 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=4 } iounit=0 }
> Tread { tag=0 fid=1 offset=0 count=4096 }
< Rread { tag=0 count=166 data="<!--\n README.md - test static file\n\n Copyright ("... }
> Tread { tag=0 fid=1 offset=166 count=4096 }
@@ -67,11 +67,11 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=["Documentation", "x" ] }
-< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=1 } ] }
+< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] }
> Topen { tag=0 fid=1 mode=(MODE_READ) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=1 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=3 } iounit=0 }
> Tread { tag=0 fid=1 offset=0 count=4096 }
< Rread { tag=0 count=166 data="<!--\n Documentation/x.txt - test static file\n\n C"... }
> Tread { tag=0 fid=1 offset=166 count=4096 }
@@ -83,11 +83,11 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=["Documentation", "x" ] }
-< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=1 } ] }
+< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] }
> Tstat { tag=0 fid=1 }
-< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(0) vers=1 path=1 } file_mode=(0444) file_atime=1728337905 file_mtime=1728337904 file_size=166 file_name="x" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } }
+< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(0) vers=1 path=3 } file_mode=(0444) file_atime=1728337905 file_mtime=1728337904 file_size=166 file_name="x" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } }
> Tclunk { tag=0 fid=1 }
< Rclunk { tag=0 }
> Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" }
@@ -95,11 +95,11 @@
> Tauth { tag=0 afid=0 uname="lukeshu" aname="" n_uid=0 }
< Rerror { tag=0 errstr="authentication not required" errnum=95 }
> Tattach { tag=0 fid=0 afid=NOFID uname="lukeshu" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["shutdown" ] }
-< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=4 } ] }
+< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=5 } ] }
> Topen { tag=0 fid=1 mode=(TRUNC|MODE_WRITE) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=4 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=5 } iounit=0 }
> Twrite { tag=0 fid=1 offset=0 count=2 data="1\n" }
< Rwrite { tag=0 count=2 }
> Tclunk { tag=0 fid=1 }
diff --git a/lib9p/tests/testclient-sess.explog b/lib9p/tests/testclient-sess.explog
index e086341..b1f3085 100644
--- a/lib9p/tests/testclient-sess.explog
+++ b/lib9p/tests/testclient-sess.explog
@@ -19,13 +19,13 @@
> Tversion { tag=0 max_msg_size=8192 version="9P2000" }
< Rversion { tag=0 max_msg_size=4120 version="9P2000" }
> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
# flush, but original response comes back first
> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["slowread" ] }
-< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=5 } ] }
+< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=6 } ] }
> Topen { tag=0 fid=1 mode=(MODE_READ) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=5 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=6 } iounit=0 }
> Tread { tag=1 fid=1 offset=0 count=6 }
> Tflush { tag=2 oldtag=1 }
< Rread { tag=1 count=6 data="Sloth\n" }
@@ -33,9 +33,9 @@
# flush, succeeds
> Twalk { tag=1 fid=0 newfid=2 nwname=1 wname=["slowread-flushable" ] }
-< Rwalk { tag=1 nwqid=1 wqid=[{ type=(0) vers=1 path=6 } ] }
+< Rwalk { tag=1 nwqid=1 wqid=[{ type=(0) vers=1 path=7 } ] }
> Topen { tag=0 fid=2 mode=(MODE_READ) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=6 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=7 } iounit=0 }
> Tread { tag=1 fid=2 offset=0 count=6 }
> Tflush { tag=2 oldtag=1 }
< Rflush { tag=2 }
@@ -49,10 +49,10 @@
> Tversion { tag=0 max_msg_size=8192 version="9P2000" }
< Rversion { tag=0 max_msg_size=4120 version="9P2000" }
> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 }
-< Rattach { tag=0 qid={ type=(DIR) vers=1 path=7 } }
+< Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } }
> Twalk { tag=0 fid=0 newfid=0 nwname=1 wname=["shutdown" ] }
-< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=4 } ] }
+< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=5 } ] }
> Topen { tag=0 fid=0 mode=(MODE_WRITE) }
-< Ropen { tag=0 qid={ type=(0) vers=1 path=4 } iounit=0 }
+< Ropen { tag=0 qid={ type=(0) vers=1 path=5 } iounit=0 }
> Twrite { tag=0 fid=0 offset=0 count=2 data="1\n" }
< Rwrite { tag=0 count=2 }