Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/fs/common Add a puffs-p2k-ffs file system type to auto...
details: https://anonhg.NetBSD.org/src/rev/babb6629e8b1
branches: trunk
changeset: 760538:babb6629e8b1
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Jan 07 10:45:45 2011 +0000
description:
Add a puffs-p2k-ffs file system type to automated tests. Inspired
by the file handle problem in p2k.
diffstat:
tests/fs/common/fstest_puffs.c | 95 ++++++++++++++++++++++++++++++-----------
tests/fs/common/h_fsmacros.h | 5 +-
2 files changed, 73 insertions(+), 27 deletions(-)
diffs (180 lines):
diff -r 1989a59e86fb -r babb6629e8b1 tests/fs/common/fstest_puffs.c
--- a/tests/fs/common/fstest_puffs.c Fri Jan 07 10:18:06 2011 +0000
+++ b/tests/fs/common/fstest_puffs.c Fri Jan 07 10:45:45 2011 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: fstest_puffs.c,v 1.7 2010/12/29 22:56:59 yamt Exp $ */
+/* $NetBSD: fstest_puffs.c,v 1.8 2011/01/07 10:45:45 pooka Exp $ */
/*
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -242,14 +242,11 @@
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, void *fspriv)
+static int
+donewfs(const atf_tc_t *tc, void **argp,
+ const char *image, off_t size, void *fspriv, char **theargv)
{
struct puffstestargs *args;
- char dtfs_path[MAXPATHLEN];
- char *dtfsargv[6];
- char **theargv;
pid_t childpid;
int *pflags;
char comfd[16];
@@ -266,24 +263,6 @@
pflags = &args->pta_pflags;
- /* build dtfs exec path from atf test dir */
- sprintf(dtfs_path, "%s/../puffs/h_dtfs/h_dtfs",
- atf_tc_get_config_var(tc, "srcdir"));
-
- 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)
return errno;
@@ -343,6 +322,59 @@
}
int
+puffs_fstest_newfs(const atf_tc_t *tc, void **argp,
+ const char *image, off_t size, void *fspriv)
+{
+ char dtfs_path[MAXPATHLEN];
+ char *dtfsargv[6];
+ char **theargv;
+
+ /* build dtfs exec path from atf test dir */
+ sprintf(dtfs_path, "%s/../puffs/h_dtfs/h_dtfs",
+ atf_tc_get_config_var(tc, "srcdir"));
+
+ 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;
+ }
+
+ return donewfs(tc, argp, image, size, fspriv, theargv);
+}
+
+int
+p2k_ffs_fstest_newfs(const atf_tc_t *tc, void **argp,
+ const char *image, off_t size, void *fspriv)
+{
+ char *rumpffs_argv[5];
+ int rv;
+
+ rump_init();
+ if ((rv = ffs_fstest_newfs(tc, argp, image, size, fspriv)) != 0)
+ return rv;
+ if (mkdir("p2kffsfake", 0777) == -1)
+ return errno;
+
+ setenv("P2K_NODETACH", "1", 1);
+ rumpffs_argv[0] = __UNCONST("rump_ffs");
+ rumpffs_argv[1] = __UNCONST(image);
+ rumpffs_argv[2] = __UNCONST("p2kffsfake"); /* NOTUSED */
+ rumpffs_argv[3] = NULL;
+
+ if ((rv = donewfs(tc, argp, image, size, fspriv, rumpffs_argv)) != 0)
+ ffs_fstest_delfs(tc, argp);
+ return rv;
+}
+
+int
puffs_fstest_mount(const atf_tc_t *tc, void *arg, const char *path, int flags)
{
struct puffstestargs *pargs = arg;
@@ -374,6 +406,7 @@
return 0;
}
+__strong_alias(p2k_ffs_fstest_mount,puffs_fstest_mount);
int
puffs_fstest_delfs(const atf_tc_t *tc, void *arg)
@@ -384,6 +417,13 @@
}
int
+p2k_ffs_fstest_delfs(const atf_tc_t *tc, void *arg)
+{
+
+ return ffs_fstest_delfs(tc, arg);
+}
+
+int
puffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
{
struct puffstestargs *pargs = theargs;
@@ -410,5 +450,8 @@
usleep(500);
wait(&status);
+ rmdir("p2kffsfake");
+
return 0;
}
+__strong_alias(p2k_ffs_fstest_unmount,puffs_fstest_unmount);
diff -r 1989a59e86fb -r babb6629e8b1 tests/fs/common/h_fsmacros.h
--- a/tests/fs/common/h_fsmacros.h Fri Jan 07 10:18:06 2011 +0000
+++ b/tests/fs/common/h_fsmacros.h Fri Jan 07 10:45:45 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_fsmacros.h,v 1.24 2010/12/31 18:16:41 pooka Exp $ */
+/* $NetBSD: h_fsmacros.h,v 1.25 2011/01/07 10:45:45 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -55,6 +55,7 @@
FSPROTOS(msdosfs);
FSPROTOS(nfs);
FSPROTOS(nfsro);
+FSPROTOS(p2k_ffs);
FSPROTOS(puffs);
FSPROTOS(rumpfs);
FSPROTOS(sysvbfs);
@@ -171,6 +172,7 @@
ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
+ ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \
ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
@@ -182,6 +184,7 @@
ATF_TP_FSADD(lfs,func); \
ATF_TP_FSADD(msdosfs,func); \
ATF_TP_FSADD(nfs,func); \
+ ATF_TP_FSADD(p2k_ffs,func); \
ATF_TP_FSADD(puffs,func); \
ATF_TP_FSADD(rumpfs,func); \
ATF_TP_FSADD(sysvbfs,func); \
Home |
Main Index |
Thread Index |
Old Index