summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/fs/puffs/t_io.c
blob: 37c386c83d5ab6062faa52f67f7f2ce25e8e3d38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*	$NetBSD: t_io.c,v 1.1 2010/11/12 17:33:28 pooka Exp $	*/

#include <sys/types.h>
#include <sys/mount.h>
#include <sys/socket.h>

#include <assert.h>
#include <atf-c.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <puffs.h>
#include <puffsdump.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

#include <rump/rump.h>
#include <rump/rump_syscalls.h>

#include "../../h_macros.h"
#include "../common/h_fsmacros.h"

#define MAKEOPTS(...) \
    char *theopts[] = {NULL, "-s", __VA_ARGS__, "dtfs", "n/a", NULL}

ATF_TC(nocache);
ATF_TC_HEAD(nocache, tc)
{

	atf_tc_set_md_var(tc, "descr", "tests large i/o without page cache");
}

ATF_TC_BODY(nocache, tc)
{
	MAKEOPTS("-o", "nopagecache");
	char data[1024*1024];
	void *args;
	int fd;

	FSTEST_CONSTRUCTOR_FSPRIV(tc, puffs, args, theopts);
	FSTEST_ENTER();

	RL(fd = rump_sys_open("afile", O_CREAT | O_RDWR, 0755));
	RL(rump_sys_write(fd, data, sizeof(data)));
	rump_sys_close(fd);

	FSTEST_EXIT();
	FSTEST_DESTRUCTOR(tc, puffs, args);
}


ATF_TP_ADD_TCS(tp)
{

	ATF_TP_ADD_TC(tp, nocache);

	return atf_no_error();
}
OpenPOWER on IntegriCloud