1 /* $NetBSD: t_pr.c,v 1.3 2010/07/03 08:31:37 jmmv Exp $ */ 2 3 #include <sys/types.h> 4 #include <sys/mount.h> 5 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> 14 15 #include <rump/rump.h> 16 #include <rump/rump_syscalls.h> 17 18 #include <ufs/ufs/ufsmount.h> 19 20 #include "../../h_macros.h" 21 22 ATF_TC(mknod); 23 ATF_TC_HEAD(mknod, tc) 24 { 25 26 atf_tc_set_md_var(tc, "descr", "mknod(2) hangs on LFS (PR kern/43503)"); 27 atf_tc_set_md_var(tc, "timeout", "1"); 28 atf_tc_set_md_var(tc, "use.fs", "true"); 29 } 30 31 #define IMGNAME "disk.img" 32 #define FAKEBLK "/dev/blk" 33 ATF_TC_BODY(mknod, tc) 34 { 35 struct ufs_args args; 36 37 /* hmm, maybe i should fix newfs_lfs instead? */ 38 if (system("newfs_lfs -D -F -s 10000 ./" IMGNAME) == -1) 39 atf_tc_fail_errno("newfs failed"); 40 41 memset(&args, 0, sizeof(args)); 42 args.fspec = __UNCONST(FAKEBLK); 43 44 rump_init(); 45 if (rump_sys_mkdir("/mp", 0777) == -1) 46 atf_tc_fail_errno("cannot create mountpoint"); 47 rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK); 48 if (rump_sys_mount(MOUNT_LFS, "/mp", 0, &args, sizeof(args)) == -1) 49 atf_tc_fail_errno("rump_sys_mount failed"); 50 51 //atf_tc_expect_timeout("PR kern/43503"); 52 if (rump_sys_mknod("/mp/node", S_IFCHR | 0777, 0) == -1) 53 atf_tc_fail_errno("mknod failed"); 54 } 55 56 ATF_TP_ADD_TCS(tp) 57 { 58 59 ATF_TP_ADD_TC(tp, mknod); 60 return 0; 61 } 62