Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add test program that use sample code from kern/41937, and f...
details: https://anonhg.NetBSD.org/src/rev/43f9fe0ea6fb
branches: trunk
changeset: 756052:43f9fe0ea6fb
user: njoly <njoly%NetBSD.org@localhost>
date: Mon Jul 05 12:53:58 2010 +0000
description:
Add test program that use sample code from kern/41937, and fs rump
helpers to check currently supported filesystems.
t_rmdirrace (1/1): 5 test cases
ext2fs_race: Passed.
ffs_race: Passed.
msdosfs_race: Passed.
sysvbfs_race: Passed.
tmpfs_race: Passed.
diffstat:
distrib/sets/lists/tests/mi | 7 ++-
etc/mtree/NetBSD.dist.base | 4 +-
tests/fs/Makefile | 3 +-
tests/fs/vfs/Atffile | 6 ++
tests/fs/vfs/Makefile | 17 +++++++
tests/fs/vfs/t_rmdirrace.c | 102 ++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 136 insertions(+), 3 deletions(-)
diffs (206 lines):
diff -r a53fc1dc7527 -r 43f9fe0ea6fb distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Jul 05 10:37:36 2010 +0000
+++ b/distrib/sets/lists/tests/mi Mon Jul 05 12:53:58 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.97 2010/07/04 19:34:44 pooka Exp $
+# $NetBSD: mi,v 1.98 2010/07/05 12:53:58 njoly Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -211,6 +211,8 @@
./usr/libdata/debug/usr/tests/fs/union tests-fs-debug
./usr/libdata/debug/usr/tests/fs/union/t_basic.debug tests-fs-debug debug,atf
./usr/libdata/debug/usr/tests/fs/union/t_pr.debug tests-fs-debug debug,atf
+./usr/libdata/debug/usr/tests/fs/vfs tests-fs-debug
+./usr/libdata/debug/usr/tests/fs/vfs/t_rmdirrace.debug tests-fs-debug debug,atf
./usr/libdata/debug/usr/tests/ipf tests-ipf-tests
./usr/libdata/debug/usr/tests/kernel tests-kernel-tests
./usr/libdata/debug/usr/tests/kernel/kqueue tests-kernel-tests
@@ -919,6 +921,9 @@
./usr/tests/fs/union/Atffile tests-fs-tests atf
./usr/tests/fs/union/t_basic tests-fs-tests atf
./usr/tests/fs/union/t_pr tests-fs-tests atf
+./usr/tests/fs/vfs tests-fs-tests
+./usr/tests/fs/vfs/Atffile tests-fs-tests atf
+./usr/tests/fs/vfs/t_rmdirrace tests-fs-tests atf
./usr/tests/games tests-games-tests
./usr/tests/games/Atffile tests-games-tests
./usr/tests/games/t_factor tests-games-tests
diff -r a53fc1dc7527 -r 43f9fe0ea6fb etc/mtree/NetBSD.dist.base
--- a/etc/mtree/NetBSD.dist.base Mon Jul 05 10:37:36 2010 +0000
+++ b/etc/mtree/NetBSD.dist.base Mon Jul 05 12:53:58 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.dist.base,v 1.29 2010/07/04 19:33:18 pooka Exp $
+# $NetBSD: NetBSD.dist.base,v 1.30 2010/07/05 12:53:58 njoly Exp $
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
# Do not customize this file as it may be overwritten on upgrades.
@@ -210,6 +210,7 @@
./usr/libdata/debug/usr/tests/fs/tmpfs
./usr/libdata/debug/usr/tests/fs/umapfs
./usr/libdata/debug/usr/tests/fs/union
+./usr/libdata/debug/usr/tests/fs/vfs
./usr/libdata/debug/usr/tests/ipf
./usr/libdata/debug/usr/tests/kernel
./usr/libdata/debug/usr/tests/kernel/kqueue
@@ -1110,6 +1111,7 @@
./usr/tests/fs/tmpfs
./usr/tests/fs/umapfs
./usr/tests/fs/union
+./usr/tests/fs/vfs
./usr/tests/games
./usr/tests/ipf
./usr/tests/ipf/expected
diff -r a53fc1dc7527 -r 43f9fe0ea6fb tests/fs/Makefile
--- a/tests/fs/Makefile Mon Jul 05 10:37:36 2010 +0000
+++ b/tests/fs/Makefile Mon Jul 05 12:53:58 2010 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.11 2010/06/28 09:45:06 pooka Exp $
+# $NetBSD: Makefile,v 1.12 2010/07/05 12:53:58 njoly Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/fs
SUBDIR+= ffs kernfs lfs msdosfs nullfs ptyfs puffs tmpfs umapfs union
+SUBDIR+= vfs
FILES= h_funcs.subr
FILESDIR= ${TESTSDIR}
diff -r a53fc1dc7527 -r 43f9fe0ea6fb tests/fs/vfs/Atffile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/vfs/Atffile Mon Jul 05 12:53:58 2010 +0000
@@ -0,0 +1,6 @@
+Content-Type: application/X-atf-atffile; version="1"
+X-NetBSD-Id: "$NetBSD: Atffile,v 1.1 2010/07/05 12:53:58 njoly Exp $"
+
+prop: test-suite = "NetBSD"
+
+tp: t_rmdirrace
diff -r a53fc1dc7527 -r 43f9fe0ea6fb tests/fs/vfs/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/vfs/Makefile Mon Jul 05 12:53:58 2010 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1 2010/07/05 12:53:58 njoly Exp $
+#
+
+TESTSDIR= ${TESTSBASE}/fs/vfs
+WARNS= 4
+
+TESTS_C= t_rmdirrace
+
+LDADD+=-lrumpfs_ext2fs # ext2fs
+LDADD+=-lrumpfs_ffs # ffs
+LDADD+=-lrumpfs_msdos # msdos
+LDADD+=-lrumpfs_sysvbfs # sysvbfs
+LDADD+=-lrumpfs_tmpfs # tmpfs
+LDADD+=-lrumpdev_disk -lrumpdev # disk device
+LDADD+=-lrumpvfs -lrump -lrumpuser -lpthread # base
+
+.include <bsd.test.mk>
diff -r a53fc1dc7527 -r 43f9fe0ea6fb tests/fs/vfs/t_rmdirrace.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/vfs/t_rmdirrace.c Mon Jul 05 12:53:58 2010 +0000
@@ -0,0 +1,102 @@
+/* $NetBSD: t_rmdirrace.c,v 1.1 2010/07/05 12:53:58 njoly Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/stat.h>
+
+#include <atf-c.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <rump/rump_syscalls.h>
+#include <rump/rump.h>
+
+#include "../common/h_fsmacros.h"
+
+#define DIRNAME "rmdir.test"
+
+static void *func1(void *arg)
+{
+
+ while (*(int *)arg != 1)
+ rump_sys_mkdir(DIRNAME, 0755);
+
+ return NULL;
+}
+
+static void *func2(void *arg)
+{
+
+ while (*(int *)arg != 1)
+ rump_sys_rmdir(DIRNAME);
+
+ return NULL;
+}
+
+static void
+race(const char *path)
+{
+ int res, fd, quit;
+ pthread_t th1, th2;
+
+ fd = rump_sys_open(".", O_RDONLY, 0666);
+ if (fd == -1)
+ atf_tc_fail("open failed");
+ res = rump_sys_chdir(path);
+ if (res == -1)
+ atf_tc_fail("chdir failed");
+
+ quit = 0;
+
+ res = pthread_create(&th1, NULL, func1, &quit);
+ if (res != 0)
+ atf_tc_fail("pthread_create1 failed");
+ res = pthread_create(&th2, NULL, func2, &quit);
+ if (res != 0)
+ atf_tc_fail("pthread_create2 failed");
+
+ sleep(10);
+
+ quit = 1;
+
+ res = pthread_join(th2, NULL);
+ if (res != 0)
+ atf_tc_fail("pthread_join2 failed");
+ res = pthread_join(th1, NULL);
+ if (res != 0)
+ atf_tc_fail("pthread_join1 failed");
+
+ res = rump_sys_fchdir(fd);
+ if (res == -1)
+ atf_tc_fail("fchdir failed");
+}
+
+ATF_FSAPPLY(race, "rmdir(2) race");
Home |
Main Index |
Thread Index |
Old Index