summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c')
-rw-r--r--contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
new file mode 100644
index 0000000..90001b9
--- /dev/null
+++ b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
@@ -0,0 +1,62 @@
+/* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */
+
+#include <sys/types.h>
+#include <sys/mount.h>
+
+#include <atf-c.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+
+#include <fs/ptyfs/ptyfs.h>
+
+#include "../../h_macros.h"
+
+static void
+mountptyfs(const char *mp, int flags)
+{
+ struct ptyfs_args args;
+
+ if (rump_sys_mkdir("/mp", 0777) == -1) {
+ if (errno != EEXIST)
+ atf_tc_fail_errno("mp1");
+ }
+ memset(&args, 0, sizeof(args));
+ args.version = PTYFS_ARGSVERSION;
+ args.mode = 0777;
+ if (rump_sys_mount(MOUNT_PTYFS, mp, flags, &args, sizeof(args)) == -1)
+ atf_tc_fail_errno("could not mount ptyfs");
+}
+
+ATF_TC(basic);
+ATF_TC_HEAD(basic, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "mount ptyfs");
+}
+
+ATF_TC_BODY(basic, tc)
+{
+
+ rump_init();
+
+ mountptyfs("/mp", 0);
+ if (rump_sys_unmount("/mp", 0) == -1)
+ atf_tc_fail_errno("unmount failed");
+
+ /* done */
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, basic);
+
+ return atf_no_error();
+}
OpenPOWER on IntegriCloud