Sync with cat.c from netbsd-8
[minix3.git] / tests / fs / lfs / t_pr.c
blob97cb1dbbbf77faa0fb7c5d9ad529488b4bc93e07
1 /* $NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka Exp $ */
3 #include <sys/types.h>
4 #include <sys/mount.h>
6 #include <atf-c.h>
7 #include <errno.h>
8 #include <fcntl.h>
9 #include <limits.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <string.h>
15 #include <rump/rump.h>
16 #include <rump/rump_syscalls.h>
18 #include <ufs/ufs/ufsmount.h>
20 #include "../../h_macros.h"
22 ATF_TC(mknod);
23 ATF_TC_HEAD(mknod, tc)
26 atf_tc_set_md_var(tc, "descr", "mknod(2) hangs on LFS (PR kern/43503)");
27 atf_tc_set_md_var(tc, "timeout", "20");
30 #define IMGNAME "disk.img"
31 #define FAKEBLK "/dev/blk"
32 ATF_TC_BODY(mknod, tc)
34 struct ufs_args args;
36 /* hmm, maybe i should fix newfs_lfs instead? */
37 if (system("newfs_lfs -D -F -s 10000 ./" IMGNAME) == -1)
38 atf_tc_fail_errno("newfs failed");
40 memset(&args, 0, sizeof(args));
41 args.fspec = __UNCONST(FAKEBLK);
43 rump_init();
44 if (rump_sys_mkdir("/mp", 0777) == -1)
45 atf_tc_fail_errno("cannot create mountpoint");
46 rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
47 if (rump_sys_mount(MOUNT_LFS, "/mp", 0, &args, sizeof(args)) == -1)
48 atf_tc_fail_errno("rump_sys_mount failed");
50 //atf_tc_expect_timeout("PR kern/43503");
51 if (rump_sys_mknod("/mp/node", S_IFCHR | 0777, 0) == -1)
52 atf_tc_fail_errno("mknod failed");
55 ATF_TP_ADD_TCS(tp)
58 ATF_TP_ADD_TC(tp, mknod);
59 return 0;