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