Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/fs Convert the file system test common routines into a...



details:   https://anonhg.NetBSD.org/src/rev/b5222eb45b7b
branches:  trunk
changeset: 756490:b5222eb45b7b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Jul 19 16:09:07 2010 +0000

description:
Convert the file system test common routines into a library to
facilitate more complex user-side stuff (like the lfs cleaner and
nfs rpc code), which are non-trivial to do by #include.

diffstat:

 tests/fs/Makefile            |   4 ++--
 tests/fs/common/Makefile     |   9 +++++++++
 tests/fs/common/ext2fs.c     |  12 +++++++-----
 tests/fs/common/ffs.c        |  12 +++++++-----
 tests/fs/common/h_fsmacros.h |  22 ++++++++++++++--------
 tests/fs/common/lfs.c        |  12 +++++++-----
 tests/fs/common/msdosfs.c    |  12 +++++++-----
 tests/fs/common/puffs.c      |  12 +++++++-----
 tests/fs/common/sysvbfs.c    |  12 +++++++-----
 tests/fs/common/tmpfs.c      |  12 +++++++-----
 tests/fs/vfs/Makefile        |   5 ++++-
 11 files changed, 78 insertions(+), 46 deletions(-)

diffs (truncated from 452 to 300 lines):

diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/Makefile
--- a/tests/fs/Makefile Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/Makefile Mon Jul 19 16:09:07 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.15 2010/07/13 21:13:22 jmmv Exp $
+# $NetBSD: Makefile,v 1.16 2010/07/19 16:09:07 pooka Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=      ${TESTSBASE}/fs
 
-TESTS_SUBDIRS+=        ffs kernfs lfs msdosfs nullfs psshfs ptyfs puffs
+TESTS_SUBDIRS+=        common .WAIT ffs kernfs lfs msdosfs nullfs psshfs ptyfs puffs
 TESTS_SUBDIRS+=        tmpfs umapfs union
 TESTS_SUBDIRS+=        vfs
 
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/common/Makefile  Mon Jul 19 16:09:07 2010 +0000
@@ -0,0 +1,9 @@
+#      $NetBSD: Makefile,v 1.1 2010/07/19 16:09:08 pooka Exp $
+#
+
+LIB=   vfstest
+SRCS=  ext2fs.c ffs.c lfs.c msdosfs.c puffs.c sysvbfs.c tmpfs.c
+
+LIBISPRIVATE=  # yup
+
+.include <bsd.lib.mk>
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/ext2fs.c
--- a/tests/fs/common/ext2fs.c  Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/ext2fs.c  Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $ */
+/*     $NetBSD: ext2fs.c,v 1.5 2010/07/19 16:09:08 pooka Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -43,13 +43,15 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include "h_fsmacros.h"
+
 struct ext2fstestargs {
         struct ufs_args ta_uargs;
         char ta_devpath[MAXPATHLEN];
         char ta_imgpath[MAXPATHLEN];
 };
 
-static int
+int
 ext2fs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
     off_t size)
 {
@@ -89,7 +91,7 @@
        return res;
 }
 
-static int
+int
 ext2fs_fstest_delfs(const atf_tc_t *tc, void *buf)
 {
        int res;
@@ -108,7 +110,7 @@
        return 0;
 }
 
-static int
+int
 ext2fs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 {
        int res;
@@ -123,7 +125,7 @@
        return res;
 }
 
-static int
+int
 ext2fs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
        int res;
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/ffs.c
--- a/tests/fs/common/ffs.c     Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/ffs.c     Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $    */
+/*     $NetBSD: ffs.c,v 1.5 2010/07/19 16:09:08 pooka Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -43,13 +43,15 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include "h_fsmacros.h"
+
 struct ffstestargs {
         struct ufs_args ta_uargs;
         char ta_devpath[MAXPATHLEN];
         char ta_imgpath[MAXPATHLEN];
 };
 
-static int
+int
 ffs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
 {
        char cmd[1024];
@@ -87,7 +89,7 @@
        return 0;
 }
 
-static int
+int
 ffs_fstest_delfs(const atf_tc_t *tc, void *buf)
 {
        int res;
@@ -106,7 +108,7 @@
        return 0;
 }
 
-static int
+int
 ffs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 {
        int res;
@@ -121,7 +123,7 @@
        return res;
 }
 
-static int
+int
 ffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
        int res;
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/h_fsmacros.h
--- a/tests/fs/common/h_fsmacros.h      Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/h_fsmacros.h      Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_fsmacros.h,v 1.10 2010/07/13 16:48:15 pooka Exp $    */
+/*     $NetBSD: h_fsmacros.h,v 1.11 2010/07/19 16:09:08 pooka Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,13 +37,19 @@
 #include <atf-c.h>
 #include <string.h>
 
-#include "ext2fs.c"
-#include "ffs.c"
-#include "lfs.c"
-#include "msdosfs.c"
-#include "puffs.c"
-#include "sysvbfs.c"
-#include "tmpfs.c"
+#define FSPROTOS(_fs_)                                                 \
+int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, off_t);\
+int _fs_##_fstest_delfs(const atf_tc_t *, void *);                     \
+int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int);  \
+int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int);
+
+FSPROTOS(ext2fs);
+FSPROTOS(ffs);
+FSPROTOS(lfs);
+FSPROTOS(msdosfs);
+FSPROTOS(puffs);
+FSPROTOS(sysvbfs);
+FSPROTOS(tmpfs);
 
 #define IMGNAME "image.fs"
 #define IMGSIZE (10000 * 512)
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/lfs.c
--- a/tests/fs/common/lfs.c     Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/lfs.c     Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.c,v 1.6 2010/07/13 15:50:31 njoly Exp $    */
+/*     $NetBSD: lfs.c,v 1.7 2010/07/19 16:09:08 pooka Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -43,13 +43,15 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include "h_fsmacros.h"
+
 struct lfstestargs {
         struct ufs_args ta_uargs;
         char ta_devpath[MAXPATHLEN];
         char ta_imgpath[MAXPATHLEN];
 };
 
-static int
+int
 lfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image, off_t size)
 {
        char cmd[1024];
@@ -88,7 +90,7 @@
        return 0;
 }
 
-static int
+int
 lfs_fstest_delfs(const atf_tc_t *tc, void *buf)
 {
        int res;
@@ -107,7 +109,7 @@
        return 0;
 }
 
-static int
+int
 lfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 {
        int res;
@@ -124,7 +126,7 @@
        return res;
 }
 
-static int
+int
 lfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
        int res;
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/msdosfs.c
--- a/tests/fs/common/msdosfs.c Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/msdosfs.c Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs.c,v 1.4 2010/07/13 15:50:31 njoly Exp $        */
+/*     $NetBSD: msdosfs.c,v 1.5 2010/07/19 16:09:08 pooka Exp $        */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -43,13 +43,15 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include "h_fsmacros.h"
+
 struct msdosfstestargs {
         struct msdosfs_args ta_uargs;
         char ta_devpath[MAXPATHLEN];
         char ta_imgpath[MAXPATHLEN];
 };
 
-static int
+int
 msdosfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
     off_t size)
 {
@@ -89,7 +91,7 @@
        return 0;
 }
 
-static int
+int
 msdosfs_fstest_delfs(const atf_tc_t *tc, void *buf)
 {
        int res;
@@ -108,7 +110,7 @@
        return 0;
 }
 
-static int
+int
 msdosfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 {
        int res;
@@ -123,7 +125,7 @@
        return res;
 }
 
-static int
+int
 msdosfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
        int res;
diff -r 79334ddafb79 -r b5222eb45b7b tests/fs/common/puffs.c
--- a/tests/fs/common/puffs.c   Mon Jul 19 16:00:45 2010 +0000
+++ b/tests/fs/common/puffs.c   Mon Jul 19 16:09:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.c,v 1.2 2010/07/13 17:49:24 pooka Exp $  */
+/*     $NetBSD: puffs.c,v 1.3 2010/07/19 16:09:08 pooka Exp $  */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -47,6 +47,8 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include "h_fsmacros.h"
+
 struct puffstestargs {
        uint8_t                 *pta_pargs;
        size_t                  pta_pargslen;
@@ -214,7 +216,7 @@
 }
 
 /* XXX: we don't support size */
-static int



Home | Main Index | Thread Index | Old Index