summaryrefslogtreecommitdiff
path: root/lib9p/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/tests')
-rw-r--r--lib9p/tests/test_compile.c95
-rwxr-xr-xlib9p/tests/test_compile.c.gen19
-rw-r--r--lib9p/tests/test_compile_config/config.h38
3 files changed, 152 insertions, 0 deletions
diff --git a/lib9p/tests/test_compile.c b/lib9p/tests/test_compile.c
new file mode 100644
index 0000000..989bf20
--- /dev/null
+++ b/lib9p/tests/test_compile.c
@@ -0,0 +1,95 @@
+/* lib9p/tests/test_compile.c - Generated by lib9p/tests/test_compile.c.gen. DO NOT EDIT! */
+
+#include <lib9p/9p.h>
+int main(void) {
+ [[gnu::unused]] uint64_t x;
+ x = LIB9P_TAG_NOTAG;
+ x = LIB9P_FID_NOFID;
+ x = LIB9P_DM_DIR;
+ x = LIB9P_DM_APPEND;
+ x = LIB9P_DM_EXCL;
+ x = _LIB9P_DM_PLAN9_MOUNT;
+ x = LIB9P_DM_AUTH;
+ x = LIB9P_DM_TMP;
+ x = LIB9P_DM_DEVICE;
+ x = LIB9P_DM_NAMEDPIPE;
+ x = LIB9P_DM_SOCKET;
+ x = LIB9P_DM_SETUID;
+ x = LIB9P_DM_SETGID;
+ x = LIB9P_DM_OWNER_R;
+ x = LIB9P_DM_OWNER_W;
+ x = LIB9P_DM_OWNER_X;
+ x = LIB9P_DM_GROUP_R;
+ x = LIB9P_DM_GROUP_W;
+ x = LIB9P_DM_GROUP_X;
+ x = LIB9P_DM_OTHER_R;
+ x = LIB9P_DM_OTHER_W;
+ x = LIB9P_DM_OTHER_X;
+ x = LIB9P_DM_PERM_MASK;
+ x = LIB9P_QT_DIR;
+ x = LIB9P_QT_APPEND;
+ x = LIB9P_QT_EXCL;
+ x = _LIB9P_QT_PLAN9_MOUNT;
+ x = LIB9P_QT_AUTH;
+ x = LIB9P_QT_TMP;
+ x = LIB9P_QT_SYMLINK;
+ x = LIB9P_QT_FILE;
+ x = LIB9P_NUID_NONUID;
+ x = LIB9P_O_RCLOSE;
+ x = LIB9P_O_TRUNC;
+ x = LIB9P_O_mode_1;
+ x = LIB9P_O_mode_0;
+ x = LIB9P_O_READ;
+ x = LIB9P_O_WRITE;
+ x = LIB9P_O_RDWR;
+ x = LIB9P_O_EXEC;
+ x = LIB9P_O_MODE_MASK;
+ x = LIB9P_O_FLAG_MASK;
+ x = LIB9P_GETATTR_DATA_VERSION;
+ x = LIB9P_GETATTR_GEN;
+ x = LIB9P_GETATTR_BTIME;
+ x = LIB9P_GETATTR_BLOCKS;
+ x = LIB9P_GETATTR_SIZE;
+ x = LIB9P_GETATTR_INO;
+ x = LIB9P_GETATTR_CTIME;
+ x = LIB9P_GETATTR_MTIME;
+ x = LIB9P_GETATTR_ATIME;
+ x = LIB9P_GETATTR_RDEV;
+ x = LIB9P_GETATTR_GID;
+ x = LIB9P_GETATTR_UID;
+ x = LIB9P_GETATTR_NLINK;
+ x = LIB9P_GETATTR_MODE;
+ x = LIB9P_GETATTR_BASIC;
+ x = LIB9P_GETATTR_ALL;
+ x = LIB9P_SETATTR_MTIME_SET;
+ x = LIB9P_SETATTR_ATIME_SET;
+ x = LIB9P_SETATTR_CTIME;
+ x = LIB9P_SETATTR_MTIME;
+ x = LIB9P_SETATTR_ATIME;
+ x = LIB9P_SETATTR_SIZE;
+ x = LIB9P_SETATTR_GID;
+ x = LIB9P_SETATTR_UID;
+ x = LIB9P_SETATTR_MODE;
+ x = LIB9P_LOCK_TYPE_RDLCK;
+ x = LIB9P_LOCK_TYPE_WRLCK;
+ x = LIB9P_LOCK_TYPE_UNLCK;
+ x = LIB9P_LOCK_FLAGS_RECLAIM;
+ x = LIB9P_LOCK_FLAGS_BLOCK;
+ x = LIB9P_LOCK_STATUS_SUCCESS;
+ x = LIB9P_LOCK_STATUS_BLOCKED;
+ x = LIB9P_LOCK_STATUS_ERROR;
+ x = LIB9P_LOCK_STATUS_GRACE;
+ x = LIB9P_TMSG_MAX_IOV;
+ x = LIB9P_TMSG_MAX_IOV;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_TMSG_MAX_COPY;
+ x = LIB9P_RMSG_MAX_IOV;
+ x = LIB9P_RMSG_MAX_IOV;
+ x = LIB9P_RMSG_MAX_IOV;
+ x = LIB9P_RMSG_MAX_COPY;
+ return 0;
+}
diff --git a/lib9p/tests/test_compile.c.gen b/lib9p/tests/test_compile.c.gen
new file mode 100755
index 0000000..47046b3
--- /dev/null
+++ b/lib9p/tests/test_compile.c.gen
@@ -0,0 +1,19 @@
+#!/bin/sh
+# lib9p/tests/test_compile.c.gen - Generate code to make sure all generated macros work
+#
+# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+generated_h=$1
+outfile=$2
+
+{
+ echo "/* ${outfile} - Generated by $0. DO NOT EDIT! */"
+ echo
+ echo "#include <lib9p/9p.h>"
+ echo 'int main(void) {'
+ echo ' [[gnu::unused]] uint64_t x;'
+ sed -nE 's/^\s*#\s*define\s*(\S[^ (]*)\s.*/ x = \1;/p' <"$generated_h"
+ echo ' return 0;'
+ echo '}'
+} >"$outfile"
diff --git a/lib9p/tests/test_compile_config/config.h b/lib9p/tests/test_compile_config/config.h
new file mode 100644
index 0000000..38ab0c0
--- /dev/null
+++ b/lib9p/tests/test_compile_config/config.h
@@ -0,0 +1,38 @@
+/* config.h - Compile-time configuration for lib9p/test/test_compile
+ *
+ * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+/* 9P *************************************************************************/
+
+#define CONFIG_9P_MAX_MSG_SIZE ((4*1024)+24)
+#define CONFIG_9P_MAX_HOSTMSG_SIZE CONFIG_9P_MAX_MSG_SIZE+16
+#define CONFIG_9P_MAX_ERR_SIZE 128
+#define CONFIG_9P_MAX_9P2000_e_WELEM 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 */
+#define CONFIG_9P_ENABLE_9P2000_e 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_L 1 /* bool */
+#define CONFIG_9P_ENABLE_9P2000_p9p 1 /* bool */
+
+/* COROUTINE ******************************************************************/
+
+#define CONFIG_COROUTINE_STACK_SIZE_DEFAULT (32*1024)
+#define CONFIG_COROUTINE_NAME_LEN 16
+#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */
+#define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */
+#define CONFIG_COROUTINE_DEBUG 0 /* bool */
+#define CONFIG_COROUTINE_VALGRIND 1 /* bool */
+#define CONFIG_COROUTINE_GDB 1 /* bool */
+#define CONFIG_COROUTINE_NUM 2
+
+#endif /* _CONFIG_H_ */