summaryrefslogtreecommitdiff
path: root/lib9p/tests/test_server
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/tests/test_server')
-rw-r--r--lib9p/tests/test_server/CMakeLists.txt1
-rw-r--r--lib9p/tests/test_server/config/config.h17
-rw-r--r--lib9p/tests/test_server/fs_shutdown.c4
-rw-r--r--lib9p/tests/test_server/fs_slowread.c4
-rw-r--r--lib9p/tests/test_server/fs_whoami.c6
-rw-r--r--lib9p/tests/test_server/main.c15
6 files changed, 23 insertions, 24 deletions
diff --git a/lib9p/tests/test_server/CMakeLists.txt b/lib9p/tests/test_server/CMakeLists.txt
index 681e583..b659373 100644
--- a/lib9p/tests/test_server/CMakeLists.txt
+++ b/lib9p/tests/test_server/CMakeLists.txt
@@ -19,7 +19,6 @@ target_link_libraries(test_server_objs
libcr
libcr_ipc
libmisc
- lib9p
lib9p_util
libhw_cr
)
diff --git a/lib9p/tests/test_server/config/config.h b/lib9p/tests/test_server/config/config.h
index 03143e1..d9cf008 100644
--- a/lib9p/tests/test_server/config/config.h
+++ b/lib9p/tests/test_server/config/config.h
@@ -7,8 +7,8 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
-#define _CONFIG_9P_NUM_SOCKS 8
-#define CONFIG_SRV9P_NUM_CONNS _CONFIG_9P_NUM_SOCKS
+#define _CONFIG_9P_MAX_CONNS 8
+#define _CONFIG_9P_MAX_REQS (2*_CONFIG_9P_MAX_CONNS)
/* 9P *************************************************************************/
@@ -38,9 +38,6 @@
* struct padding, (2) array pointers.
*/
#define CONFIG_9P_SRV_MAX_HOSTMSG_SIZE CONFIG_9P_SRV_MAX_MSG_SIZE+16
-#define CONFIG_9P_SRV_MAX_FIDS 16
-#define CONFIG_9P_SRV_MAX_REQS 2
-#define CONFIG_9P_SRV_MAX_DEPTH 3
#define CONFIG_9P_ENABLE_9P2000 1 /* bool */
#define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */
@@ -57,10 +54,10 @@
#define CONFIG_COROUTINE_DEBUG 0 /* bool */
#define CONFIG_COROUTINE_VALGRIND 1 /* bool */
#define CONFIG_COROUTINE_GDB 1 /* bool */
-#define CONFIG_COROUTINE_NUM ( \
- 1 /* usb_common */ + \
- 1 /* usb_keyboard */ + \
- CONFIG_SRV9P_NUM_CONNS /* accept+read */ + \
- (CONFIG_9P_SRV_MAX_REQS*CONFIG_SRV9P_NUM_CONNS) /* work+write */ )
+#define CONFIG_COROUTINE_NUM ( \
+ 1 /* usb_common */ + \
+ 1 /* usb_keyboard */ + \
+ _CONFIG_9P_MAX_CONNS /* accept+read */ + \
+ _CONFIG_9P_MAX_REQS /* work+write */ )
#endif /* _CONFIG_H_ */
diff --git a/lib9p/tests/test_server/fs_shutdown.c b/lib9p/tests/test_server/fs_shutdown.c
index 26a8a10..e872b78 100644
--- a/lib9p/tests/test_server/fs_shutdown.c
+++ b/lib9p/tests/test_server/fs_shutdown.c
@@ -54,12 +54,12 @@ static struct lib9p_stat shutdown_file_stat(struct shutdown_file *self, struct l
static void shutdown_file_wstat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot wstat API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file");
}
static void shutdown_file_remove(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot remove API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file");
}
LIB9P_SRV_NOTDIR(struct shutdown_file, shutdown_file)
diff --git a/lib9p/tests/test_server/fs_slowread.c b/lib9p/tests/test_server/fs_slowread.c
index c5db896..c94fba0 100644
--- a/lib9p/tests/test_server/fs_slowread.c
+++ b/lib9p/tests/test_server/fs_slowread.c
@@ -54,12 +54,12 @@ static struct lib9p_stat slowread_file_stat(struct slowread_file *self, struct l
static void slowread_file_wstat(struct slowread_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot wstat API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file");
}
static void slowread_file_remove(struct slowread_file *self, struct lib9p_srv_ctx *ctx) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot remove API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file");
}
LIB9P_SRV_NOTDIR(struct slowread_file, slowread_file)
diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c
index ff6dd25..560e31f 100644
--- a/lib9p/tests/test_server/fs_whoami.c
+++ b/lib9p/tests/test_server/fs_whoami.c
@@ -75,12 +75,12 @@ static struct lib9p_stat whoami_file_stat(struct whoami_file *self, struct lib9p
static void whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot wstat API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file");
}
static void whoami_file_remove(struct whoami_file *self, struct lib9p_srv_ctx *ctx) {
assert(self);
assert(ctx);
- lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot remove API file");
+ lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file");
}
LIB9P_SRV_NOTDIR(struct whoami_file, whoami_file)
@@ -140,7 +140,7 @@ static void whoami_fio_pread(struct whoami_fio *self, struct lib9p_srv_ctx *ctx,
if (byte_offset > (uint64_t)data_size) {
lib9p_error(&ctx->basectx,
- LINUX_EINVAL, "offset is past end-of-file length");
+ LIB9P_ERRNO_L_EINVAL, "offset is past end-of-file length");
return;
}
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index e89a75e..0705747 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -27,8 +27,11 @@
#include "config.h"
-#ifndef CONFIG_SRV9P_NUM_CONNS
- #error config.h must define CONFIG_SRV9P_NUM_CONNS
+#ifndef _CONFIG_9P_MAX_CONNS
+ #error config.h must define _CONFIG_9P_MAX_CONNS
+#endif
+#ifndef _CONFIG_9P_MAX_REQS
+ #error config.h must define _CONFIG_9P_MAX_REQS
#endif
/* globals ********************************************************************/
@@ -39,7 +42,7 @@ const char *hexdig = "0123456789abcdef";
struct {
uint16_t port;
- struct hostnet_tcp_listener listeners[CONFIG_SRV9P_NUM_CONNS];
+ struct hostnet_tcp_listener listeners[_CONFIG_9P_MAX_CONNS];
struct lib9p_srv srv;
FILE *logstream;
} globals = {
@@ -108,14 +111,14 @@ static COROUTINE write_cr(void *) {
static COROUTINE init_cr(void *) {
cr_begin();
- sleep_for_ms(1);
+ sleep_for_ms(1); /* test that sleep works */
- for (int i = 0; i < CONFIG_SRV9P_NUM_CONNS; i++) {
+ for (int i = 0; i < _CONFIG_9P_MAX_CONNS; i++) {
char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'};
if (!coroutine_add(name, read_cr, &i))
error(1, 0, "coroutine_add(read_cr, &i)");
}
- for (int i = 0; i < 2*CONFIG_SRV9P_NUM_CONNS; i++) {
+ for (int i = 0; i < _CONFIG_9P_MAX_REQS; i++) {
char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'};
if (!coroutine_add(name, write_cr, NULL))
error(1, 0, "coroutine_add(write_cr, NULL)");