Boot-to-ramdisk image generation scripts
[minix3.git] / tests / fs / ptyfs / t_ptyfs.c
blob90001b92ee944442a58bda4abc40fde2ff284751
1 /* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */
3 #include <sys/types.h>
4 #include <sys/mount.h>
6 #include <atf-c.h>
7 #include <err.h>
8 #include <errno.h>
9 #include <fcntl.h>
10 #include <stdio.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <stdlib.h>
15 #include <rump/rump.h>
16 #include <rump/rump_syscalls.h>
18 #include <fs/ptyfs/ptyfs.h>
20 #include "../../h_macros.h"
22 static void
23 mountptyfs(const char *mp, int flags)
25 struct ptyfs_args args;
27 if (rump_sys_mkdir("/mp", 0777) == -1) {
28 if (errno != EEXIST)
29 atf_tc_fail_errno("mp1");
31 memset(&args, 0, sizeof(args));
32 args.version = PTYFS_ARGSVERSION;
33 args.mode = 0777;
34 if (rump_sys_mount(MOUNT_PTYFS, mp, flags, &args, sizeof(args)) == -1)
35 atf_tc_fail_errno("could not mount ptyfs");
38 ATF_TC(basic);
39 ATF_TC_HEAD(basic, tc)
41 atf_tc_set_md_var(tc, "descr", "mount ptyfs");
44 ATF_TC_BODY(basic, tc)
47 rump_init();
49 mountptyfs("/mp", 0);
50 if (rump_sys_unmount("/mp", 0) == -1)
51 atf_tc_fail_errno("unmount failed");
53 /* done */
56 ATF_TP_ADD_TCS(tp)
59 ATF_TP_ADD_TC(tp, basic);
61 return atf_no_error();