summaryrefslogtreecommitdiff
path: root/lib9p/tests
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-09 20:23:55 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-09 20:23:55 -0700
commit026afb5113fbeed097308a0fe43da105b549c807 (patch)
treec1826d1e57b658e8a8844b731779633809c56e45 /lib9p/tests
parentf466cff948ec638f26a9a77a391904ebe03c4dfb (diff)
lib9p: test_server: Make the pathnums more stable
Diffstat (limited to 'lib9p/tests')
-rwxr-xr-xlib9p/tests/runtest2
-rw-r--r--lib9p/tests/test_server/main.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/lib9p/tests/runtest b/lib9p/tests/runtest
index bb83a83..02cd791 100755
--- a/lib9p/tests/runtest
+++ b/lib9p/tests/runtest
@@ -43,7 +43,7 @@ expect_lines \
out=$("${client[@]}" stat 'Documentation/x')
expect_lines \
- "'x' 'root' 'root' 'root' q (0000000000000008 1 ) m 0444 at 1728337905 mt 1728337904 l 4 t 0 d 0"
+ "'x' 'root' 'root' 'root' q (0000000000000003 1 ) m 0444 at 1728337905 mt 1728337904 l 4 t 0 d 0"
out=$("${client[@]}" write 'shutdown' <<<1)
expect_lines ''
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index 07fc74b..7211322 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -108,6 +108,9 @@ static struct lib9p_srv_file_vtable api_file_vtable = {
/* file tree ******************************************************************/
+enum { PATH_BASE = __COUNTER__ };
+#define PATH_COUNTER __COUNTER__ - PATH_BASE
+
#define FILE_COMMON(NAME) { \
.vtable = &util9p_static_file_vtable, \
\
@@ -115,7 +118,7 @@ static struct lib9p_srv_file_vtable api_file_vtable = {
.g_name = "root", .g_num = 0, /* owner group */ \
.m_name = "root", .m_num = 0, /* last-modified-by user */ \
\
- .pathnum = __COUNTER__, \
+ .pathnum = PATH_COUNTER, \
.name = NAME, \
.perm = 0444, \
.atime = 1728337905, \
@@ -129,7 +132,7 @@ static struct lib9p_srv_file_vtable api_file_vtable = {
.g_name = "root", .g_num = 0, /* owner group */ \
.m_name = "root", .m_num = 0, /* last-modified-by user */ \
\
- .pathnum = __COUNTER__, \
+ .pathnum = PATH_COUNTER, \
.name = NAME, \
.perm = 0555, \
.atime = 1728337905, \
@@ -156,7 +159,7 @@ static struct util9p_static_dir root = {
STATIC_FILE("README.md", README_md),
&((struct api_file){
.vtable = &api_file_vtable,
- .pathnum = __COUNTER__,
+ .pathnum = PATH_COUNTER,
}),
NULL,
},