Home | History | Annotate | Line # | Download | only in lfs
t_pr.c revision 1.6.26.1
      1  1.6.26.1  pgoyette /*	$NetBSD: t_pr.c,v 1.6.26.1 2017/03/20 06:57:56 pgoyette Exp $	*/
      2       1.1     pooka 
      3       1.1     pooka #include <sys/types.h>
      4       1.1     pooka #include <sys/mount.h>
      5       1.1     pooka 
      6       1.1     pooka #include <atf-c.h>
      7       1.1     pooka #include <errno.h>
      8       1.1     pooka #include <fcntl.h>
      9       1.1     pooka #include <limits.h>
     10       1.1     pooka #include <stdio.h>
     11       1.1     pooka #include <stdlib.h>
     12       1.1     pooka #include <unistd.h>
     13       1.1     pooka #include <string.h>
     14       1.1     pooka 
     15       1.1     pooka #include <rump/rump.h>
     16       1.1     pooka #include <rump/rump_syscalls.h>
     17       1.1     pooka 
     18       1.1     pooka #include <ufs/ufs/ufsmount.h>
     19       1.1     pooka 
     20  1.6.26.1  pgoyette #include "h_macros.h"
     21       1.1     pooka 
     22       1.1     pooka ATF_TC(mknod);
     23       1.1     pooka ATF_TC_HEAD(mknod, tc)
     24       1.1     pooka {
     25       1.1     pooka 
     26       1.1     pooka 	atf_tc_set_md_var(tc, "descr", "mknod(2) hangs on LFS (PR kern/43503)");
     27       1.6     pooka 	atf_tc_set_md_var(tc, "timeout", "20");
     28       1.1     pooka }
     29       1.1     pooka 
     30       1.1     pooka #define IMGNAME "disk.img"
     31       1.1     pooka #define FAKEBLK "/dev/blk"
     32       1.1     pooka ATF_TC_BODY(mknod, tc)
     33       1.1     pooka {
     34       1.1     pooka 	struct ufs_args args;
     35       1.1     pooka 
     36       1.1     pooka 	/* hmm, maybe i should fix newfs_lfs instead? */
     37       1.1     pooka 	if (system("newfs_lfs -D -F -s 10000 ./" IMGNAME) == -1)
     38       1.1     pooka 		atf_tc_fail_errno("newfs failed");
     39       1.1     pooka 
     40       1.1     pooka 	memset(&args, 0, sizeof(args));
     41       1.1     pooka 	args.fspec = __UNCONST(FAKEBLK);
     42       1.1     pooka 
     43       1.1     pooka 	rump_init();
     44       1.1     pooka 	if (rump_sys_mkdir("/mp", 0777) == -1)
     45       1.1     pooka 		atf_tc_fail_errno("cannot create mountpoint");
     46       1.1     pooka 	rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
     47       1.1     pooka 	if (rump_sys_mount(MOUNT_LFS, "/mp", 0, &args, sizeof(args)) == -1)
     48       1.1     pooka 		atf_tc_fail_errno("rump_sys_mount failed");
     49       1.1     pooka 
     50       1.3      jmmv 	//atf_tc_expect_timeout("PR kern/43503");
     51       1.1     pooka 	if (rump_sys_mknod("/mp/node", S_IFCHR | 0777, 0) == -1)
     52       1.1     pooka 		atf_tc_fail_errno("mknod failed");
     53       1.1     pooka }
     54       1.1     pooka 
     55       1.1     pooka ATF_TP_ADD_TCS(tp)
     56       1.1     pooka {
     57       1.1     pooka 
     58       1.1     pooka 	ATF_TP_ADD_TC(tp, mknod);
     59       1.1     pooka 	return 0;
     60       1.1     pooka }
     61