Module Name:    src
Committed By:   njoly
Date:           Fri Jul  9 14:16:05 UTC 2010

Modified Files:
        src/tests/fs/common: h_fsmacros.h lfs.c
        src/tests/fs/vfs: t_rmdirrace.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/lfs.c
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_rmdirrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.3 src/tests/fs/common/h_fsmacros.h:1.4
--- src/tests/fs/common/h_fsmacros.h:1.3	Thu Jul  8 13:21:02 2010
+++ src/tests/fs/common/h_fsmacros.h	Fri Jul  9 14:16:05 2010
@@ -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) \

Index: src/tests/fs/common/lfs.c
diff -u src/tests/fs/common/lfs.c:1.2 src/tests/fs/common/lfs.c:1.3
--- src/tests/fs/common/lfs.c:1.2	Thu Jul  8 13:30:53 2010
+++ src/tests/fs/common/lfs.c	Fri Jul  9 14:16:05 2010
@@ -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;
 }
 

Index: src/tests/fs/vfs/t_rmdirrace.c
diff -u src/tests/fs/vfs/t_rmdirrace.c:1.2 src/tests/fs/vfs/t_rmdirrace.c:1.3
--- src/tests/fs/vfs/t_rmdirrace.c:1.2	Mon Jul  5 13:03:19 2010
+++ src/tests/fs/vfs/t_rmdirrace.c	Fri Jul  9 14:16:05 2010
@@ -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");

Reply via email to