Source-Changes-HG archive

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

[src/trunk]: src/tests/fs Pass down the filesystem type to the test funtion t...



details:   https://anonhg.NetBSD.org/src/rev/ef09c8ed3d21
branches:  trunk
changeset: 756248:ef09c8ed3d21
user:      njoly <njoly%NetBSD.org@localhost>
date:      Fri Jul 09 14:16:05 2010 +0000

description:
Pass down the filesystem type to the test funtion to allow fs-specific
callpoints.

Adjust t_rmdirrace by moving LFS test specific code from common/lfs.c,
and do skip sysvbfs which does not support rmdir(2).

from pooka.

diffstat:

 tests/fs/common/h_fsmacros.h |   4 ++--
 tests/fs/common/lfs.c        |   7 +------
 tests/fs/vfs/t_rmdirrace.c   |  18 ++++++++++++++++--
 3 files changed, 19 insertions(+), 10 deletions(-)

diffs (89 lines):

diff -r 922df8960261 -r ef09c8ed3d21 tests/fs/common/h_fsmacros.h
--- a/tests/fs/common/h_fsmacros.h      Fri Jul 09 12:00:38 2010 +0000
+++ b/tests/fs/common/h_fsmacros.h      Fri Jul 09 14:16:05 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_fsmacros.h,v 1.3 2010/07/08 13:21:02 pooka Exp $     */
+/*     $NetBSD: h_fsmacros.h,v 1.4 2010/07/09 14:16:05 njoly Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
       atf_tc_fail("newfs failed"); \
     if (fs##_mount(tmp, MNTNAME, 0) != 0) \
       atf_tc_fail("mount failed"); \
-    func(MNTNAME); \
+    func(type,MNTNAME); \
     if (fs##_unmount(MNTNAME, 0) != 0) \
       atf_tc_fail("unmount failed"); \
     if (fs##_delfs(tmp) != 0) \
diff -r 922df8960261 -r ef09c8ed3d21 tests/fs/common/lfs.c
--- a/tests/fs/common/lfs.c     Fri Jul 09 12:00:38 2010 +0000
+++ b/tests/fs/common/lfs.c     Fri Jul 09 14:16:05 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.c,v 1.2 2010/07/08 13:30:53 pooka Exp $    */
+/*     $NetBSD: lfs.c,v 1.3 2010/07/09 14:16:05 njoly Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,11 +85,6 @@
        *buf = args;
        num++;
 
-       /*
-        * XXX: this should be IN THE TEST, not here
-        */
-       atf_tc_expect_signal(-1, "PR kern/43582");
-
        return 0;
 }
 
diff -r 922df8960261 -r ef09c8ed3d21 tests/fs/vfs/t_rmdirrace.c
--- a/tests/fs/vfs/t_rmdirrace.c        Fri Jul 09 12:00:38 2010 +0000
+++ b/tests/fs/vfs/t_rmdirrace.c        Fri Jul 09 14:16:05 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_rmdirrace.c,v 1.2 2010/07/05 13:03:19 njoly Exp $    */
+/*     $NetBSD: t_rmdirrace.c,v 1.3 2010/07/09 14:16:05 njoly Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,6 +34,7 @@
 #include <atf-c.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <rump/rump_syscalls.h>
@@ -62,11 +63,16 @@
 }
 
 static void
-race(const char *path)
+race(const char *type, const char *path)
 {
        int res, fd, quit;
        pthread_t th1, th2;
 
+       if (strcmp(type, "lfs") == 0)
+               atf_tc_expect_signal(-1, "PR kern/43582");
+       if (strcmp(type, "sysvbfs") == 0)
+               atf_tc_skip("%s does not support rmdir(2)", type);
+
        fd = rump_sys_open(".", O_RDONLY, 0666);
        if (fd == -1)
                atf_tc_fail("open failed");
@@ -97,6 +103,14 @@
        res = rump_sys_fchdir(fd);
        if (res == -1)
                atf_tc_fail("fchdir failed");
+
+       /*
+        * Rarely the LFS test does not crash.  atf currently has no way of
+        * saying "just chill even if the test doesn't fail", so this
+        * takes care of it.
+        */
+       if (strcmp(type, "lfs") == 0)
+               abort();
 }
 
 ATF_FSAPPLY(race, "rmdir(2) race");



Home | Main Index | Thread Index | Old Index