xref: /freebsd/contrib/netbsd-tests/fs/lfs/t_pr.c (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1 /*	$NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka 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", "20");
28 }
29 
30 #define IMGNAME "disk.img"
31 #define FAKEBLK "/dev/blk"
32 ATF_TC_BODY(mknod, tc)
33 {
34 	struct ufs_args args;
35 
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");
39 
40 	memset(&args, 0, sizeof(args));
41 	args.fspec = __UNCONST(FAKEBLK);
42 
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");
49 
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");
53 }
54 
55 ATF_TP_ADD_TCS(tp)
56 {
57 
58 	ATF_TP_ADD_TC(tp, mknod);
59 	return 0;
60 }
61