xref: /freebsd/contrib/netbsd-tests/fs/puffs/t_io.c (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1 /*	$NetBSD: t_io.c,v 1.2 2017/01/13 21:30:40 christos Exp $	*/
2 
3 #include <sys/types.h>
4 #include <sys/mount.h>
5 #include <sys/socket.h>
6 
7 #include <assert.h>
8 #include <atf-c.h>
9 #include <err.h>
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <pthread.h>
13 #include <puffs.h>
14 #include <puffsdump.h>
15 #include <stdio.h>
16 #include <unistd.h>
17 #include <string.h>
18 #include <stdlib.h>
19 
20 #include <rump/rump.h>
21 #include <rump/rump_syscalls.h>
22 
23 #include "h_macros.h"
24 #include "../common/h_fsmacros.h"
25 
26 #define MAKEOPTS(...) \
27     char *theopts[] = {NULL, "-s", __VA_ARGS__, "dtfs", "n/a", NULL}
28 
29 ATF_TC(nocache);
30 ATF_TC_HEAD(nocache, tc)
31 {
32 
33 	atf_tc_set_md_var(tc, "descr", "tests large i/o without page cache");
34 }
35 
36 ATF_TC_BODY(nocache, tc)
37 {
38 	MAKEOPTS("-o", "nopagecache");
39 	char data[1024*1024];
40 	void *args;
41 	int fd;
42 
43 	FSTEST_CONSTRUCTOR_FSPRIV(tc, puffs, args, theopts);
44 	FSTEST_ENTER();
45 
46 	RL(fd = rump_sys_open("afile", O_CREAT | O_RDWR, 0755));
47 	RL(rump_sys_write(fd, data, sizeof(data)));
48 	rump_sys_close(fd);
49 
50 	FSTEST_EXIT();
51 	FSTEST_DESTRUCTOR(tc, puffs, args);
52 }
53 
54 
55 ATF_TP_ADD_TCS(tp)
56 {
57 
58 	ATF_TP_ADD_TC(tp, nocache);
59 
60 	return atf_no_error();
61 }
62