Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/fs Fold the puffs private and vfs tests mount/unmount ...
details: https://anonhg.NetBSD.org/src/rev/b827c690d098
branches: trunk
changeset: 756734:b827c690d098
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Jul 30 16:15:05 2010 +0000
description:
Fold the puffs private and vfs tests mount/unmount routines together.
To achieve this, add a file system private parameter to the newfs
method (which will obviously not be used by vfs tests).
njoly ok
diffstat:
tests/fs/common/fstest_ext2fs.c | 4 +-
tests/fs/common/fstest_ffs.c | 5 +-
tests/fs/common/fstest_lfs.c | 5 +-
tests/fs/common/fstest_msdosfs.c | 4 +-
tests/fs/common/fstest_nfs.c | 4 +-
tests/fs/common/fstest_puffs.c | 149 ++++------
tests/fs/common/fstest_sysvbfs.c | 4 +-
tests/fs/common/fstest_tmpfs.c | 4 +-
tests/fs/common/h_fsmacros.h | 47 +++-
tests/fs/ffs/t_mount.c | 4 +-
tests/fs/nfs/nfsservice/rumpnfsd.c | 7 +-
tests/fs/puffs/Makefile | 5 +-
tests/fs/puffs/t_basic.c | 477 ++++++++----------------------------
13 files changed, 236 insertions(+), 483 deletions(-)
diffs (truncated from 1239 to 300 lines):
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_ext2fs.c
--- a/tests/fs/common/fstest_ext2fs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_ext2fs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_ext2fs.c,v 1.1 2010/07/29 14:15:46 pooka Exp $ */
+/* $NetBSD: fstest_ext2fs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
int
ext2fs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
- off_t size)
+ off_t size, void *fspriv)
{
char cmd[1024];
int res;
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_ffs.c
--- a/tests/fs/common/fstest_ffs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_ffs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_ffs.c,v 1.1 2010/07/29 14:15:46 pooka Exp $ */
+/* $NetBSD: fstest_ffs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -52,7 +52,8 @@
};
int
-ffs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
+ffs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size,
+ void *fspriv)
{
char cmd[1024];
int res;
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_lfs.c
--- a/tests/fs/common/fstest_lfs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_lfs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_lfs.c,v 1.3 2010/07/29 14:50:32 pooka Exp $ */
+/* $NetBSD: fstest_lfs.c,v 1.4 2010/07/30 16:15:05 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -61,7 +61,8 @@
};
int
-lfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
+lfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size,
+ void *fspriv)
{
char cmd[1024];
int res;
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_msdosfs.c
--- a/tests/fs/common/fstest_msdosfs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_msdosfs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_msdosfs.c,v 1.1 2010/07/29 14:15:46 pooka Exp $ */
+/* $NetBSD: fstest_msdosfs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
int
msdosfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
- off_t size)
+ off_t size, void *fspriv)
{
char cmd[1024];
int res;
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_nfs.c
--- a/tests/fs/common/fstest_nfs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_nfs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_nfs.c,v 1.2 2010/07/30 10:23:26 pooka Exp $ */
+/* $NetBSD: fstest_nfs.c,v 1.3 2010/07/30 16:15:05 pooka Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
/* fork rump nfsd, configure interface */
int
nfs_fstest_newfs(const atf_tc_t *tc, void **argp,
- const char *image, off_t size)
+ const char *image, off_t size, void *fspriv)
{
const char *srcdir;
char *nfsdargv[7];
diff -r c03544837a76 -r b827c690d098 tests/fs/common/fstest_puffs.c
--- a/tests/fs/common/fstest_puffs.c Fri Jul 30 16:05:07 2010 +0000
+++ b/tests/fs/common/fstest_puffs.c Fri Jul 30 16:15:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstest_puffs.c,v 1.1 2010/07/29 14:15:47 pooka Exp $ */
+/* $NetBSD: fstest_puffs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -50,51 +50,9 @@
#include "h_fsmacros.h"
-struct puffstestargs {
- uint8_t *pta_pargs;
- size_t pta_pargslen;
-
- int pta_pflags;
- int pta_servfd;
- pid_t pta_childpid;
-
- char pta_dev[MAXPATHLEN];
- char pta_dir[MAXPATHLEN];
-
- int pta_mntflags;
-};
-
#define BUFSIZE (128*1024)
#define DTFS_DUMP "-o","dump"
-struct thefds {
- int rumpfd;
- int servfd;
-};
-
-int vfs_toserv_ops[PUFFS_VFS_MAX];
-int vn_toserv_ops[PUFFS_VN_MAX];
-
-#ifdef PUFFSDUMP
-static void __unused
-dumpopcount(void)
-{
- size_t i;
-
- printf("VFS OPS:\n");
- for (i = 0; i < MIN(puffsdump_vfsop_count, PUFFS_VFS_MAX); i++) {
- printf("\t%s: %d\n",
- puffsdump_vfsop_revmap[i], vfs_toserv_ops[i]);
- }
-
- printf("VN OPS:\n");
- for (i = 0; i < MIN(puffsdump_vnop_count, PUFFS_VN_MAX); i++) {
- printf("\t%s: %d\n",
- puffsdump_vnop_revmap[i], vn_toserv_ops[i]);
- }
-}
-#endif
-
/*
* Threads which shovel data between comfd and /dev/puffs.
* (cannot use polling since fd's are in different namespaces)
@@ -104,12 +62,12 @@
{
struct putter_hdr *phdr;
struct puffs_req *preq;
- struct thefds *fds = arg;
+ struct puffstestargs *args = arg;
char buf[BUFSIZE];
int comfd, puffsfd;
- comfd = fds->servfd;
- puffsfd = fds->rumpfd;
+ comfd = args->pta_servfd;
+ puffsfd = args->pta_rumpfd;
phdr = (void *)buf;
preq = (void *)buf;
@@ -133,10 +91,10 @@
/* Analyze request */
if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS) {
assert(preq->preq_optype < PUFFS_VFS_MAX);
- vfs_toserv_ops[preq->preq_optype]++;
+ args->pta_vfs_toserv_ops[preq->preq_optype]++;
} else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) {
assert(preq->preq_optype < PUFFS_VN_MAX);
- vn_toserv_ops[preq->preq_optype]++;
+ args->pta_vn_toserv_ops[preq->preq_optype]++;
}
n = phdr->pth_framelen;
@@ -150,7 +108,7 @@
static void *
writeshovel(void *arg)
{
- struct thefds *fds = arg;
+ struct puffstestargs *args = arg;
struct putter_hdr *phdr;
char buf[BUFSIZE];
size_t toread;
@@ -159,8 +117,8 @@
/* use static thread id */
rump_pub_lwp_alloc_and_switch(0, 11);
- comfd = fds->servfd;
- puffsfd = fds->rumpfd;
+ comfd = args->pta_servfd;
+ puffsfd = args->pta_rumpfd;
phdr = (struct putter_hdr *)buf;
@@ -196,22 +154,19 @@
}
static void
-rumpshovels(int rumpfd, int servfd)
+rumpshovels(struct puffstestargs *args)
{
- struct thefds *fds;
pthread_t pt;
int rv;
if ((rv = rump_init()) == -1)
err(1, "rump_init");
- fds = malloc(sizeof(*fds));
- fds->rumpfd = rumpfd;
- fds->servfd = servfd;
- if (pthread_create(&pt, NULL, readshovel, fds) == -1)
+ if (pthread_create(&pt, NULL, readshovel, args) == -1)
err(1, "read shovel");
pthread_detach(pt);
- if (pthread_create(&pt, NULL, writeshovel, fds) == -1)
+
+ if (pthread_create(&pt, NULL, writeshovel, args) == -1)
err(1, "write shovel");
pthread_detach(pt);
}
@@ -223,14 +178,17 @@
atf_tc_fail("child died"); /* almost signal-safe */
}
+struct puffstestargs *theargs; /* XXX */
+
/* XXX: we don't support size */
int
puffs_fstest_newfs(const atf_tc_t *tc, void **argp,
- const char *image, off_t size)
+ const char *image, off_t size, void *fspriv)
{
struct puffstestargs *args;
char dtfs_path[MAXPATHLEN];
char *dtfsargv[6];
+ char **theargv;
pid_t childpid;
int *pflags;
char comfd[16];
@@ -250,12 +208,20 @@
/* build dtfs exec path from atf test dir */
sprintf(dtfs_path, "%s/../puffs/h_dtfs/h_dtfs",
atf_tc_get_config_var(tc, "srcdir"));
- dtfsargv[0] = dtfs_path;
- dtfsargv[1] = __UNCONST("-i");
- dtfsargv[2] = __UNCONST("-s");
- dtfsargv[3] = __UNCONST("dtfs");
- dtfsargv[4] = __UNCONST("fictional");
- dtfsargv[5] = NULL;
+
+ if (fspriv) {
+ theargv = fspriv;
+ theargv[0] = dtfs_path;
+ } else {
+ dtfsargv[0] = dtfs_path;
+ dtfsargv[1] = __UNCONST("-i");
+ dtfsargv[2] = __UNCONST("-s");
+ dtfsargv[3] = __UNCONST("dtfs");
+ dtfsargv[4] = __UNCONST("fictional");
+ dtfsargv[5] = NULL;
+
+ theargv = dtfsargv;
+ }
/* Create sucketpair for communication with the real file server */
if (socketpair(PF_LOCAL, SOCK_STREAM, 0, sv) == -1)
@@ -270,7 +236,7 @@
if (setenv("PUFFS_COMFD", comfd, 1) == -1)
return errno;
- if (execvp(dtfsargv[0], dtfsargv) == -1)
+ if (execvp(theargv[0], theargv) == -1)
return errno;
case -1:
return errno;
@@ -294,12 +260,14 @@
err(1, "fn 2");
if (read(sv[1], &mntflags, sizeof(mntflags)) != sizeof(mntflags))
err(1, "mntflags");
- if (read(sv[1], &args->pta_pargslen, sizeof(args->pta_pargslen)) != sizeof(args->pta_pargslen))
+ if (read(sv[1], &args->pta_pargslen, sizeof(args->pta_pargslen))
+ != sizeof(args->pta_pargslen))
err(1, "puffstest_args len");
args->pta_pargs = malloc(args->pta_pargslen);
if (args->pta_pargs == NULL)
err(1, "malloc");
- if (read(sv[1], args->pta_pargs, args->pta_pargslen) != (ssize_t)args->pta_pargslen)
+ if (read(sv[1], args->pta_pargs, args->pta_pargslen)
+ != (ssize_t)args->pta_pargslen)
err(1, "puffstest_args");
if (read(sv[1], pflags, sizeof(*pflags)) != sizeof(*pflags))
Home |
Main Index |
Thread Index |
Old Index