Source-Changes-HG archive

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

[src/trunk]: src/tests/fs Get rid of home made filesystem type strings and us...



details:   https://anonhg.NetBSD.org/src/rev/7eaca460e822
branches:  trunk
changeset: 756249:7eaca460e822
user:      njoly <njoly%NetBSD.org@localhost>
date:      Fri Jul 09 14:30:53 2010 +0000

description:
Get rid of home made filesystem type strings and use MOUNT_xxx ones
instead. While here provide some macros which do test for a specific
type.

diffstat:

 tests/fs/common/h_fsmacros.h |  23 ++++++++++++++++-------
 tests/fs/vfs/t_rmdirrace.c   |   9 ++++-----
 2 files changed, 20 insertions(+), 12 deletions(-)

diffs (87 lines):

diff -r ef09c8ed3d21 -r 7eaca460e822 tests/fs/common/h_fsmacros.h
--- a/tests/fs/common/h_fsmacros.h      Fri Jul 09 14:16:05 2010 +0000
+++ b/tests/fs/common/h_fsmacros.h      Fri Jul 09 14:30:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_fsmacros.h,v 1.4 2010/07/09 14:16:05 njoly Exp $     */
+/*     $NetBSD: h_fsmacros.h,v 1.5 2010/07/09 14:30:53 njoly Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef __H_FSMACROS_H_
 #define __H_FSMACROS_H_
 
+#include <sys/mount.h>
+
 #include <atf-c.h>
 #include <string.h>
 
@@ -72,12 +74,12 @@
   ATF_TP_ADD_TC(tp,fs##_##func)
 
 #define ATF_TC_FSAPPLY(func,desc) \
-  ATF_TC_FSADD(ext2fs,"ext2fs",func,desc) \
-  ATF_TC_FSADD(ffs,"ffs",func,desc) \
-  ATF_TC_FSADD(lfs,"lfs",func,desc) \
-  ATF_TC_FSADD(msdosfs,"msdosfs",func,desc) \
-  ATF_TC_FSADD(sysvbfs,"sysvbfs",func,desc) \
-  ATF_TC_FSADD(tmpfs,"tmpfs",func,desc)
+  ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \
+  ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
+  ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
+  ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
+  ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
+  ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
 
 #define ATF_TP_FSAPPLY(func) \
   ATF_TP_FSADD(ext2fs,func); \
@@ -108,4 +110,11 @@
   atf_tc_skip("filesystem not selected");
 }
 
+#define FSTYPE_EXT2FS(type)    (strcmp(type, MOUNT_EXT2FS) == 0)
+#define FSTYPE_FFS(type)       (strcmp(type, MOUNT_FFS) == 0)
+#define FSTYPE_LFS(type)       (strcmp(type, MOUNT_LFS) == 0)
+#define FSTYPE_MSDOS(type)     (strcmp(type, MOUNT_MSDOS) == 0)
+#define FSTYPE_SYSVBFS(type)   (strcmp(type, MOUNT_SYSVBFS) == 0)
+#define FSTYPE_TMPFS(type)     (strcmp(type, MOUNT_TMPFS) == 0)
+
 #endif /* __H_FSMACROS_H_ */
diff -r ef09c8ed3d21 -r 7eaca460e822 tests/fs/vfs/t_rmdirrace.c
--- a/tests/fs/vfs/t_rmdirrace.c        Fri Jul 09 14:16:05 2010 +0000
+++ b/tests/fs/vfs/t_rmdirrace.c        Fri Jul 09 14:30:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_rmdirrace.c,v 1.3 2010/07/09 14:16:05 njoly Exp $    */
+/*     $NetBSD: t_rmdirrace.c,v 1.4 2010/07/09 14:30:53 njoly Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,6 @@
 #include <atf-c.h>
 #include <fcntl.h>
 #include <pthread.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <rump/rump_syscalls.h>
@@ -68,9 +67,9 @@
        int res, fd, quit;
        pthread_t th1, th2;
 
-       if (strcmp(type, "lfs") == 0)
+       if (FSTYPE_LFS(type))
                atf_tc_expect_signal(-1, "PR kern/43582");
-       if (strcmp(type, "sysvbfs") == 0)
+       if (FSTYPE_SYSVBFS(type))
                atf_tc_skip("%s does not support rmdir(2)", type);
 
        fd = rump_sys_open(".", O_RDONLY, 0666);
@@ -109,7 +108,7 @@
         * saying "just chill even if the test doesn't fail", so this
         * takes care of it.
         */
-       if (strcmp(type, "lfs") == 0)
+       if (FSTYPE_LFS(type))
                abort();
 }
 



Home | Main Index | Thread Index | Old Index