CVS commit: src/tests/fs/vfs

2021-06-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 16 23:58:07 UTC 2021

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
tests/fs/vfs: Mark udf_renamerace_cycle flaky, PR kern/56253.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.40 src/tests/fs/vfs/t_renamerace.c:1.41
--- src/tests/fs/vfs/t_renamerace.c:1.40	Sat Sep  5 02:55:39 2020
+++ src/tests/fs/vfs/t_renamerace.c	Wed Jun 16 23:58:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.40 2020/09/05 02:55:39 riastradh Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.41 2021/06/16 23:58:07 riastradh Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -254,6 +254,8 @@ renamerace_cycle(const atf_tc_t *tc, con
 		atf_tc_expect_fail("assertion \"dfd\" failed");
 	if (FSTYPE_NFS(tc))
 		atf_tc_expect_fail("mkdir fails with ESTALE");
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail("sometimes fails with ENOSPC, PR kern/56253");
 
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_MSDOS(tc))
@@ -277,6 +279,9 @@ renamerace_cycle(const atf_tc_t *tc, con
 	alarm(0);
 	RL(rump_sys_chdir("/"));
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_fail("PR kern/56253 did not trigger this time");
+
 	/*
 	 * Doesn't always trigger when run on a slow backend
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.



CVS commit: src/tests/fs/vfs

2020-09-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  5 02:45:23 UTC 2020

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
tests/fs/vfs/t_renamerace: Test a screw case hannken@ found.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.36 src/tests/fs/vfs/t_renamerace.c:1.37
--- src/tests/fs/vfs/t_renamerace.c:1.36	Sat Aug 17 09:44:01 2019
+++ src/tests/fs/vfs/t_renamerace.c	Sat Sep  5 02:45:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.36 2019/08/17 09:44:01 gson Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.37 2020/09/05 02:45:22 riastradh Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -86,6 +86,64 @@ w2(void *arg)
 	return NULL;
 }
 
+static void
+w3_mkdir(void)
+{
+
+	if (rump_sys_mkdir("c", 0777) == -1)
+		ATF_CHECK_MSG(errno == ENOENT || errno == EEXIST,
+		"mkdir: %s (errno=%d)\n", strerror(errno), errno);
+	if (rump_sys_mkdir("c/d", 0777) == -1)
+		ATF_CHECK_MSG(errno == ENOENT || errno == EEXIST,
+		"mkdir: %s (errno=%d)\n", strerror(errno), errno);
+	if (rump_sys_mkdir("c/d/e", 0777) == -1)
+		ATF_CHECK_MSG(errno == ENOENT || errno == EEXIST,
+		"mkdir: %s (errno=%d)\n", strerror(errno), errno);
+}
+
+static void *
+w3_rmdir(void *arg)
+{
+
+	rump_pub_lwproc_newlwp(wrkpid);
+
+	while (!quittingtime) {
+		w3_mkdir();
+		rump_sys_rmdir("c/d/e");
+		rump_sys_rmdir("c/d");
+	}
+
+	return NULL;
+}
+
+static void *
+w3_rename1(void *arg)
+{
+
+	rump_pub_lwproc_newlwp(wrkpid);
+
+	while (!quittingtime) {
+		w3_mkdir();
+		rump_sys_rename("c", "c/d/e");
+	}
+
+	return NULL;
+}
+
+static void *
+w3_rename2(void *arg)
+{
+
+	rump_pub_lwproc_newlwp(wrkpid);
+
+	while (!quittingtime) {
+		w3_mkdir();
+		rump_sys_rename("c/d/e", "c");
+	}
+
+	return NULL;
+}
+
 #define NWRK 8
 static void
 renamerace(const atf_tc_t *tc, const char *mp)
@@ -181,14 +239,70 @@ renamerace_dirs(const atf_tc_t *tc, cons
 		abort();
 }
 
+static void
+renamerace_cycle(const atf_tc_t *tc, const char *mp)
+{
+	pthread_t pt_rmdir, pt_rename1, pt_rename2;
+
+	if (FSTYPE_SYSVBFS(tc))
+		atf_tc_skip("directories not supported by file system");
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip("rename not supported by file system");
+	if (FSTYPE_P2K_FFS(tc))
+		atf_tc_expect_fail("assertion \"vp->v_size == ip->i_size\" failed");
+	if (FSTYPE_PUFFS(tc))
+		atf_tc_expect_fail("assertion \"dfd\" failed");
+	if (FSTYPE_NFS(tc))
+		atf_tc_expect_fail("mkdir fails with ESTALE");
+
+	/* XXX: msdosfs also sometimes hangs */
+	if (FSTYPE_MSDOS(tc))
+		atf_tc_expect_signal(-1, "PR kern/43626");
+
+	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
+	RL(wrkpid = rump_sys_getpid());
+
+	RL(rump_sys_chdir(mp));
+	pthread_create(_rmdir, NULL, w3_rmdir, NULL);
+	pthread_create(_rename1, NULL, w3_rename1, NULL);
+	pthread_create(_rename2, NULL, w3_rename2, NULL);
+
+	sleep(10);
+	quittingtime = 1;
+
+	if (FSTYPE_EXT2FS(tc) ||
+	FSTYPE_FFS(tc) ||
+	FSTYPE_FFSLOG(tc) ||
+	FSTYPE_LFS(tc) ||
+	FSTYPE_TMPFS(tc) ||
+	FSTYPE_UDF(tc))
+		atf_tc_expect_signal(SIGALRM, "genfs_rename is busted");
+
+	alarm(1);
+	pthread_join(pt_rmdir, NULL);
+	pthread_join(pt_rename1, NULL);
+	pthread_join(pt_rename2, NULL);
+	alarm(0);
+	RL(rump_sys_chdir("/"));
+
+	/*
+	 * Doesn't always trigger when run on a slow backend
+	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.
+	 */
+	if (FSTYPE_MSDOS(tc))
+		abort();
+}
+
 ATF_TC_FSAPPLY(renamerace, "rename(2) race with file unlinked mid-operation");
 ATF_TC_FSAPPLY(renamerace_dirs, "rename(2) race with directories");
+ATF_TC_FSAPPLY(renamerace_cycle, "rename(2) race making directory cycles");
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_FSAPPLY(renamerace); /* PR kern/41128 */
 	ATF_TP_FSAPPLY(renamerace_dirs);
+	ATF_TP_FSAPPLY(renamerace_cycle);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2020-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  2 11:09:13 UTC 2020

Modified Files:
src/tests/fs/vfs: Makefile

Log Message:
zfs needs rumpkern_sysproxy


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/fs/vfs/Makefile

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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.26 src/tests/fs/vfs/Makefile:1.27
--- src/tests/fs/vfs/Makefile:1.26	Sun Mar  1 13:08:14 2020
+++ src/tests/fs/vfs/Makefile	Mon Mar  2 06:09:13 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2020/03/01 18:08:14 christos Exp $
+#	$NetBSD: Makefile,v 1.27 2020/03/02 11:09:13 christos Exp $
 #
 
 .include 
@@ -45,7 +45,7 @@ LDADD+=-lrumpnet		# static linking
 LDADD+=-lutil
 
 .if (${MKZFS} != "no")
-LDADD+=-lrumpfs_zfs -lrumpkern_solaris -lrumpdev_rnd
+LDADD+=-lrumpfs_zfs -lrumpkern_solaris -lrumpdev_rnd -lrumpkern_sysproxy
 CPPFLAGS+=-DWANT_ZFS_TESTS
 .endif
 



CVS commit: src/tests/fs/vfs

2019-01-13 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Jan 13 14:35:00 UTC 2019

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Mark the fs/vfs/t_renamerace:udf_renamerace_dirs test case as an
expected failure referencing PR kern/53865, and force failure to avoid
reports of unexpected success as it does not realiably fail under
qemu.  This makes the treatment of udf_renamerace_dirs the same as
that of udf_renamerace, only with a different PR.  Also, make
whitespace consistent between the two.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.34 src/tests/fs/vfs/t_renamerace.c:1.35
--- src/tests/fs/vfs/t_renamerace.c:1.34	Fri Jan 13 21:30:40 2017
+++ src/tests/fs/vfs/t_renamerace.c	Sun Jan 13 14:35:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.34 2017/01/13 21:30:40 christos Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.35 2019/01/13 14:35:00 gson Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -147,9 +147,10 @@ renamerace_dirs(const atf_tc_t *tc, cons
 
 	if (FSTYPE_SYSVBFS(tc))
 		atf_tc_skip("directories not supported by file system");
-
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip("rename not supported by file system");
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail("PR kern/53865");
 
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_MSDOS(tc))
@@ -169,6 +170,9 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	pthread_join(pt2, NULL);
 	RL(rump_sys_chdir("/"));
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_fail("race did not trigger this time");
+
 	/*
 	 * Doesn't always trigger when run on a slow backend
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.



CVS commit: src/tests/fs/vfs

2018-11-30 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov 30 09:52:39 UTC 2018

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
Skip zfs, it does not GOP_ALLOC.

PR kern/47656 test zfs_fillfs.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.9 src/tests/fs/vfs/t_full.c:1.10
--- src/tests/fs/vfs/t_full.c:1.9	Fri Jan 13 21:30:40 2017
+++ src/tests/fs/vfs/t_full.c	Fri Nov 30 09:52:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.9 2017/01/13 21:30:40 christos Exp $	*/
+/*	$NetBSD: t_full.c,v 1.10 2018/11/30 09:52:39 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,8 @@ fillfs(const atf_tc_t *tc, const char *m
 	size_t bonus;
 	int fd, i = 0;
 
-	if (FSTYPE_P2K_FFS(tc) || FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
+	if (FSTYPE_P2K_FFS(tc) || FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc) ||
+	FSTYPE_ZFS(tc)) {
 		atf_tc_skip("fs does not support explicit block allocation "
 		"(GOP_ALLOC)");
 	}
@@ -77,8 +78,6 @@ fillfs(const atf_tc_t *tc, const char *m
 		if (n == -1)
 			break;
 	}
-	if (FSTYPE_ZFS(tc))
-		atf_tc_expect_fail("PR kern/47656: Test known to be broken");
 	if (n == -1) {
 		if (errno != ENOSPC)
 			atf_tc_fail_errno("write");



CVS commit: src/tests/fs/vfs

2017-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  2 22:07:05 UTC 2017

Modified Files:
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/vfs: t_mtime_otrunc.c

Log Message:
PR kern/51762: add a test program


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_mtime_otrunc.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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.23 src/tests/fs/vfs/Makefile:1.24
--- src/tests/fs/vfs/Makefile:1.23	Fri Jan 27 10:45:11 2017
+++ src/tests/fs/vfs/Makefile	Thu Feb  2 22:07:05 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2017/01/27 10:45:11 hannken Exp $
+#	$NetBSD: Makefile,v 1.24 2017/02/02 22:07:05 martin Exp $
 #
 
 .include 
@@ -14,6 +14,7 @@ TESTS_C+=	t_rmdirrace
 TESTS_C+=	t_rwtoro
 TESTS_C+=	t_union
 TESTS_C+=	t_unpriv
+TESTS_C+=	t_mtime_otrunc
 TESTS_C+=	t_vfsops
 TESTS_C+=	t_vnops
 

Added files:

Index: src/tests/fs/vfs/t_mtime_otrunc.c
diff -u /dev/null src/tests/fs/vfs/t_mtime_otrunc.c:1.1
--- /dev/null	Thu Feb  2 22:07:05 2017
+++ src/tests/fs/vfs/t_mtime_otrunc.c	Thu Feb  2 22:07:05 2017
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 
+__COPYRIGHT("@(#) Copyright (c) 2013\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: t_mtime_otrunc.c,v 1.1 2017/02/02 22:07:05 martin Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "../common/h_fsmacros.h"
+
+#define LOCKFILE	"lock"
+
+static time_t
+lock_it(void)
+{
+	struct stat st;
+
+	if (rump_sys_stat(LOCKFILE, ) != 0)
+		st.st_mtime = 0;
+
+	int f = rump_sys_open(LOCKFILE, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+	if (f == -1) return 0;
+	rump_sys_close(f);
+
+	return st.st_mtime;
+}
+
+static void
+otrunc_mtime_update(const atf_tc_t *tc, const char *path)
+{
+	time_t last_ts = 0;
+	int res;
+
+	/* atf_tc_expect_fail("PR kern/51762"); */
+
+	res = rump_sys_chdir(path);
+	if (res == -1)
+		atf_tc_fail("chdir failed");
+
+	for (int i = 0; i < 5; i++) {
+		time_t l = lock_it();
+		printf("last lock: %ld\n", (long)l);
+		ATF_REQUIRE_MSG(i == 0 || l > last_ts,
+		"iteration %d: lock time did not increase, old time %lu, "
+		"new time %lu", i,
+		(unsigned long)last_ts, (unsigned long)l);
+		last_ts = l;
+		sleep(2);
+	}
+	rump_sys_chdir("/");
+}
+
+ATF_FSAPPLY(otrunc_mtime_update, "Checks for mtime updates by open(O_TRUNC) (PR kern/51762)");



CVS commit: src/tests/fs/vfs

2016-08-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Aug 29 02:31:46 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
PR kern/49033

POSIX allows for the atime (or technically, any of the times) to be
updated as a side effect of searching a directory (allows, not requires).
The NetBSD UDF implementation apparently works that way, treating a
directory search as a read of the directory, and hence updating the
access time.   Compensate for that in the test (rather than just
expecting failure) by verifying that the atime after the directory
search is within a small margin of the atime before the search
(currently, "small" is 1 second).   We could fetch the time before
the mkdir and both stat() calls, do all of that, fetch the time after,
subtract, and require the after stat() atime to be bounded by the atime
set by the original mkdir and returned in the first stat() and that time
+ the difference in elapsed time - that would be more accurate, but is
a lot more work for little real benefit.

Should anyone be interested in doing that extra work, remember to use
monotonic time (clock_gettime(CLOCK_MOMNOTONIC, ...)) not the time of day
clock for measuring the elapsed time.

Along with this, remove the "if (udf) failure expected" and the
if (udf && we haven't failed yet) fail("random failure failed to happen")
stuff...  (the "random" would have been that sometimes the mkdir and
two lookups (stat() calls) would all occur within the same clock tick,
meaning that the atimes would all be the same.  Other times the clock
would tick somewhere between the mkdir() and the 2nd stat().)


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.57 src/tests/fs/vfs/t_vnops.c:1.58
--- src/tests/fs/vfs/t_vnops.c:1.57	Sun Aug 21 13:23:36 2016
+++ src/tests/fs/vfs/t_vnops.c	Mon Aug 29 02:31:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.57 2016/08/21 13:23:36 christos Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -85,12 +86,10 @@ lookup_complex(const atf_tc_t *tc, const
 {
 	char pb[MAXPATHLEN];
 	struct stat sb1, sb2;
+	struct timespec atplus1, onesec;
 
 	USES_DIRS;
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_expect_fail("PR kern/49033");
-
 	snprintf(pb, sizeof(pb), "%s/dir", mountpath);
 	if (rump_sys_mkdir(pb, 0777) == -1)
 		atf_tc_fail_errno("mkdir");
@@ -101,6 +100,24 @@ lookup_complex(const atf_tc_t *tc, const
 	if (rump_sys_stat(pb, ) == -1)
 		atf_tc_fail_errno("stat 2");
 
+	/*
+	 * The lookup is permitted to modify the access time of
+	 * any directories searched - such a directory is the
+	 * subject of this test.   Any difference should cause
+	 * the 2nd lookup atime tp be >= the first, if it is ==, all is
+	 * OK (atime is not required to be modified by the search, or
+	 * both references may happen within the came clock tick), if the
+	 * 2nd lookup atime is > the first, but not "too much" greater,
+	 * just set it back, so the memcmp just below succeeds
+	 * (assuming all else is OK).
+	 */
+	onesec.tv_sec = 1;
+	onesec.tv_nsec = 0;
+	timespecadd(_atimespec, , );
+	if (timespeccmp(_atimespec, _atimespec, >) &&
+	timespeccmp(_atimespec, , <))
+		sb2.st_atimespec = sb1.st_atimespec;
+
 	if (memcmp(, , sizeof(sb1)) != 0) {
 		printf("what\tsb1\t\tsb2\n");
 
@@ -133,9 +150,6 @@ lookup_complex(const atf_tc_t *tc, const
 
 		atf_tc_fail("stat results differ, see ouput for more details");
 	}
-	if (FSTYPE_UDF(tc))
-		atf_tc_fail("random failure of PR kern/49033 "
-			"did not happen this time");
 }
 
 static void



CVS commit: src/tests/fs/vfs

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 08:38:58 UTC 2016

Modified Files:
src/tests/fs/vfs: Makefile

Log Message:
Fix static linking.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/fs/vfs/Makefile

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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.21 src/tests/fs/vfs/Makefile:1.22
--- src/tests/fs/vfs/Makefile:1.21	Sat Aug 13 07:21:06 2016
+++ src/tests/fs/vfs/Makefile	Sat Aug 27 04:38:58 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2016/08/13 11:21:06 christos Exp $
+#	$NetBSD: Makefile,v 1.22 2016/08/27 08:38:58 christos Exp $
 #
 
 .include 
@@ -36,6 +36,7 @@ VFSTESTDIR != cd ${.CURDIR}/../common &&
 LDADD+=-L${VFSTESTDIR} -lvfstest
 
 LDADD+=-lrumpvfs -lrumpkern_sysproxy -lrump -lrumpuser		# base
+LDADD+=-lrumpnet		# static linking
 LDADD+=-lpthread
 
 LDADD+=-lutil



CVS commit: src/tests/fs/vfs

2016-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 21 13:23:36 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
fix wrong variable.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.56 src/tests/fs/vfs/t_vnops.c:1.57
--- src/tests/fs/vfs/t_vnops.c:1.56	Sat Aug 20 11:48:18 2016
+++ src/tests/fs/vfs/t_vnops.c	Sun Aug 21 09:23:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.56 2016/08/20 15:48:18 christos Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.57 2016/08/21 13:23:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -632,7 +632,7 @@ symlink_len(const atf_tc_t *tc, const ch
 
 	USES_SYMLINKS;
 
-	RLF(rump_sys_chdir(mp), "%s", buf);
+	RLF(rump_sys_chdir(mp), "%s", mp);
 
 	buf = malloc(len + 1);
 	ATF_REQUIRE(buf);



CVS commit: src/tests/fs/vfs

2016-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 11:21:06 UTC 2016

Modified Files:
src/tests/fs/vfs: Makefile

Log Message:
order network libraries properly.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/fs/vfs/Makefile

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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.20 src/tests/fs/vfs/Makefile:1.21
--- src/tests/fs/vfs/Makefile:1.20	Wed Jan  7 17:24:03 2015
+++ src/tests/fs/vfs/Makefile	Sat Aug 13 07:21:06 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2015/01/07 22:24:03 pooka Exp $
+#	$NetBSD: Makefile,v 1.21 2016/08/13 11:21:06 christos Exp $
 #
 
 .include 
@@ -16,6 +16,8 @@ TESTS_C+=	t_unpriv
 TESTS_C+=	t_vfsops
 TESTS_C+=	t_vnops
 
+LDADD+=-lrumpnet_shmif -lrumpnet -lrumpnet_net -lrumpnet_netinet# TCP/IP
+LDADD+=-lrumpfs_nfs		# NFS
 LDADD+=-lrumpfs_ext2fs		# ext2fs
 LDADD+=-lrumpfs_ffs		# ffs
 LDADD+=-lrumpfs_lfs		# lfs
@@ -33,8 +35,6 @@ LDADD+=-lrumpdev_disk -lrumpdev	# di
 VFSTESTDIR != cd ${.CURDIR}/../common && ${PRINTOBJDIR}
 LDADD+=-L${VFSTESTDIR} -lvfstest
 
-LDADD+=-lrumpfs_nfs		# NFS
-LDADD+=-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
 LDADD+=-lrumpvfs -lrumpkern_sysproxy -lrump -lrumpuser		# base
 LDADD+=-lpthread
 



CVS commit: src/tests/fs/vfs

2016-05-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed May  4 08:30:22 UTC 2016

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Cite a relevant PR for msdos_renamerace instead of one that was fixed
several years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.32 src/tests/fs/vfs/t_renamerace.c:1.33
--- src/tests/fs/vfs/t_renamerace.c:1.32	Tue Jul 29 09:15:48 2014
+++ src/tests/fs/vfs/t_renamerace.c	Wed May  4 08:30:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.32 2014/07/29 09:15:48 gson Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.33 2016/05/04 08:30:22 dholland Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -127,7 +127,7 @@ renamerace(const atf_tc_t *tc, const cha
 		atf_tc_fail("race did not trigger this time");
 
 	if (FSTYPE_MSDOS(tc)) {
-		atf_tc_expect_fail("PR kern/44661");
+		atf_tc_expect_fail("PR kern/43626");
 		/*
 		 * XXX: race does not trigger every time at least
 		 * on amd64/qemu.



CVS commit: src/tests/fs/vfs

2016-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 28 10:10:09 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
The test for PR 50608 works now, remove the expected failure.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.54 src/tests/fs/vfs/t_vnops.c:1.55
--- src/tests/fs/vfs/t_vnops.c:1.54	Thu Jan 14 08:58:02 2016
+++ src/tests/fs/vfs/t_vnops.c	Thu Jan 28 10:10:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.54 2016/01/14 08:58:02 gson Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.55 2016/01/28 10:10:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -495,9 +495,6 @@ create_nonalphanum(const atf_tc_t *tc, c
 	char buf[64];
 	int i;
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_expect_fail("PR kern/50608");
-
 	RL(rump_sys_chdir(mp));
 
 	for (i = 0; i < 256; i++) {



CVS commit: src/tests/fs/vfs

2016-01-14 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Thu Jan 14 08:58:02 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Don't use a filename with an embedded newline in the create_many test
case.  Instead, add a separate test case "create_nonalphanum" for
filenames containing non-alphanumeric characters.  The bug of
PR kern/50608 now causes a failure in create_nonalphanum rather than
create_many.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.53 src/tests/fs/vfs/t_vnops.c:1.54
--- src/tests/fs/vfs/t_vnops.c:1.53	Wed Jan 13 12:05:49 2016
+++ src/tests/fs/vfs/t_vnops.c	Thu Jan 14 08:58:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.53 2016/01/13 12:05:49 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.54 2016/01/14 08:58:02 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -446,9 +447,6 @@ create_many(const atf_tc_t *tc, const ch
 	int nfiles = 2324; /* #Nancy */
 	int i;
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_expect_fail("PR kern/50608");
-
 	/* takes forever with many files */
 	if (FSTYPE_MSDOS(tc))
 		nfiles /= 4;
@@ -469,14 +467,14 @@ create_many(const atf_tc_t *tc, const ch
 	for (i = 0; i < nfiles; i++) {
 		int fd;
 
-		sprintf(buf, TESTFN "%d\n", i);
+		sprintf(buf, TESTFN "%d", i);
 		RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666));
 		RL(rump_sys_close(fd));
 	}
 
 	/* wipe them out */
 	for (i = 0; i < nfiles; i++) {
-		sprintf(buf, TESTFN "%d\n", i);
+		sprintf(buf, TESTFN "%d", i);
 		RL(rump_sys_unlink(buf));
 	}
 #undef TESTFN
@@ -484,6 +482,38 @@ create_many(const atf_tc_t *tc, const ch
 	rump_sys_chdir("/");
 }
 
+/*
+ * Test creating files with one-character names using all possible
+ * character values.  Failures to create the file are ignored as the
+ * characters allowed in file names vary by file system, but at least
+ * we can check that the fs does not crash, and if the file is
+ * successfully created, unlinking it should also succeed.
+ */
+static void
+create_nonalphanum(const atf_tc_t *tc, const char *mp)
+{
+	char buf[64];
+	int i;
+
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail("PR kern/50608");
+
+	RL(rump_sys_chdir(mp));
+
+	for (i = 0; i < 256; i++) {
+		int fd;
+		sprintf(buf, "%c", i);
+		fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666);
+		if (fd == -1)
+			continue;
+		RL(rump_sys_close(fd));
+		RL(rump_sys_unlink(buf));
+	}
+	printf("\n");
+
+	rump_sys_chdir("/");
+}
+
 static void
 create_nametoolong(const atf_tc_t *tc, const char *mp)
 {
@@ -1007,6 +1037,7 @@ ATF_TC_FSAPPLY(lstat_symlink, "lstat(2) 
 #undef FSTEST_IMGSIZE
 #define FSTEST_IMGSIZE (1024*1024*64)
 ATF_TC_FSAPPLY(create_many, "create many directory entries");
+ATF_TC_FSAPPLY(create_nonalphanum, "non-alphanumeric filenames");
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -1020,6 +1051,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);
 	ATF_TP_FSAPPLY(create_many);
+	ATF_TP_FSAPPLY(create_nonalphanum);
 	ATF_TP_FSAPPLY(create_nametoolong);
 	ATF_TP_FSAPPLY(create_exist);
 	ATF_TP_FSAPPLY(rename_nametoolong);



CVS commit: src/tests/fs/vfs

2016-01-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan 13 12:05:49 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
create_many: remove PR kern/50607 xfail

Seems to have been fixed by ext2fs_lookup.c 1.79
(thanks, riastradh)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.52 src/tests/fs/vfs/t_vnops.c:1.53
--- src/tests/fs/vfs/t_vnops.c:1.52	Sat Jan  2 12:11:30 2016
+++ src/tests/fs/vfs/t_vnops.c	Wed Jan 13 12:05:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.52 2016/01/02 12:11:30 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.53 2016/01/13 12:05:49 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -438,6 +438,7 @@ rename_reg_nodir(const atf_tc_t *tc, con
 	rump_sys_chdir("/");
 }
 
+/* PR kern/50607 */
 static void
 create_many(const atf_tc_t *tc, const char *mp)
 {
@@ -445,9 +446,6 @@ create_many(const atf_tc_t *tc, const ch
 	int nfiles = 2324; /* #Nancy */
 	int i;
 
-	if (FSTYPE_EXT2FS(tc))
-		atf_tc_expect_fail("PR kern/50607");
-
 	if (FSTYPE_UDF(tc))
 		atf_tc_expect_fail("PR kern/50608");
 



CVS commit: src/tests/fs/vfs

2016-01-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Jan  2 12:11:31 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
create_many:
  * add xfails for ext2 and udf
  * don't try to create a subdirectory for sysvbfs


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.51 src/tests/fs/vfs/t_vnops.c:1.52
--- src/tests/fs/vfs/t_vnops.c:1.51	Fri Jan  1 15:18:39 2016
+++ src/tests/fs/vfs/t_vnops.c	Sat Jan  2 12:11:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.51 2016/01/01 15:18:39 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.52 2016/01/02 12:11:30 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -445,9 +445,11 @@ create_many(const atf_tc_t *tc, const ch
 	int nfiles = 2324; /* #Nancy */
 	int i;
 
-	/* fs doesn't support many files */
-	if (FSTYPE_SYSVBFS(tc))
-		nfiles = 5;
+	if (FSTYPE_EXT2FS(tc))
+		atf_tc_expect_fail("PR kern/50607");
+
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail("PR kern/50608");
 
 	/* takes forever with many files */
 	if (FSTYPE_MSDOS(tc))
@@ -455,9 +457,14 @@ create_many(const atf_tc_t *tc, const ch
 
 	RL(rump_sys_chdir(mp));
 
-	/* msdosfs doesn't like many entries in the root directory */
-	RL(rump_sys_mkdir("subdir", 0777));
-	RL(rump_sys_chdir("subdir"));
+	if (FSTYPE_SYSVBFS(tc)) {
+		/* fs doesn't support many files or subdirectories */
+		nfiles = 5;
+	} else {
+		/* msdosfs doesn't like many entries in the root directory */
+		RL(rump_sys_mkdir("subdir", 0777));
+		RL(rump_sys_chdir("subdir"));
+	}
 
 	/* create them */
 #define TESTFN "testfile"



CVS commit: src/tests/fs/vfs

2016-01-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  1 15:13:57 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add a test which creates many directory entries.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.49 src/tests/fs/vfs/t_vnops.c:1.50
--- src/tests/fs/vfs/t_vnops.c:1.49	Thu Apr  9 19:47:05 2015
+++ src/tests/fs/vfs/t_vnops.c	Fri Jan  1 15:13:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.49 2015/04/09 19:47:05 riastradh Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.50 2016/01/01 15:13:57 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -439,6 +439,47 @@ rename_reg_nodir(const atf_tc_t *tc, con
 }
 
 static void
+create_many(const atf_tc_t *tc, const char *mp)
+{
+	char buf[64];
+	int nfiles = 2324; /* #Nancy */
+	int i;
+
+	/* fs doesn't support many files */
+	if (FSTYPE_SYSVBFS(tc))
+		nfiles = 5;
+
+	/* takes forever with many files */
+	if (FSTYPE_MSDOS(tc))
+		nfiles /= 4;
+
+	RL(rump_sys_chdir(mp));
+
+	/* msdosfs doesn't like many entries in the root directory */
+	RL(rump_sys_mkdir("subdir", 0777));
+	RL(rump_sys_chdir("subdir"));
+
+	/* create them */
+#define TESTFN "this_is_the_filename"
+	for (i = 0; i < nfiles; i++) {
+		int fd;
+
+		sprintf(buf, TESTFN "%d\n", i);
+		RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666));
+		RL(rump_sys_close(fd));
+	}
+
+	/* wipe them out */
+	for (i = 0; i < nfiles; i++) {
+		sprintf(buf, TESTFN "%d\n", i);
+		RL(rump_sys_unlink(buf));
+	}
+#undef TESTFN
+
+	rump_sys_chdir("/");
+}
+
+static void
 create_nametoolong(const atf_tc_t *tc, const char *mp)
 {
 	char *name;
@@ -958,6 +999,10 @@ ATF_TC_FSAPPLY(access_simple, "access(2)
 ATF_TC_FSAPPLY(read_directory, "read(2) on directories");
 ATF_TC_FSAPPLY(lstat_symlink, "lstat(2) values for symbolic links");
 
+#undef FSTEST_IMGSIZE
+#define FSTEST_IMGSIZE (1024*1024*64)
+ATF_TC_FSAPPLY(create_many, "create many directory entries");
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -969,6 +1014,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(rename_dir);
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);
+	ATF_TP_FSAPPLY(create_many);
 	ATF_TP_FSAPPLY(create_nametoolong);
 	ATF_TP_FSAPPLY(create_exist);
 	ATF_TP_FSAPPLY(rename_nametoolong);



CVS commit: src/tests/fs/vfs

2016-01-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  1 15:18:39 UTC 2016

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
use a shorter filename template in previous (for v7fs)


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.50 src/tests/fs/vfs/t_vnops.c:1.51
--- src/tests/fs/vfs/t_vnops.c:1.50	Fri Jan  1 15:13:57 2016
+++ src/tests/fs/vfs/t_vnops.c	Fri Jan  1 15:18:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.50 2016/01/01 15:13:57 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.51 2016/01/01 15:18:39 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -460,7 +460,7 @@ create_many(const atf_tc_t *tc, const ch
 	RL(rump_sys_chdir("subdir"));
 
 	/* create them */
-#define TESTFN "this_is_the_filename"
+#define TESTFN "testfile"
 	for (i = 0; i < nfiles; i++) {
 		int fd;
 



CVS commit: src/tests/fs/vfs

2015-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  9 19:51:13 UTC 2015

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Apparently I fixed t_unpriv:zfs_owner and didn't notice.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.11 src/tests/fs/vfs/t_unpriv.c:1.12
--- src/tests/fs/vfs/t_unpriv.c:1.11	Fri Aug 29 17:39:18 2014
+++ src/tests/fs/vfs/t_unpriv.c	Thu Apr  9 19:51:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.11 2014/08/29 17:39:18 gson Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.12 2015/04/09 19:51:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,8 +55,6 @@ owner(const atf_tc_t *tc, const char *mp
 	rump_pub_lwproc_rfork(RUMP_RFCFDG);
 	if (rump_sys_setuid(1) == -1)
 		atf_tc_fail_errno(setuid);
-	if (FSTYPE_ZFS(tc))
-		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 if (rump_sys_chown(., 1, -1) != -1 || errno != EPERM)
 		atf_tc_fail_errno(chown);
 if (rump_sys_chmod(., ) != -1 || errno != EPERM) 



CVS commit: src/tests/fs/vfs

2015-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 28 16:39:31 UTC 2015

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
This doesn't affect p2k_ffs after all, no idea why yet.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.13 src/tests/fs/vfs/t_io.c:1.14
--- src/tests/fs/vfs/t_io.c:1.13	Sat Mar 28 16:17:25 2015
+++ src/tests/fs/vfs/t_io.c	Sat Mar 28 16:39:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.13 2015/03/28 16:17:25 riastradh Exp $	*/
+/*	$NetBSD: t_io.c,v 1.14 2015/03/28 16:39:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -238,7 +238,6 @@ read_fault(const atf_tc_t *tc, const cha
 	FSTYPE_FFSLOG(tc) ||
 	FSTYPE_LFS(tc) ||
 	FSTYPE_MSDOS(tc) ||
-	FSTYPE_P2K_FFS(tc) ||
 	FSTYPE_SYSVBFS(tc))
 		atf_tc_expect_fail(bad sync atime update code path);
 	ATF_REQUIRE_ERRNO(EFAULT, rump_sys_read(fd, NULL, 1) == -1);



CVS commit: src/tests/fs/vfs

2015-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 28 16:17:25 UTC 2015

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Test that read fails with EFAULT even if O_SYNC|O_RSYNC are set.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.12 src/tests/fs/vfs/t_io.c:1.13
--- src/tests/fs/vfs/t_io.c:1.12	Sun Aug  4 11:02:02 2013
+++ src/tests/fs/vfs/t_io.c	Sat Mar 28 16:17:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.12 2013/08/04 11:02:02 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.13 2015/03/28 16:17:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -222,6 +222,30 @@ wrrd_after_unlink(const atf_tc_t *tc, co
 	FSTEST_EXIT();
 }
 
+static void
+read_fault(const atf_tc_t *tc, const char *mp)
+{
+	char ch = 123;
+	int fd;
+
+	FSTEST_ENTER();
+	RL(fd = rump_sys_open(file, O_CREAT | O_RDWR, 0777));
+	ATF_REQUIRE_EQ(rump_sys_write(fd, ch, 1), 1);
+	RL(rump_sys_close(fd));
+	RL(fd = rump_sys_open(file, O_RDONLY | O_SYNC | O_RSYNC));
+	if (FSTYPE_EXT2FS(tc) ||
+	FSTYPE_FFS(tc) ||
+	FSTYPE_FFSLOG(tc) ||
+	FSTYPE_LFS(tc) ||
+	FSTYPE_MSDOS(tc) ||
+	FSTYPE_P2K_FFS(tc) ||
+	FSTYPE_SYSVBFS(tc))
+		atf_tc_expect_fail(bad sync atime update code path);
+	ATF_REQUIRE_ERRNO(EFAULT, rump_sys_read(fd, NULL, 1) == -1);
+	RL(rump_sys_close(fd));
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
 ATF_TC_FSAPPLY(extendfile, check that extending a file works);
 ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
@@ -232,6 +256,7 @@ ATF_TC_FSAPPLY(overwrite_trunc, write 6
 ATF_TC_FSAPPLY(shrinkfile, shrink file);
 ATF_TC_FSAPPLY(read_after_unlink, contents can be read off disk after unlink);
 ATF_TC_FSAPPLY(wrrd_after_unlink, file can be written and read after unlink);
+ATF_TC_FSAPPLY(read_fault, read at bad address must return EFAULT);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -245,6 +270,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(shrinkfile);
 	ATF_TP_FSAPPLY(read_after_unlink);
 	ATF_TP_FSAPPLY(wrrd_after_unlink);
+	ATF_TP_FSAPPLY(read_fault);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2015-03-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 24 23:24:55 UTC 2015

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Make this run in NetBSD 6 by using st_mtimespec instead of st_mtim.

st_mtimespec is our traditional nonstandard name for what POSIX
called st_mtim in 2008, but these aren't going to run in non-NetBSD
anyway so using the nonstandard name shouldn't be an issue.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.44 src/tests/fs/vfs/t_vnops.c:1.45
--- src/tests/fs/vfs/t_vnops.c:1.44	Mon Dec 29 15:31:44 2014
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar 24 23:24:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.44 2014/12/29 15:31:44 hannken Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.45 2015/03/24 23:24:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -118,10 +118,10 @@ lookup_complex(const atf_tc_t *tc, const
 		FIELD(st_uid);
 		FIELD(st_gid);
 		FIELD(st_rdev);
-		TIME(st_atim);
-		TIME(st_mtim);
-		TIME(st_ctim);
-		TIME(st_birthtim);
+		TIME(st_atimespec);
+		TIME(st_mtimespec);
+		TIME(st_ctimespec);
+		TIME(st_birthtimespec);
 		FIELD(st_size);
 		FIELD(st_blocks);
 		FIELD(st_flags);



CVS commit: src/tests/fs/vfs

2014-12-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec 29 15:31:44 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Test v7fs_lstat_symlink is no longer expected to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.43 src/tests/fs/vfs/t_vnops.c:1.44
--- src/tests/fs/vfs/t_vnops.c:1.43	Tue Sep  9 06:51:00 2014
+++ src/tests/fs/vfs/t_vnops.c	Mon Dec 29 15:31:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.43 2014/09/09 06:51:00 gson Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.44 2014/12/29 15:31:44 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -932,9 +932,6 @@ lstat_symlink(const atf_tc_t *tc, const 
 
 	USES_SYMLINKS;
 
-	if (FSTYPE_V7FS(tc))
-		atf_tc_expect_fail(PR kern/48864);
-
 	FSTEST_ENTER();
 
 	src = source;



CVS commit: src/tests/fs/vfs

2014-09-09 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Sep  9 06:51:01 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Mark v7fs_lstat_symlink as an expected failure, referencing PR kern/48864.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.42 src/tests/fs/vfs/t_vnops.c:1.43
--- src/tests/fs/vfs/t_vnops.c:1.42	Sun Sep  7 09:10:09 2014
+++ src/tests/fs/vfs/t_vnops.c	Tue Sep  9 06:51:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.42 2014/09/07 09:10:09 gson Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.43 2014/09/09 06:51:00 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -931,6 +931,10 @@ lstat_symlink(const atf_tc_t *tc, const 
 	struct stat st;
 
 	USES_SYMLINKS;
+
+	if (FSTYPE_V7FS(tc))
+		atf_tc_expect_fail(PR kern/48864);
+
 	FSTEST_ENTER();
 
 	src = source;



CVS commit: src/tests/fs/vfs

2014-09-07 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Sep  7 09:10:09 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add a test of symlinks with long targets.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.41 src/tests/fs/vfs/t_vnops.c:1.42
--- src/tests/fs/vfs/t_vnops.c:1.41	Tue Aug 12 12:13:09 2014
+++ src/tests/fs/vfs/t_vnops.c	Sun Sep  7 09:10:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.41 2014/08/12 12:13:09 gson Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.42 2014/09/07 09:10:09 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -551,19 +551,58 @@ rename_nametoolong(const atf_tc_t *tc, c
 	rump_sys_chdir(/);
 }
 
+/*
+ * Test creating a symlink whose length is len bytes, not including
+ * the terminating NUL.
+ */
 static void
-symlink_zerolen(const atf_tc_t *tc, const char *mp)
+symlink_len(const atf_tc_t *tc, const char *mp, size_t len)
 {
+	char *buf;
+	int r;
 
 	USES_SYMLINKS;
 
 	RL(rump_sys_chdir(mp));
 
-	RL(rump_sys_symlink(, afile));
+	buf = malloc(len + 1);
+	ATF_REQUIRE(buf);
+	memset(buf, 'a', len);
+	buf[len] = '\0';
+	r = rump_sys_symlink(buf, afile);
+	if (r == -1) {
+		ATF_REQUIRE_ERRNO(ENAMETOOLONG, r);
+	} else {
+		RL(rump_sys_unlink(afile));
+	}
+	free(buf);
+
 	RL(rump_sys_chdir(/));
 }
 
 static void
+symlink_zerolen(const atf_tc_t *tc, const char *mp)
+{
+	symlink_len(tc, mp, 0);
+}
+
+static void
+symlink_long(const atf_tc_t *tc, const char *mp)
+{
+	/*
+	 * Test lengths close to powers of two, as those are likely
+	 * to be edge cases.
+	 */
+	size_t len;
+	int fuzz;
+	for (len = 2; len = 65536; len *= 2) {
+		for (fuzz = -1; fuzz = 1; fuzz++) {
+			symlink_len(tc, mp, len + fuzz);
+		}
+	}
+}
+
+static void
 symlink_root(const atf_tc_t *tc, const char *mp)
 {
 
@@ -920,7 +959,8 @@ ATF_TC_FSAPPLY(rename_reg_nodir, rename
 ATF_TC_FSAPPLY(create_nametoolong, create file with name too long);
 ATF_TC_FSAPPLY(create_exist, create with O_EXCL);
 ATF_TC_FSAPPLY(rename_nametoolong, rename to file with name too long);
-ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
+ATF_TC_FSAPPLY(symlink_zerolen, symlink with target of length 0);
+ATF_TC_FSAPPLY(symlink_long, symlink with target of length  0);
 ATF_TC_FSAPPLY(symlink_root, symlink to root directory);
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
 ATF_TC_FSAPPLY(fcntl_lock, check fcntl F_SETLK);
@@ -944,6 +984,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(create_exist);
 	ATF_TP_FSAPPLY(rename_nametoolong);
 	ATF_TP_FSAPPLY(symlink_zerolen);
+	ATF_TP_FSAPPLY(symlink_long);
 	ATF_TP_FSAPPLY(symlink_root);
 	ATF_TP_FSAPPLY(attrs);
 	ATF_TP_FSAPPLY(fcntl_lock);



CVS commit: src/tests/fs/vfs

2014-08-29 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Fri Aug 29 17:39:18 UTC 2014

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Don't pass an uninitialized variable as the times[] argument of
rump_sys_utimes().  Instead, pass combinations of values representing
edge cases: the farthest possible past, the epoch, and the farthest
possible future.  Now the excessive runtime reported in PR bin/49144
occurs reliably, on multiple architectures, and not only with udf, but
also with msdosfs.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.10 src/tests/fs/vfs/t_unpriv.c:1.11
--- src/tests/fs/vfs/t_unpriv.c:1.10	Sat Mar 16 05:45:37 2013
+++ src/tests/fs/vfs/t_unpriv.c	Fri Aug 29 17:39:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.10 2013/03/16 05:45:37 jmmv Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.11 2014/08/29 17:39:18 gson Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,6 +31,7 @@
 
 #include atf-c.h
 #include libgen.h
+#include limits.h
 #include unistd.h
 
 #include rump/rump_syscalls.h
@@ -127,7 +128,13 @@ times(const atf_tc_t *tc, const char *mp
 {
 	const char *name = file.test;
 	int fd;
+	unsigned int i, j;
 	struct timeval tmv[2];
+	static struct timeval tmvs[] = {
+		{ QUAD_MIN, 0 },
+		{ 0, 0 },
+		{ QUAD_MAX, 99 }
+	};
 
 	FSTEST_ENTER();
 
@@ -148,15 +155,21 @@ times(const atf_tc_t *tc, const char *mp
 	if (rump_sys_utimes(name, NULL) == -1)
 		atf_tc_fail_errno(utimes);
 
-	rump_pub_lwproc_rfork(RUMP_RFCFDG);
-	if (rump_sys_setuid(1) == -1)
-		atf_tc_fail_errno(setuid);
-	if (rump_sys_utimes(name, tmv) != -1 || errno != EPERM)
-		atf_tc_fail_errno(utimes);
-	rump_pub_lwproc_releaselwp();
-
-	if (rump_sys_utimes(name, tmv) == -1)
-		atf_tc_fail_errno(utimes);
+	for (i = 0; i  sizeof(tmvs) / sizeof(tmvs[0]); i++) {
+		for (j = 0; j  sizeof(tmvs) / sizeof(tmvs[0]); j++) {
+			tmv[0] = tmvs[i];
+			tmv[1] = tmvs[j];
+			rump_pub_lwproc_rfork(RUMP_RFCFDG);
+			if (rump_sys_setuid(1) == -1)
+atf_tc_fail_errno(setuid);
+			if (rump_sys_utimes(name, tmv) != -1 || errno != EPERM)
+atf_tc_fail_errno(utimes);
+			rump_pub_lwproc_releaselwp();
+
+			if (rump_sys_utimes(name, tmv) == -1)
+atf_tc_fail_errno(utimes);
+		}
+	}
 
 	if (rump_sys_unlink(name) == -1)
 		atf_tc_fail_errno(unlink);



CVS commit: src/tests/fs/vfs

2014-08-12 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Aug 12 12:13:09 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Mark udf_lookup_complex as an expected failure, referencing PR kern/49033.
Since it does not fail reliably, force it to fail to avoid spurious failure
reports due to unexpected success.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.40 src/tests/fs/vfs/t_vnops.c:1.41
--- src/tests/fs/vfs/t_vnops.c:1.40	Fri Jul 25 12:16:22 2014
+++ src/tests/fs/vfs/t_vnops.c	Tue Aug 12 12:13:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.40 2014/07/25 12:16:22 martin Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.41 2014/08/12 12:13:09 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -87,6 +87,9 @@ lookup_complex(const atf_tc_t *tc, const
 
 	USES_DIRS;
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail(PR kern/49033);
+
 	sprintf(pb, %s/dir, mountpath);
 	if (rump_sys_mkdir(pb, 0777) == -1)
 		atf_tc_fail_errno(mkdir);
@@ -129,6 +132,9 @@ lookup_complex(const atf_tc_t *tc, const
 
 		atf_tc_fail(stat results differ, see ouput for more details);
 	}
+	if (FSTYPE_UDF(tc))
+		atf_tc_fail(random failure of PR kern/49033 
+			did not happen this time);
 }
 
 static void



CVS commit: src/tests/fs/vfs

2014-07-29 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Jul 29 09:15:48 UTC 2014

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Mark the udf_renamerace test case (but not udf_renamerace_dirs) as an
expected failure again, now with a reference to PR kern/49046.
Since the test only fails part of the time, force failure to
avoid failure reports reports due to unexpected success.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.31 src/tests/fs/vfs/t_renamerace.c:1.32
--- src/tests/fs/vfs/t_renamerace.c:1.31	Fri Jul 25 13:44:59 2014
+++ src/tests/fs/vfs/t_renamerace.c	Tue Jul 29 09:15:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.31 2014/07/25 13:44:59 pgoyette Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.32 2014/07/29 09:15:48 gson Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -101,6 +101,8 @@ renamerace(const atf_tc_t *tc, const cha
 		atf_tc_skip(filesystem has not enough inodes);
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
+	if (FSTYPE_UDF(tc))
+		atf_tc_expect_fail(PR kern/49046);
 
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
@@ -121,6 +123,9 @@ renamerace(const atf_tc_t *tc, const cha
 		pthread_join(pt2[i], NULL);
 	RL(rump_sys_chdir(/));
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_fail(race did not trigger this time);
+
 	if (FSTYPE_MSDOS(tc)) {
 		atf_tc_expect_fail(PR kern/44661);
 		/*



CVS commit: src/tests/fs/vfs

2014-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul 25 12:16:22 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
PR kern/49033: try to provide better diagnostics if the udf_lookup_complex
test randomly fails.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.39 src/tests/fs/vfs/t_vnops.c:1.40
--- src/tests/fs/vfs/t_vnops.c:1.39	Tue Jun  3 11:56:07 2014
+++ src/tests/fs/vfs/t_vnops.c	Fri Jul 25 12:16:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.39 2014/06/03 11:56:07 njoly Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.40 2014/07/25 12:16:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -97,7 +97,38 @@ lookup_complex(const atf_tc_t *tc, const
 	if (rump_sys_stat(pb, sb2) == -1)
 		atf_tc_fail_errno(stat 2);
 
-	ATF_REQUIRE(memcmp(sb1, sb2, sizeof(sb1)) == 0);
+	if (memcmp(sb1, sb2, sizeof(sb1)) != 0) {
+		printf(what\tsb1\t\tsb2\n);
+
+#define FIELD(FN)	\
+		printf(#FN \t%lld\t%lld\n, \
+		(long long)sb1.FN, (long long)sb2.FN)
+#define TIME(FN)	\
+		printf(#FN \t%lld.%ld\t%lld.%ld\n, \
+		(long long)sb1.FN.tv_sec, sb1.FN.tv_nsec, \
+		(long long)sb2.FN.tv_sec, sb2.FN.tv_nsec)
+
+		FIELD(st_dev);
+		FIELD(st_mode);
+		FIELD(st_ino);
+		FIELD(st_nlink);
+		FIELD(st_uid);
+		FIELD(st_gid);
+		FIELD(st_rdev);
+		TIME(st_atim);
+		TIME(st_mtim);
+		TIME(st_ctim);
+		TIME(st_birthtim);
+		FIELD(st_size);
+		FIELD(st_blocks);
+		FIELD(st_flags);
+		FIELD(st_gen);
+
+#undef FIELD
+#undef TIME
+
+		atf_tc_fail(stat results differ, see ouput for more details);
+	}
 }
 
 static void



CVS commit: src/tests/fs/vfs

2014-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 25 13:44:59 UTC 2014

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Remove atf_tc_expect_fail() calls for udf file-system.  These tests are
currently passing.  As discussed on current-users.  Any new failures
should be reported via send-pr.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.30 src/tests/fs/vfs/t_renamerace.c:1.31
--- src/tests/fs/vfs/t_renamerace.c:1.30	Thu Jan  9 13:23:57 2014
+++ src/tests/fs/vfs/t_renamerace.c	Fri Jul 25 13:44:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.30 2014/01/09 13:23:57 hannken Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.31 2014/07/25 13:44:59 pgoyette Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -102,9 +102,6 @@ renamerace(const atf_tc_t *tc, const cha
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_expect_fail(Test expected to fail);
-
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
 
@@ -149,9 +146,6 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_expect_fail(Test expected to fail);
-
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);



CVS commit: src/tests/fs/vfs

2014-06-03 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Jun  3 11:56:07 UTC 2014

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add testcase that check lstat(2) values for symbolic links (PR
kern/48864).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.38 src/tests/fs/vfs/t_vnops.c:1.39
--- src/tests/fs/vfs/t_vnops.c:1.38	Sat Oct 19 17:45:00 2013
+++ src/tests/fs/vfs/t_vnops.c	Tue Jun  3 11:56:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.38 2013/10/19 17:45:00 christos Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.39 2014/06/03 11:56:07 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -847,6 +847,30 @@ read_directory(const atf_tc_t *tc, const
 	FSTEST_EXIT();
 }
 
+static void
+lstat_symlink(const atf_tc_t *tc, const char *mp)
+{
+	const char *src, *dst;
+	int res;
+	struct stat st;
+
+	USES_SYMLINKS;
+	FSTEST_ENTER();
+
+	src = source;
+	dst = destination;
+
+	res = rump_sys_symlink(src, dst);
+	ATF_REQUIRE(res != -1);
+	res = rump_sys_lstat(dst, st);
+	ATF_REQUIRE(res != -1);
+
+	ATF_CHECK(S_ISLNK(st.st_mode) != 0);
+	ATF_CHECK(st.st_size == (off_t)strlen(src));
+
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(lookup_simple, simple lookup (./.. on root));
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
@@ -866,6 +890,7 @@ ATF_TC_FSAPPLY(fcntl_lock, check fcntl 
 ATF_TC_FSAPPLY(fcntl_getlock_pids,fcntl F_GETLK w/ many procs, PR kern/44494);
 ATF_TC_FSAPPLY(access_simple, access(2));
 ATF_TC_FSAPPLY(read_directory, read(2) on directories);
+ATF_TC_FSAPPLY(lstat_symlink, lstat(2) values for symbolic links);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -888,6 +913,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(fcntl_getlock_pids);
 	ATF_TP_FSAPPLY(access_simple);
 	ATF_TP_FSAPPLY(read_directory);
+	ATF_TP_FSAPPLY(lstat_symlink);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2013-08-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Aug  4 11:02:02 UTC 2013

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
tests for i/o-after-unlink


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.11 src/tests/fs/vfs/t_io.c:1.12
--- src/tests/fs/vfs/t_io.c:1.11	Wed Jun 12 12:08:08 2013
+++ src/tests/fs/vfs/t_io.c	Sun Aug  4 11:02:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.11 2013/06/12 12:08:08 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.12 2013/08/04 11:02:02 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -168,6 +168,60 @@ shrinkfile(const atf_tc_t *tc, const cha
 	FSTEST_EXIT();
 }
 
+#define TBSIZE 9000
+static void
+read_after_unlink(const atf_tc_t *tc, const char *mp)
+{
+	char buf[TBSIZE], buf2[TBSIZE];
+	int fd;
+
+	FSTEST_ENTER();
+
+	/* create file and put some content into it */
+	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT, 0666));
+	memset(buf, 'D', TBSIZE);
+	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, TBSIZE), TBSIZE);
+	rump_sys_close(fd);
+
+	/* flush buffers from UBC to file system */
+	ATF_REQUIRE_ERRNO(EBUSY, rump_sys_unmount(mp, 0) == -1);
+
+	RL(fd = rump_sys_open(file, O_RDWR));
+	RL(rump_sys_unlink(file));
+
+	ATF_REQUIRE_EQ(rump_sys_read(fd, buf2, TBSIZE), TBSIZE);
+	ATF_REQUIRE_EQ(memcmp(buf, buf2, TBSIZE), 0);
+	rump_sys_close(fd);
+
+	FSTEST_EXIT();
+}
+
+static void
+wrrd_after_unlink(const atf_tc_t *tc, const char *mp)
+{
+	int value = 0x11;
+	int v2;
+	int fd;
+
+	FSTEST_ENTER();
+
+	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT, 0666));
+	RL(rump_sys_unlink(file));
+
+	RL(rump_sys_pwrite(fd, value, sizeof(value), 654321));
+
+	/*
+	 * We can't easily invalidate the buffer since we hold a
+	 * reference, but try to get them to flush anyway.
+	 */
+	RL(rump_sys_fsync(fd));
+	RL(rump_sys_pread(fd, v2, sizeof(v2), 654321));
+	rump_sys_close(fd);
+
+	ATF_REQUIRE_EQ(value, v2);
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
 ATF_TC_FSAPPLY(extendfile, check that extending a file works);
 ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
@@ -176,6 +230,8 @@ ATF_TC_FSAPPLY(overwrite512, write a 51
 ATF_TC_FSAPPLY(overwrite64k, write a 64k byte file twice);
 ATF_TC_FSAPPLY(overwrite_trunc, write 64k + truncate + rewrite);
 ATF_TC_FSAPPLY(shrinkfile, shrink file);
+ATF_TC_FSAPPLY(read_after_unlink, contents can be read off disk after unlink);
+ATF_TC_FSAPPLY(wrrd_after_unlink, file can be written and read after unlink);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -187,6 +243,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(overwrite64k);
 	ATF_TP_FSAPPLY(overwrite_trunc);
 	ATF_TP_FSAPPLY(shrinkfile);
+	ATF_TP_FSAPPLY(read_after_unlink);
+	ATF_TP_FSAPPLY(wrrd_after_unlink);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2013-07-28 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Jul 28 09:03:43 UTC 2013

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Check that rename(2) with NULL arguments fail with EFAULT.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.36 src/tests/fs/vfs/t_vnops.c:1.37
--- src/tests/fs/vfs/t_vnops.c:1.36	Wed Jul 10 18:55:00 2013
+++ src/tests/fs/vfs/t_vnops.c	Sun Jul 28 09:03:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.36 2013/07/10 18:55:00 reinoud Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.37 2013/07/28 09:03:43 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -400,6 +400,9 @@ rename_reg_nodir(const atf_tc_t *tc, con
 		ATF_REQUIRE_EQ(sb.st_nlink, 1);
 	}
 
+	ATF_CHECK_ERRNO(EFAULT, rump_sys_rename(file2, NULL) == -1);
+	ATF_CHECK_ERRNO(EFAULT, rump_sys_rename(NULL, file2) == -1);
+
 	rump_sys_chdir(/);
 }
 



CVS commit: src/tests/fs/vfs

2013-07-10 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Jul 10 18:55:00 UTC 2013

Modified Files:
src/tests/fs/vfs: t_renamerace.c t_vnops.c

Log Message:
Update test cases for UDF now udf_rename() uses the genfs_rename framework


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/fs/vfs/t_renamerace.c
cvs rdiff -u -r1.35 -r1.36 src/tests/fs/vfs/t_vnops.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.28 src/tests/fs/vfs/t_renamerace.c:1.29
--- src/tests/fs/vfs/t_renamerace.c:1.28	Mon Jul  8 06:44:51 2013
+++ src/tests/fs/vfs/t_renamerace.c	Wed Jul 10 18:55:00 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.28 2013/07/08 06:44:51 reinoud Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.29 2013/07/10 18:55:00 reinoud Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -97,8 +97,7 @@ renamerace(const atf_tc_t *tc, const cha
 		atf_tc_skip(rename not supported by file system);
 
 	if (FSTYPE_UDF(tc))
-		atf_tc_skip(PR kern/47986: UDF is not using the new
-			rename framework yet);
+		atf_tc_expect_fail(Test expected to fail);
 
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
@@ -145,8 +144,7 @@ renamerace_dirs(const atf_tc_t *tc, cons
 		atf_tc_skip(rename not supported by file system);
 
 	if (FSTYPE_UDF(tc))
-		atf_tc_skip(PR kern/47986: UDF is not using the new
-			rename framework yet);
+		atf_tc_expect_fail(Test expected to fail);
 
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_MSDOS(tc))

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.35 src/tests/fs/vfs/t_vnops.c:1.36
--- src/tests/fs/vfs/t_vnops.c:1.35	Mon Jul  8 06:44:51 2013
+++ src/tests/fs/vfs/t_vnops.c	Wed Jul 10 18:55:00 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.35 2013/07/08 06:44:51 reinoud Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.36 2013/07/10 18:55:00 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -206,10 +206,6 @@ rename_dir(const atf_tc_t *tc, const cha
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_skip(PR kern/47986: UDF is not using the new
-			rename framework yet);
-
 	USES_DIRS;
 
 	md(pb1, mp, dir1);
@@ -342,10 +338,6 @@ rename_reg_nodir(const atf_tc_t *tc, con
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
-	if (FSTYPE_UDF(tc))
-		atf_tc_skip(PR kern/47986: UDF is not using the new
-			rename framework yet);
-
 	if (rump_sys_chdir(mp) == -1)
 		atf_tc_fail_errno(chdir mountpoint);
 



CVS commit: src/tests/fs/vfs

2013-07-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jul  8 06:44:51 UTC 2013

Modified Files:
src/tests/fs/vfs: t_renamerace.c t_vnops.c

Log Message:
Cover the last failing UDF test cases with a reference to PR kern/47986, i.e.
all rename's fail until UDF switches over to the new rename framework solving
the locking mechanism.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/fs/vfs/t_renamerace.c
cvs rdiff -u -r1.34 -r1.35 src/tests/fs/vfs/t_vnops.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.27 src/tests/fs/vfs/t_renamerace.c:1.28
--- src/tests/fs/vfs/t_renamerace.c:1.27	Sun Mar 17 02:48:31 2013
+++ src/tests/fs/vfs/t_renamerace.c	Mon Jul  8 06:44:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.27 2013/03/17 02:48:31 jmmv Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.28 2013/07/08 06:44:51 reinoud Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -96,6 +96,10 @@ renamerace(const atf_tc_t *tc, const cha
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_skip(PR kern/47986: UDF is not using the new
+			rename framework yet);
+
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
 
@@ -140,6 +144,10 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_skip(PR kern/47986: UDF is not using the new
+			rename framework yet);
+
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.34 src/tests/fs/vfs/t_vnops.c:1.35
--- src/tests/fs/vfs/t_vnops.c:1.34	Sat Mar 16 05:45:37 2013
+++ src/tests/fs/vfs/t_vnops.c	Mon Jul  8 06:44:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.34 2013/03/16 05:45:37 jmmv Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.35 2013/07/08 06:44:51 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -206,6 +206,10 @@ rename_dir(const atf_tc_t *tc, const cha
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_skip(PR kern/47986: UDF is not using the new
+			rename framework yet);
+
 	USES_DIRS;
 
 	md(pb1, mp, dir1);
@@ -338,6 +342,10 @@ rename_reg_nodir(const atf_tc_t *tc, con
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by file system);
 
+	if (FSTYPE_UDF(tc))
+		atf_tc_skip(PR kern/47986: UDF is not using the new
+			rename framework yet);
+
 	if (rump_sys_chdir(mp) == -1)
 		atf_tc_fail_errno(chdir mountpoint);
 



CVS commit: src/tests/fs/vfs

2013-06-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Jun 28 13:04:06 UTC 2013

Modified Files:
src/tests/fs/vfs: Makefile

Log Message:
Add the rumpfs_udf to the LDADD variable


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/fs/vfs/Makefile

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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.18 src/tests/fs/vfs/Makefile:1.19
--- src/tests/fs/vfs/Makefile:1.18	Fri Aug 31 14:46:53 2012
+++ src/tests/fs/vfs/Makefile	Fri Jun 28 13:04:06 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2012/08/31 14:46:53 pooka Exp $
+#	$NetBSD: Makefile,v 1.19 2013/06/28 13:04:06 reinoud Exp $
 #
 
 .include bsd.own.mk
@@ -24,6 +24,7 @@ LDADD+=-lrumpfs_syspuffs	# puffs
 LDADD+=-lrumpdev_putter -lrumpdev#   \ putter
 LDADD+=-lrumpfs_sysvbfs		# sysvbfs
 LDADD+=-lrumpfs_tmpfs		# tmpfs
+LDADD+=-lrumpfs_udf		# udf
 LDADD+=-lrumpfs_union		# union
 LDADD+=-lrumpfs_v7fs		# v7fs
 LDADD+=-lrumpdev_disk -lrumpdev	# disk device



CVS commit: src/tests/fs/vfs

2013-06-12 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jun 12 12:08:08 UTC 2013

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Fix the test for rumpfs on amd64 by adding a creation mode to open().
thanks to gson for the prod.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.10 src/tests/fs/vfs/t_io.c:1.11
--- src/tests/fs/vfs/t_io.c:1.10	Tue Mar 20 18:20:49 2012
+++ src/tests/fs/vfs/t_io.c	Wed Jun 12 12:08:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.10 2012/03/20 18:20:49 njoly Exp $	*/
+/*	$NetBSD: t_io.c,v 1.11 2013/06/12 12:08:08 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -122,11 +122,11 @@ overwritebody(const atf_tc_t *tc, off_t 
 
 	REQUIRE_LIBC(buf = malloc(count), NULL);
 	FSTEST_ENTER();
-	RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR));
+	RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR, 0666));
 	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count);
 	RL(rump_sys_close(fd));
 
-	RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR));
+	RL(fd = rump_sys_open(testi, O_RDWR));
 	if (dotrunc)
 		RL(rump_sys_ftruncate(fd, 0));
 	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count);



CVS commit: src/tests/fs/vfs

2013-03-16 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sun Mar 17 02:48:31 UTC 2013

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Fix the t_renamerace:lfs_renamerace_dirs test on fast machines.

This test was failing on my machine when run natively but not causing any
problems when run within qemu, and the failure was mkdir: No space left
on device.

My understanding of the issue is that this test overflowed the temporary
disk image due to its high rate of file churn and the lfs_cleanerd not
being able to keep up.  Note that this test is capped by time, not number
of operations, so this is why the problem does not show up in a slow
emulated system.

To fix this, just bump the test file system image limit a little bit.
(I tried increasing the frequency at which lfs_cleanerd does its thing,
but it wasn't enough.)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.26 src/tests/fs/vfs/t_renamerace.c:1.27
--- src/tests/fs/vfs/t_renamerace.c:1.26	Wed May  9 00:22:26 2012
+++ src/tests/fs/vfs/t_renamerace.c	Sun Mar 17 02:48:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.26 2012/05/09 00:22:26 riastradh Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.27 2013/03/17 02:48:31 jmmv Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -21,6 +21,18 @@
 #include rump/rump.h
 #include rump/rump_syscalls.h
 
+/* Bump the size of the test file system image to a larger value.
+ *
+ * These tests cause a lot of churn in the file system by creating and
+ * deleting files/directories in quick succession.  A faster CPU will cause
+ * more churn because the tests are capped by a run time period in seconds,
+ * not number of operations.
+ *
+ * This is all fine except for LFS, because the lfs_cleanerd cannot keep up
+ * with the churn and thus causes the test to fail on fast machines.  Hence
+ * the reason for this hack. */
+#define FSTEST_IMGSIZE (5 * 512)
+
 #include ../common/h_fsmacros.h
 #include ../../h_macros.h
 



CVS commit: src/tests/fs/vfs

2013-03-15 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sat Mar 16 05:45:37 UTC 2013

Modified Files:
src/tests/fs/vfs: t_full.c t_unpriv.c t_vnops.c

Log Message:
Mark a bunch of routinely-broken ZFS tests as expected failures.  Point
them at PR kern/47656.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_full.c
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/t_unpriv.c
cvs rdiff -u -r1.33 -r1.34 src/tests/fs/vfs/t_vnops.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.7 src/tests/fs/vfs/t_full.c:1.8
--- src/tests/fs/vfs/t_full.c:1.7	Thu Mar 17 19:48:37 2011
+++ src/tests/fs/vfs/t_full.c	Sat Mar 16 05:45:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.7 2011/03/17 19:48:37 jmmv Exp $	*/
+/*	$NetBSD: t_full.c,v 1.8 2013/03/16 05:45:37 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -77,6 +77,8 @@ fillfs(const atf_tc_t *tc, const char *m
 		if (n == -1)
 			break;
 	}
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (n == -1) {
 		if (errno != ENOSPC)
 			atf_tc_fail_errno(write);

Index: src/tests/fs/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.9 src/tests/fs/vfs/t_unpriv.c:1.10
--- src/tests/fs/vfs/t_unpriv.c:1.9	Wed Apr  4 18:53:34 2012
+++ src/tests/fs/vfs/t_unpriv.c	Sat Mar 16 05:45:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.9 2012/04/04 18:53:34 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.10 2013/03/16 05:45:37 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -54,6 +54,8 @@ owner(const atf_tc_t *tc, const char *mp
 	rump_pub_lwproc_rfork(RUMP_RFCFDG);
 	if (rump_sys_setuid(1) == -1)
 		atf_tc_fail_errno(setuid);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 if (rump_sys_chown(., 1, -1) != -1 || errno != EPERM)
 		atf_tc_fail_errno(chown);
 if (rump_sys_chmod(., ) != -1 || errno != EPERM) 
@@ -93,6 +95,8 @@ dirperms(const atf_tc_t *tc, const char 
 	rump_pub_lwproc_rfork(RUMP_RFCFDG);
 	if (rump_sys_setuid(1) == -1)
 		atf_tc_fail_errno(setuid);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 if (rump_sys_open(name, O_RDWR|O_CREAT, 0666) != -1 || errno != EACCES)
 		atf_tc_fail_errno(open);
 	rump_pub_lwproc_releaselwp();
@@ -135,6 +139,8 @@ times(const atf_tc_t *tc, const char *mp
 	rump_pub_lwproc_rfork(RUMP_RFCFDG);
 	if (rump_sys_setuid(1) == -1)
 		atf_tc_fail_errno(setuid);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (rump_sys_utimes(name, NULL) != -1 || errno != EACCES)
 		atf_tc_fail_errno(utimes);
 	rump_pub_lwproc_releaselwp();
@@ -174,6 +180,8 @@ flags(const atf_tc_t *tc, const char *mp
 
 	if (rump_sys_stat(name, st) == -1)
 		atf_tc_fail_errno(stat);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (rump_sys_chflags(name, st.st_flags) == -1) {
 		if (errno == EOPNOTSUPP)
 			atf_tc_skip(file flags not supported by file system);

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.33 src/tests/fs/vfs/t_vnops.c:1.34
--- src/tests/fs/vfs/t_vnops.c:1.33	Tue Mar 20 18:20:49 2012
+++ src/tests/fs/vfs/t_vnops.c	Sat Mar 16 05:45:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.33 2012/03/20 18:20:49 njoly Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.34 2013/03/16 05:45:37 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -142,6 +142,8 @@ dir_notempty(const atf_tc_t *tc, const c
 	rump_sys_close(fd);
 
 	rv = rump_sys_rmdir(pb);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (rv != -1 || errno != ENOTEMPTY)
 		atf_tc_fail(non-empty directory removed succesfully);
 
@@ -237,6 +239,8 @@ rename_dir(const atf_tc_t *tc, const cha
 	md(pb1, mp, dir3/.);
 	if (rump_sys_rename(pb1, pb3) != -1 || errno != EINVAL)
 		atf_tc_fail_errno(rename 2);
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (rump_sys_rename(pb3, pb1) != -1 || errno != EISDIR)
 		atf_tc_fail_errno(rename 3);
 
@@ -563,6 +567,8 @@ attrs(const atf_tc_t *tc, const char *mp
 
 	RL(rump_sys_stat(TESTFILE, sb2));
 #define CHECK(a) ATF_REQUIRE_EQ(sb.a, sb2.a)
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	if (!(FSTYPE_MSDOS(tc) || FSTYPE_SYSVBFS(tc))) {
 		CHECK(st_uid);
 		CHECK(st_gid);
@@ -601,6 +607,8 @@ fcntl_lock(const atf_tc_t *tc, const cha
 	RL(rump_sys_ftruncate(fd, 8192));
 
 	/* PR kern/43321 */
+	if (FSTYPE_ZFS(tc))
+		atf_tc_expect_fail(PR kern/47656: Test known to be broken);
 	RL(rump_sys_fcntl(fd, F_SETLK, l));
 
 	/* Next, we fork and try to lock the same area */
@@ -734,6 +742,9 @@ fcntl_getlock_pids(const atf_tc_t *tc, c
 
 		RL(rump_sys_ftruncate(fd[i], sz));
 
+		if (FSTYPE_ZFS(tc))

CVS commit: src/tests/fs/vfs

2012-05-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May  9 00:22:26 UTC 2012

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Adjust t_renamerace now that ext2fs and ffs have good rename.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.25 src/tests/fs/vfs/t_renamerace.c:1.26
--- src/tests/fs/vfs/t_renamerace.c:1.25	Thu Feb 16 02:47:56 2012
+++ src/tests/fs/vfs/t_renamerace.c	Wed May  9 00:22:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.25 2012/02/16 02:47:56 perseant Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.26 2012/05/09 00:22:26 riastradh Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -129,13 +129,9 @@ renamerace_dirs(const atf_tc_t *tc, cons
 		atf_tc_skip(rename not supported by file system);
 
 	/* XXX: msdosfs also sometimes hangs */
-	if (FSTYPE_EXT2FS(tc) || FSTYPE_MSDOS(tc))
+	if (FSTYPE_MSDOS(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
-	/* XXX: unracy execution not caught */
-	if (FSTYPE_P2K_FFS(tc))
-		atf_tc_expect_fail(PR kern/44336); /* child dies */
-
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
 
@@ -154,14 +150,8 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	 * Doesn't always trigger when run on a slow backend
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.
 	 */
-	if (FSTYPE_EXT2FS(tc) || FSTYPE_MSDOS(tc))
+	if (FSTYPE_MSDOS(tc))
 		abort();
-
-	if (FSTYPE_P2K_FFS(tc)) {
-		/* XXX: some races may hang test run if we don't unmount */
-		puffs_fstest_unmount(tc, mp, MNT_FORCE);
-		atf_tc_fail(problem did not trigger);
-	}
 }
 
 ATF_TC_FSAPPLY(renamerace, rename(2) race with file unlinked mid-operation);



CVS commit: src/tests/fs/vfs

2012-04-04 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Apr  4 18:53:35 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
New testcase that check file flags with unprivileged credentials.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.8 src/tests/fs/vfs/t_unpriv.c:1.9
--- src/tests/fs/vfs/t_unpriv.c:1.8	Mon Mar 26 15:13:20 2012
+++ src/tests/fs/vfs/t_unpriv.c	Wed Apr  4 18:53:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.8 2012/03/26 15:13:20 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.9 2012/04/04 18:53:34 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -26,6 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include sys/stat.h
 #include sys/time.h
 
 #include atf-c.h
@@ -157,9 +158,55 @@ times(const atf_tc_t *tc, const char *mp
 	FSTEST_EXIT();
 }
 
+static void
+flags(const atf_tc_t *tc, const char *mp)
+{
+	const char *name = file.test;
+	int fd, fflags;
+	struct stat st;
+
+	FSTEST_ENTER();
+
+	if ((fd = rump_sys_open(name, O_RDWR|O_CREAT, 0666)) == -1)
+		atf_tc_fail_errno(open);
+	if (rump_sys_close(fd) == -1)
+		atf_tc_fail_errno(close);
+
+	if (rump_sys_stat(name, st) == -1)
+		atf_tc_fail_errno(stat);
+	if (rump_sys_chflags(name, st.st_flags) == -1) {
+		if (errno == EOPNOTSUPP)
+			atf_tc_skip(file flags not supported by file system);
+		atf_tc_fail_errno(chflags);
+	}
+
+	fflags = st.st_flags | UF_IMMUTABLE;
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(1) == -1)
+		atf_tc_fail_errno(setuid);
+	fflags |= UF_IMMUTABLE;
+	if (rump_sys_chflags(name, fflags) != -1 || errno != EPERM)
+		atf_tc_fail_errno(chflags);
+	rump_pub_lwproc_releaselwp();
+
+	if (rump_sys_chflags(name, fflags) == -1)
+		atf_tc_fail_errno(chflags);
+
+	fflags = ~UF_IMMUTABLE;
+	if (rump_sys_chflags(name, fflags) == -1)
+		atf_tc_fail_errno(chflags);
+
+	if (rump_sys_unlink(name) == -1)
+		atf_tc_fail_errno(unlink);
+
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(owner, owner unprivileged checks);
 ATF_TC_FSAPPLY(dirperms, directory permission checks);
 ATF_TC_FSAPPLY(times, time set checks);
+ATF_TC_FSAPPLY(flags, file flags checks);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -167,6 +214,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(owner);
 	ATF_TP_FSAPPLY(dirperms);
 	ATF_TP_FSAPPLY(times);
+	ATF_TP_FSAPPLY(flags);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2012-03-26 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Mar 26 15:13:20 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Now that permissions for msdos have been fixed, kill times() special
case which was wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.7 src/tests/fs/vfs/t_unpriv.c:1.8
--- src/tests/fs/vfs/t_unpriv.c:1.7	Fri Mar 23 09:58:23 2012
+++ src/tests/fs/vfs/t_unpriv.c	Mon Mar 26 15:13:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.7 2012/03/23 09:58:23 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.8 2012/03/26 15:13:20 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -121,7 +121,7 @@ static void
 times(const atf_tc_t *tc, const char *mp)
 {
 	const char *name = file.test;
-	int fd, expect;
+	int fd;
 	struct timeval tmv[2];
 
 	FSTEST_ENTER();
@@ -144,8 +144,7 @@ times(const atf_tc_t *tc, const char *mp
 	rump_pub_lwproc_rfork(RUMP_RFCFDG);
 	if (rump_sys_setuid(1) == -1)
 		atf_tc_fail_errno(setuid);
-	expect = FSTYPE_MSDOS(tc) ? EACCES : EPERM;
-	if (rump_sys_utimes(name, tmv) != -1 || errno != expect)
+	if (rump_sys_utimes(name, tmv) != -1 || errno != EPERM)
 		atf_tc_fail_errno(utimes);
 	rump_pub_lwproc_releaselwp();
 



CVS commit: src/tests/fs/vfs

2012-03-23 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri Mar 23 09:58:23 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Extend times testcase to check for non null time values too.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.6 src/tests/fs/vfs/t_unpriv.c:1.7
--- src/tests/fs/vfs/t_unpriv.c:1.6	Thu Mar 15 12:57:27 2012
+++ src/tests/fs/vfs/t_unpriv.c	Fri Mar 23 09:58:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.6 2012/03/15 12:57:27 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.7 2012/03/23 09:58:23 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -121,7 +121,8 @@ static void
 times(const atf_tc_t *tc, const char *mp)
 {
 	const char *name = file.test;
-	int fd;
+	int fd, expect;
+	struct timeval tmv[2];
 
 	FSTEST_ENTER();
 
@@ -140,6 +141,17 @@ times(const atf_tc_t *tc, const char *mp
 	if (rump_sys_utimes(name, NULL) == -1)
 		atf_tc_fail_errno(utimes);
 
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(1) == -1)
+		atf_tc_fail_errno(setuid);
+	expect = FSTYPE_MSDOS(tc) ? EACCES : EPERM;
+	if (rump_sys_utimes(name, tmv) != -1 || errno != expect)
+		atf_tc_fail_errno(utimes);
+	rump_pub_lwproc_releaselwp();
+
+	if (rump_sys_utimes(name, tmv) == -1)
+		atf_tc_fail_errno(utimes);
+
 	if (rump_sys_unlink(name) == -1)
 		atf_tc_fail_errno(unlink);
 



CVS commit: src/tests/fs/vfs

2012-03-20 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Mar 20 18:20:49 UTC 2012

Modified Files:
src/tests/fs/vfs: t_io.c t_vnops.c

Log Message:
Remove unneeded atf_tc_expect_pass calls.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/t_io.c
cvs rdiff -u -r1.32 -r1.33 src/tests/fs/vfs/t_vnops.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.9 src/tests/fs/vfs/t_io.c:1.10
--- src/tests/fs/vfs/t_io.c:1.9	Tue Mar 20 05:21:45 2012
+++ src/tests/fs/vfs/t_io.c	Tue Mar 20 18:20:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.9 2012/03/20 05:21:45 jruoho Exp $	*/
+/*	$NetBSD: t_io.c,v 1.10 2012/03/20 18:20:49 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -89,7 +89,6 @@ extendbody(const atf_tc_t *tc, off_t see
 	RL(rump_sys_ftruncate(fd, seekcnt));
 	RL(rump_sys_fstat(fd, sb));
 	ATF_REQUIRE_EQ(sb.st_size, seekcnt);
-	atf_tc_expect_pass();
 
 	ATF_REQUIRE_EQ(rump_sys_write(fd, TESTSTR, TESTSZ), TESTSZ);
 	ATF_REQUIRE_EQ(rump_sys_pread(fd, buf, TESTSZ, seekcnt), TESTSZ);

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.32 src/tests/fs/vfs/t_vnops.c:1.33
--- src/tests/fs/vfs/t_vnops.c:1.32	Mon Mar 19 03:33:54 2012
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar 20 18:20:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.32 2012/03/19 03:33:54 pgoyette Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.33 2012/03/20 18:20:49 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -317,7 +317,6 @@ rename_dotdot(const atf_tc_t *tc, const 
 
 	if (rump_sys_rename(dir1/.., sometarget) != -1 || errno != EINVAL)
 		atf_tc_fail_errno(self-dotdot from);
-	atf_tc_expect_pass();
 
 	if (rump_sys_rename(dir1, dir2/..) != -1 || errno != EINVAL)
 		atf_tc_fail(other-dotdot);



CVS commit: src/tests/fs/vfs

2012-03-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar 20 05:21:45 UTC 2012

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Remove xfail.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.8 src/tests/fs/vfs/t_io.c:1.9
--- src/tests/fs/vfs/t_io.c:1.8	Sun Feb 27 15:16:31 2011
+++ src/tests/fs/vfs/t_io.c	Tue Mar 20 05:21:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.8 2011/02/27 15:16:31 njoly Exp $	*/
+/*	$NetBSD: t_io.c,v 1.9 2012/03/20 05:21:45 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -88,8 +88,6 @@ extendbody(const atf_tc_t *tc, off_t see
 	O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)));
 	RL(rump_sys_ftruncate(fd, seekcnt));
 	RL(rump_sys_fstat(fd, sb));
-	if (FSTYPE_SYSVBFS(tc)  seekcnt)
-		atf_tc_expect_fail(PR kern/44307);
 	ATF_REQUIRE_EQ(sb.st_size, seekcnt);
 	atf_tc_expect_pass();
 
@@ -174,7 +172,7 @@ shrinkfile(const atf_tc_t *tc, const cha
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
 ATF_TC_FSAPPLY(extendfile, check that extending a file works);
 ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
-  with a append-only fd);
+  with a append-only fd (PR kern/44307));
 ATF_TC_FSAPPLY(overwrite512, write a 512 byte file twice);
 ATF_TC_FSAPPLY(overwrite64k, write a 64k byte file twice);
 ATF_TC_FSAPPLY(overwrite_trunc, write 64k + truncate + rewrite);



CVS commit: src/tests/fs/vfs

2012-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 21:49:08 UTC 2012

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
annotate fixed failures as comments.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.30 src/tests/fs/vfs/t_vnops.c:1.31
--- src/tests/fs/vfs/t_vnops.c:1.30	Mon Dec 12 14:11:22 2011
+++ src/tests/fs/vfs/t_vnops.c	Sun Mar 18 17:49:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.30 2011/12/12 19:11:22 njoly Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.31 2012/03/18 21:49:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -176,10 +176,6 @@ dir_rmdirdotdot(const atf_tc_t *tc, cons
 		xerrno = ESTALE;
 	else
 		xerrno = ENOENT;
-	/*
-	if (FSTYPE_TMPFS(tc))
-		atf_tc_expect_signal(-1, PR kern/44657);
-	*/
 	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir(..) == -1);
 	FSTEST_EXIT();
 }
@@ -296,10 +292,6 @@ rename_dir(const atf_tc_t *tc, const cha
 	if (! FSTYPE_MSDOS(tc))
 		ATF_CHECK_EQ(sb.st_nlink, 3);
 	RL(rump_sys_rmdir(pb3));
-	/*
-	if (FSTYPE_TMPFS(tc))
-		atf_tc_expect_signal(-1, PR kern/44288);
-	*/
 	RL(rump_sys_rmdir(pb1));
 }
 
@@ -327,9 +319,6 @@ rename_dotdot(const atf_tc_t *tc, const 
 		atf_tc_fail_errno(self-dotdot from);
 	atf_tc_expect_pass();
 
-	/*
-	if (FSTYPE_TMPFS(tc)) {
-		atf_tc_expect_fail(PR kern/43617);
 	}
 	*/
 	if (rump_sys_rename(dir1, dir2/..) != -1 || errno != EINVAL)
@@ -852,9 +841,10 @@ ATF_TC_FSAPPLY(lookup_simple, simple lo
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
 ATF_TC_FSAPPLY(dir_notempty, non-empty directories cannot be removed);
-ATF_TC_FSAPPLY(dir_rmdirdotdot, remove .. and try to cd out);
-ATF_TC_FSAPPLY(rename_dir, exercise various directory renaming ops);
-ATF_TC_FSAPPLY(rename_dotdot, rename dir ..);
+ATF_TC_FSAPPLY(dir_rmdirdotdot, remove .. and try to cd out (PR kern/44657));
+ATF_TC_FSAPPLY(rename_dir, exercise various directory renaming ops 
+(PR kern/44288));
+ATF_TC_FSAPPLY(rename_dotdot, rename dir .. (PR kern/43617));
 ATF_TC_FSAPPLY(rename_reg_nodir, rename regular files, no subdirectories);
 ATF_TC_FSAPPLY(create_nametoolong, create file with name too long);
 ATF_TC_FSAPPLY(create_exist, create with O_EXCL);



CVS commit: src/tests/fs/vfs

2012-03-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar 19 03:33:54 UTC 2012

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Finish removing the block of commented-out code from rev 1.31

Hello, christos!


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.31 src/tests/fs/vfs/t_vnops.c:1.32
--- src/tests/fs/vfs/t_vnops.c:1.31	Sun Mar 18 21:49:08 2012
+++ src/tests/fs/vfs/t_vnops.c	Mon Mar 19 03:33:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.31 2012/03/18 21:49:08 christos Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.32 2012/03/19 03:33:54 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -319,8 +319,6 @@ rename_dotdot(const atf_tc_t *tc, const 
 		atf_tc_fail_errno(self-dotdot from);
 	atf_tc_expect_pass();
 
-	}
-	*/
 	if (rump_sys_rename(dir1, dir2/..) != -1 || errno != EINVAL)
 		atf_tc_fail(other-dotdot);
 



CVS commit: src/tests/fs/vfs

2012-03-15 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Mar 15 12:57:28 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Add another testcase that check setting file times with unprivileged
credentials.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.5 src/tests/fs/vfs/t_unpriv.c:1.6
--- src/tests/fs/vfs/t_unpriv.c:1.5	Thu Feb  9 18:31:03 2012
+++ src/tests/fs/vfs/t_unpriv.c	Thu Mar 15 12:57:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.5 2012/02/09 18:31:03 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.6 2012/03/15 12:57:27 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -26,6 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include sys/time.h
+
 #include atf-c.h
 #include libgen.h
 #include unistd.h
@@ -115,14 +117,45 @@ dirperms(const atf_tc_t *tc, const char 
 	FSTEST_EXIT();
 }
 
+static void
+times(const atf_tc_t *tc, const char *mp)
+{
+	const char *name = file.test;
+	int fd;
+
+	FSTEST_ENTER();
+
+	if ((fd = rump_sys_open(name, O_RDWR|O_CREAT, 0666)) == -1)
+		atf_tc_fail_errno(open);
+	if (rump_sys_close(fd) == -1)
+		atf_tc_fail_errno(close);
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(1) == -1)
+		atf_tc_fail_errno(setuid);
+	if (rump_sys_utimes(name, NULL) != -1 || errno != EACCES)
+		atf_tc_fail_errno(utimes);
+	rump_pub_lwproc_releaselwp();
+
+	if (rump_sys_utimes(name, NULL) == -1)
+		atf_tc_fail_errno(utimes);
+
+	if (rump_sys_unlink(name) == -1)
+		atf_tc_fail_errno(unlink);
+
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(owner, owner unprivileged checks);
 ATF_TC_FSAPPLY(dirperms, directory permission checks);
+ATF_TC_FSAPPLY(times, time set checks);
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_FSAPPLY(owner);
 	ATF_TP_FSAPPLY(dirperms);
+	ATF_TP_FSAPPLY(times);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2012-02-09 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Feb  9 18:31:04 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
Add a testcase which checks that directory permissions are honored for
file creation/deletion with unprivileged credentials.

releng ok.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.4 src/tests/fs/vfs/t_unpriv.c:1.5
--- src/tests/fs/vfs/t_unpriv.c:1.4	Tue Jan 31 19:02:49 2012
+++ src/tests/fs/vfs/t_unpriv.c	Thu Feb  9 18:31:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.4 2012/01/31 19:02:49 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.5 2012/02/09 18:31:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -27,6 +27,7 @@
  */
 
 #include atf-c.h
+#include libgen.h
 #include unistd.h
 
 #include rump/rump_syscalls.h
@@ -71,13 +72,57 @@ owner(const atf_tc_t *tc, const char *mp
 	FSTEST_EXIT();
 }
 
+static void
+dirperms(const atf_tc_t *tc, const char *mp)
+{
+	char name[] = dir.test/file.test;
+	char *dir = dirname(name);
+	int fd;
+
+	if (FSTYPE_SYSVBFS(tc))
+		atf_tc_skip(directories not supported by file system);
+
+	FSTEST_ENTER();
+
+	if (rump_sys_mkdir(dir, 0777) == -1)
+		atf_tc_fail_errno(mkdir);
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(1) == -1)
+		atf_tc_fail_errno(setuid);
+if (rump_sys_open(name, O_RDWR|O_CREAT, 0666) != -1 || errno != EACCES)
+		atf_tc_fail_errno(open);
+	rump_pub_lwproc_releaselwp();
+
+	if ((fd = rump_sys_open(name, O_RDWR|O_CREAT, 0666)) == -1)
+		atf_tc_fail_errno(open);
+	if (rump_sys_close(fd) == -1)
+		atf_tc_fail_errno(close);
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(1) == -1)
+		atf_tc_fail_errno(setuid);
+if (rump_sys_unlink(name) != -1 || errno != EACCES)
+		atf_tc_fail_errno(unlink);
+	rump_pub_lwproc_releaselwp();
+
+if (rump_sys_unlink(name) == -1)
+		atf_tc_fail_errno(unlink);
+
+	if (rump_sys_rmdir(dir) == -1)
+		atf_tc_fail_errno(rmdir);
+
+	FSTEST_EXIT();
+}
 
 ATF_TC_FSAPPLY(owner, owner unprivileged checks);
+ATF_TC_FSAPPLY(dirperms, directory permission checks);
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_FSAPPLY(owner);
+	ATF_TP_FSAPPLY(dirperms);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2012-01-31 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Jan 31 19:02:49 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
owner testcase now succeed with rumpfs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.3 src/tests/fs/vfs/t_unpriv.c:1.4
--- src/tests/fs/vfs/t_unpriv.c:1.3	Fri Jan 27 21:53:50 2012
+++ src/tests/fs/vfs/t_unpriv.c	Tue Jan 31 19:02:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.3 2012/01/27 21:53:50 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.4 2012/01/31 19:02:49 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include ../../h_macros.h
 
 #define USES_OWNER			 \
-	if (FSTYPE_MSDOS(tc) || FSTYPE_RUMPFS(tc)) \
+	if (FSTYPE_MSDOS(tc))		 \
 	atf_tc_skip(owner not supported by file system)
 
 static void



CVS commit: src/tests/fs/vfs

2012-01-27 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri Jan 27 21:53:50 UTC 2012

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
unpriv owner test now pass for sysvbfs.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.2 src/tests/fs/vfs/t_unpriv.c:1.3
--- src/tests/fs/vfs/t_unpriv.c:1.2	Sat Oct  8 13:00:55 2011
+++ src/tests/fs/vfs/t_unpriv.c	Fri Jan 27 21:53:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.2 2011/10/08 13:00:55 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.3 2012/01/27 21:53:50 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include ../../h_macros.h
 
 #define USES_OWNER			 \
-	if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc) || FSTYPE_RUMPFS(tc)) \
+	if (FSTYPE_MSDOS(tc) || FSTYPE_RUMPFS(tc)) \
 	atf_tc_skip(owner not supported by file system)
 
 static void



CVS commit: src/tests/fs/vfs

2011-10-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sat Oct  8 13:00:55 UTC 2011

Modified Files:
src/tests/fs/vfs: t_unpriv.c

Log Message:
USE_OWNER - USES_OWNER for consistency with other macros.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_unpriv.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/vfs/t_unpriv.c
diff -u src/tests/fs/vfs/t_unpriv.c:1.1 src/tests/fs/vfs/t_unpriv.c:1.2
--- src/tests/fs/vfs/t_unpriv.c:1.1	Thu Jan  6 15:19:10 2011
+++ src/tests/fs/vfs/t_unpriv.c	Sat Oct  8 13:00:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unpriv.c,v 1.1 2011/01/06 15:19:10 njoly Exp $	*/
+/*	$NetBSD: t_unpriv.c,v 1.2 2011/10/08 13:00:55 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include ../common/h_fsmacros.h
 #include ../../h_macros.h
 
-#define USE_OWNER			 \
+#define USES_OWNER			 \
 	if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc) || FSTYPE_RUMPFS(tc)) \
 	atf_tc_skip(owner not supported by file system)
 
@@ -43,7 +43,7 @@ static void
 owner(const atf_tc_t *tc, const char *mp)
 {
 
-	USE_OWNER;
+	USES_OWNER;
 
 	FSTEST_ENTER();
 



CVS commit: src/tests/fs/vfs

2011-10-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sat Oct  8 13:08:54 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c t_rmdirrace.c t_vnops.c

Log Message:
Slightly adjust skipped messages, makes output more consistent.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/fs/vfs/t_renamerace.c
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_rmdirrace.c
cvs rdiff -u -r1.28 -r1.29 src/tests/fs/vfs/t_vnops.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.23 src/tests/fs/vfs/t_renamerace.c:1.24
--- src/tests/fs/vfs/t_renamerace.c:1.23	Mon Jul 18 06:47:08 2011
+++ src/tests/fs/vfs/t_renamerace.c	Sat Oct  8 13:08:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.23 2011/07/18 06:47:08 dholland Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.24 2011/10/08 13:08:54 njoly Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -85,7 +85,7 @@ renamerace(const atf_tc_t *tc, const cha
 		atf_tc_expect_signal(-1, PR kern/43582);
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
@@ -133,10 +133,10 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	pthread_t pt1, pt2;
 
 	if (FSTYPE_SYSVBFS(tc))
-		atf_tc_skip(directories not supported);
+		atf_tc_skip(directories not supported by file system);
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) || FSTYPE_MSDOS(tc))

Index: src/tests/fs/vfs/t_rmdirrace.c
diff -u src/tests/fs/vfs/t_rmdirrace.c:1.7 src/tests/fs/vfs/t_rmdirrace.c:1.8
--- src/tests/fs/vfs/t_rmdirrace.c:1.7	Mon Jul 19 16:00:45 2010
+++ src/tests/fs/vfs/t_rmdirrace.c	Sat Oct  8 13:08:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rmdirrace.c,v 1.7 2010/07/19 16:00:45 pooka Exp $	*/
+/*	$NetBSD: t_rmdirrace.c,v 1.8 2011/10/08 13:08:54 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@ race(const atf_tc_t *tc, const char *pat
 	if (FSTYPE_LFS(tc))
 		atf_tc_expect_signal(-1, PR kern/43582);
 	if (FSTYPE_SYSVBFS(tc))
-		atf_tc_skip(rmdir(2) not supported by file system);
+		atf_tc_skip(directories not supported by file system);
 
 	fd = rump_sys_open(., O_RDONLY, 0666);
 	if (fd == -1)

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.28 src/tests/fs/vfs/t_vnops.c:1.29
--- src/tests/fs/vfs/t_vnops.c:1.28	Fri Aug 19 01:25:27 2011
+++ src/tests/fs/vfs/t_vnops.c	Sat Oct  8 13:08:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.28 2011/08/19 01:25:27 riastradh Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.29 2011/10/08 13:08:54 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -45,8 +45,9 @@
 
 #define TESTFILE afile
 
-#define USES_DIRS \
-if (FSTYPE_SYSVBFS(tc)) atf_tc_skip(dirs not supported by file system)
+#define USES_DIRS	\
+if (FSTYPE_SYSVBFS(tc))\
+	atf_tc_skip(directories not supported by file system)
 
 #define USES_SYMLINKS	\
 if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc))		\
@@ -205,7 +206,7 @@ rename_dir(const atf_tc_t *tc, const cha
 	struct stat ref, sb;
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	USES_DIRS;
 
@@ -307,7 +308,7 @@ rename_dotdot(const atf_tc_t *tc, const 
 {
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	USES_DIRS;
 
@@ -345,7 +346,7 @@ rename_reg_nodir(const atf_tc_t *tc, con
 	ino_t f1ino, f2ino;
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	if (rump_sys_chdir(mp) == -1)
 		atf_tc_fail_errno(chdir mountpoint);
@@ -482,7 +483,7 @@ rename_nametoolong(const atf_tc_t *tc, c
 	size_t len;
 
 	if (FSTYPE_RUMPFS(tc))
-		atf_tc_skip(rename not supported by fs);
+		atf_tc_skip(rename not supported by file system);
 
 	if (rump_sys_chdir(mp) == -1)
 		atf_tc_fail_errno(chdir mountpoint);



CVS commit: src/tests/fs/vfs

2011-08-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug 19 01:25:28 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add test for `ln -s / foo  cd foo'.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.27 src/tests/fs/vfs/t_vnops.c:1.28
--- src/tests/fs/vfs/t_vnops.c:1.27	Thu Aug 11 10:52:12 2011
+++ src/tests/fs/vfs/t_vnops.c	Fri Aug 19 01:25:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.27 2011/08/11 10:52:12 uch Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.28 2011/08/19 01:25:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -534,6 +534,17 @@
 }
 
 static void
+symlink_root(const atf_tc_t *tc, const char *mp)
+{
+
+	USES_SYMLINKS;
+
+	RL(rump_sys_chdir(mp));
+	RL(rump_sys_symlink(/, foo));
+	RL(rump_sys_chdir(foo));
+}
+
+static void
 attrs(const atf_tc_t *tc, const char *mp)
 {
 	struct stat sb, sb2;
@@ -827,6 +838,7 @@
 ATF_TC_FSAPPLY(create_exist, create with O_EXCL);
 ATF_TC_FSAPPLY(rename_nametoolong, rename to file with name too long);
 ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
+ATF_TC_FSAPPLY(symlink_root, symlink to root directory);
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
 ATF_TC_FSAPPLY(fcntl_lock, check fcntl F_SETLK);
 ATF_TC_FSAPPLY(fcntl_getlock_pids,fcntl F_GETLK w/ many procs, PR kern/44494);
@@ -847,6 +859,7 @@
 	ATF_TP_FSAPPLY(create_exist);
 	ATF_TP_FSAPPLY(rename_nametoolong);
 	ATF_TP_FSAPPLY(symlink_zerolen);
+	ATF_TP_FSAPPLY(symlink_root);
 	ATF_TP_FSAPPLY(attrs);
 	ATF_TP_FSAPPLY(fcntl_lock);
 	ATF_TP_FSAPPLY(fcntl_getlock_pids);



CVS commit: src/tests/fs/vfs

2011-07-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat Jul 23 09:59:14 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Don't assume that first lock that blocks is a lock with the lowest
start offset and change the test to work when F_GETLK returns any
lock that blocks.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.25 src/tests/fs/vfs/t_vnops.c:1.26
--- src/tests/fs/vfs/t_vnops.c:1.25	Wed Jul 20 11:52:00 2011
+++ src/tests/fs/vfs/t_vnops.c	Sat Jul 23 09:59:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.25 2011/07/20 11:52:00 hannken Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.26 2011/07/23 09:59:14 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -636,6 +636,57 @@
 	return a  b ? -1 : (a  b ? 1 : 0);
 }
 
+/*
+ * Find all locks set by fcntl_getlock_pids test
+ * using GETLK for a range [start, start+end], and,
+ * if there is a blocking lock, recursively find
+ * all locks to the left (toward the beginning of
+ * a file) and to the right of the lock.
+ * The function also understands until end of file
+ * convention when len==0.
+ */
+static unsigned int
+fcntl_getlocks(int fildes, off_t start, off_t len,
+struct flock *lock, struct flock *end)
+{
+	unsigned int rv = 0;
+	const struct flock l = { start, len, 0, F_RDLCK, SEEK_SET };
+
+	if (lock == end)
+		return rv;
+
+	RL(rump_sys_fcntl(fildes, F_GETLK, l));
+
+	if (l.l_type == F_UNLCK)
+		return rv;
+
+	*lock++ = l;
+	rv += 1;
+
+	ATF_REQUIRE(l.l_whence == SEEK_SET);
+
+	if (l.l_start  start) {
+		unsigned int n =
+		fcntl_getlocks(fildes, start, l.l_start - start, lock, end);
+		rv += n;
+		lock += n;
+		if (lock == end)
+			return rv;
+	}
+
+	if (l.l_len == 0) /* does l spans until the end? */
+		return rv;
+
+	if (len == 0) /* are we looking for locks until the end? */ {
+		rv += fcntl_getlocks(fildes, l.l_start + l.l_len, len, lock, end);
+	} else if (l.l_start + l.l_len  start + len) {
+		len -= l.l_start + l.l_len - start;
+		rv += fcntl_getlocks(fildes, l.l_start + l.l_len, len, lock, end);
+	}
+
+	return rv;
+}
+
 static void
 fcntl_getlock_pids(const atf_tc_t *tc, const char *mp)
 {
@@ -648,9 +699,13 @@
 		{ 4, 3, 0, F_WRLCK, SEEK_SET },
 	};
 
-	int fd[4];
-	struct lwp *lwp[4];
-	pid_t prevpid = 0;
+/* Add extra element to make sure recursion does't stop at array end */
+	struct flock result[5];
+
+	/* Add 5th process */
+	int fd[5];
+	pid_t pid[5];
+	struct lwp *lwp[5];
 
 	unsigned int i, j;
 	const off_t sz = 8192;
@@ -658,7 +713,6 @@
 	int oflags = O_RDWR | O_CREAT;
 
 	memcpy(expect, lock, sizeof(lock));
-	qsort(expect, __arraycount(expect), sizeof(expect[0]), flock_compare);
 
 	FSTEST_ENTER();
 
@@ -667,68 +721,60 @@
 	 * file.  Note that the third and fourth processes lock in
 	 * reverse order, i.e. the greater pid locks a range before
 	 * the lesser pid.
+	 * Then, we create 5th process which doesn't lock anything.
 	 */
-	for(i = 0; i  __arraycount(lwp); i++) {
+	for (i = 0; i  __arraycount(lwp); i++) {
 		RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 
 		lwp[i] = rump_pub_lwproc_curlwp();
-		assert(rump_sys_getpid()  prevpid);
-		prevpid = rump_sys_getpid();
+		pid[i] = rump_sys_getpid();
 
 		RL(fd[i] = rump_sys_open(TESTFILE, oflags, omode));
 		oflags = O_RDWR;
 		omode  = 0;
 
 		RL(rump_sys_ftruncate(fd[i], sz));
-		RL(rump_sys_fcntl(fd[i], F_SETLK, lock[i]));
+
+		if (i  __arraycount(lock)) {
+			RL(rump_sys_fcntl(fd[i], F_SETLK, lock[i]));
+			expect[i].l_pid = pid[i];
+		}
 	}
 
-	atf_tc_expect_fail(PR kern/44494);
+	qsort(expect, __arraycount(expect), sizeof(expect[0]), flock_compare);
+
 	/*
-	 * In the context of each pid , do GETLK for a readlock from
-	 * i = [0,__arraycount(locks)].  If we try to lock from the same
-	 * start offset as the lock our current process holds, check
-	 * that we fail on the offset of the next lock (else if branch).
-	 * Otherwise, expect to get a lock for the current offset
-	 * (if branch).  The else branch is purely for the last
-	 * process where we expect no blocking locks.
+	 * In the context of each process, recursively find all locks
+	 * that would block the current process. Processes 1-4 don't
+	 * see their own lock, we insert it to simplify checks.
+	 * Process 5 sees all 4 locks.
 	 */
-	for(i = 0; i  __arraycount(lwp); i++) {
+	for (i = 0; i  __arraycount(lwp); i++) {
+		unsigned int nlocks;
+
 		rump_pub_lwproc_switch(lwp[i]);
 
-		for(j = 0; j  __arraycount(lwp); j++) {
-			struct flock l;
-			l = expect[j];
-			l.l_len = sz;
-			l.l_type = F_RDLCK;
-
-			RL(rump_sys_fcntl(fd[i], F_GETLK, l));
-
-			if(expect[j].l_start != lock[i].l_start) {
-/*
- * lock set by another process
- */
-ATF_CHECK(l.l_type != F_UNLCK);
-ATF_CHECK_EQ(l.l_start, 

CVS commit: src/tests/fs/vfs

2011-07-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jul 18 06:47:08 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
ffs and ffslog are no longer xfail.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.22 src/tests/fs/vfs/t_renamerace.c:1.23
--- src/tests/fs/vfs/t_renamerace.c:1.22	Mon Mar 14 19:05:19 2011
+++ src/tests/fs/vfs/t_renamerace.c	Mon Jul 18 06:47:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.22 2011/03/14 19:05:19 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.23 2011/07/18 06:47:08 dholland Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -139,8 +139,7 @@
 		atf_tc_skip(rename not supported by fs);
 
 	/* XXX: msdosfs also sometimes hangs */
-	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
-	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
+	if (FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) || FSTYPE_MSDOS(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
 	/* XXX: unracy execution not caught */
@@ -165,8 +164,7 @@
 	 * Doesn't always trigger when run on a slow backend
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.
 	 */
-	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
-	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
+	if (FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) || FSTYPE_MSDOS(tc))
 		abort();
 
 	if (FSTYPE_P2K_FFS(tc)) {



CVS commit: src/tests/fs/vfs

2011-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 13:10:38 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Remove expected failure for tmpfs PRs that are now fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.23 src/tests/fs/vfs/t_vnops.c:1.24
--- src/tests/fs/vfs/t_vnops.c:1.23	Fri Apr  1 17:40:54 2011
+++ src/tests/fs/vfs/t_vnops.c	Mon May 30 13:10:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.23 2011/04/01 17:40:54 hannken Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.24 2011/05/30 13:10:38 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -175,8 +175,10 @@
 		xerrno = ESTALE;
 	else
 		xerrno = ENOENT;
+	/*
 	if (FSTYPE_TMPFS(tc))
 		atf_tc_expect_signal(-1, PR kern/44657);
+	*/
 	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir(..) == -1);
 	FSTEST_EXIT();
 }
@@ -293,8 +295,10 @@
 	if (! FSTYPE_MSDOS(tc))
 		ATF_CHECK_EQ(sb.st_nlink, 3);
 	RL(rump_sys_rmdir(pb3));
+	/*
 	if (FSTYPE_TMPFS(tc))
 		atf_tc_expect_signal(-1, PR kern/44288);
+	*/
 	RL(rump_sys_rmdir(pb1));
 }
 
@@ -322,9 +326,11 @@
 		atf_tc_fail_errno(self-dotdot from);
 	atf_tc_expect_pass();
 
+	/*
 	if (FSTYPE_TMPFS(tc)) {
 		atf_tc_expect_fail(PR kern/43617);
 	}
+	*/
 	if (rump_sys_rename(dir1, dir2/..) != -1 || errno != EINVAL)
 		atf_tc_fail(other-dotdot);
 



CVS commit: src/tests/fs/vfs

2011-03-17 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Thu Mar 17 19:48:37 UTC 2011

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
Remove hack introduced in revision 1.6 to workaround a bug in atf-run that
would cause it to lock up while waiting for the p2k_ffs_fillfs test case
to complete (in some cases only).

This has been fixed by the upstream revision
3dd2481ec97b2fde76521939b6451d03ce989745 which I have just pulled into
our copy of atf.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.6 src/tests/fs/vfs/t_full.c:1.7
--- src/tests/fs/vfs/t_full.c:1.6	Sun Mar  6 10:33:40 2011
+++ src/tests/fs/vfs/t_full.c	Thu Mar 17 19:48:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.6 2011/03/06 10:33:40 pooka Exp $	*/
+/*	$NetBSD: t_full.c,v 1.7 2011/03/17 19:48:37 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -57,13 +57,6 @@
 	int fd, i = 0;
 
 	if (FSTYPE_P2K_FFS(tc) || FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
-		/*
-		 * XXX: explicitly unmount to prevent some race.
-		 * temporary hack, fix properly
-		 */
-		if (FSTYPE_P2K_FFS(tc)) {
-			puffs_fstest_unmount(tc, mp, MNT_FORCE);
-		}
 		atf_tc_skip(fs does not support explicit block allocation 
 		(GOP_ALLOC));
 	}



CVS commit: src/tests/fs/vfs

2011-03-06 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  6 10:33:40 UTC 2011

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
Add a kludge to prevent a test run from completely hanging.
Some analysis:

1) p2k_ffs test program opens a socketpair and forks off rump_ffs
2) after mounting the file system, test program decides it
   wants to skip the test and exits
3) somehow, the puffs event thread of rump_ffs stays in kqueue
   waiting for activity.  fstat+gdb suggests it's waiting for the
   now-orphaned socketpair (but I didn't fully verify.  is there
   an easy way to dump the state of a kqueue descriptor?).
4) test program is a zombie
5) atf-run waits forever

Note: this doesn't trigger always.

So, it seems there are at least two bugs: 1) test case doesn't
timeout 2) the kevent call in rump_ffs never returns even though
the sockerpair is orphaned

So, explicitly unmount the file system before skipping the test.
Obviously the above bugs needs to be properly fixed, since other
skipping test cases can unbeknowingly trigger the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.5 src/tests/fs/vfs/t_full.c:1.6
--- src/tests/fs/vfs/t_full.c:1.5	Fri Jan  7 11:41:54 2011
+++ src/tests/fs/vfs/t_full.c	Sun Mar  6 10:33:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.5 2011/01/07 11:41:54 pooka Exp $	*/
+/*	$NetBSD: t_full.c,v 1.6 2011/03/06 10:33:40 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -57,6 +57,13 @@
 	int fd, i = 0;
 
 	if (FSTYPE_P2K_FFS(tc) || FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
+		/*
+		 * XXX: explicitly unmount to prevent some race.
+		 * temporary hack, fix properly
+		 */
+		if (FSTYPE_P2K_FFS(tc)) {
+			puffs_fstest_unmount(tc, mp, MNT_FORCE);
+		}
 		atf_tc_skip(fs does not support explicit block allocation 
 		(GOP_ALLOC));
 	}



CVS commit: src/tests/fs/vfs

2011-03-06 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  6 16:00:17 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Add a race catcher for p2k_ffs renamerace -- it seems like the
problem doesn't trigger always especially in a qemu env (but triggers
100% of the time on my desktop).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.20 src/tests/fs/vfs/t_renamerace.c:1.21
--- src/tests/fs/vfs/t_renamerace.c:1.20	Thu Mar  3 11:01:27 2011
+++ src/tests/fs/vfs/t_renamerace.c	Sun Mar  6 16:00:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.20 2011/03/03 11:01:27 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.21 2011/03/06 16:00:16 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -158,6 +158,12 @@
 	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
 	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
 		abort();
+
+	if (FSTYPE_P2K_FFS(tc)) {
+		/* XXX: some races may hang test run if we don't unmount */
+		puffs_fstest_unmount(tc, mp, MNT_FORCE);
+		atf_tc_fail(problem did not trigger);
+	}
 }
 
 ATF_TC_FSAPPLY(renamerace, rename(2) race with file unlinked mid-operation);



CVS commit: src/tests/fs/vfs

2011-03-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Mar  3 11:01:27 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
The re-enabled renamerace test also triggers the recent msdosfs
vnode leak.  xfail this under the blanket of PR kern/44661.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.19 src/tests/fs/vfs/t_renamerace.c:1.20
--- src/tests/fs/vfs/t_renamerace.c:1.19	Thu Mar  3 10:57:30 2011
+++ src/tests/fs/vfs/t_renamerace.c	Thu Mar  3 11:01:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.19 2011/03/03 10:57:30 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.20 2011/03/03 11:01:27 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -112,6 +112,9 @@
 	 */
 	if (FSTYPE_LFS(tc))
 		abort();
+
+	if (FSTYPE_MSDOS(tc))
+		atf_tc_expect_fail(PR kern/44661);
 }
 
 static void



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 14:21:46 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
augment rename test case with the failure from PR kern/44288


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.15 src/tests/fs/vfs/t_vnops.c:1.16
--- src/tests/fs/vfs/t_vnops.c:1.15	Mon Feb 28 03:40:45 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 14:21:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.15 2011/02/28 03:40:45 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.16 2011/03/01 14:21:46 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
 rename_dir(const atf_tc_t *tc, const char *mp)
 {
 	char pb1[MAXPATHLEN], pb2[MAXPATHLEN], pb3[MAXPATHLEN];
-	struct stat ref;
+	struct stat ref, sb;
 
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
@@ -247,11 +247,27 @@
 	md(pb1, mp, dir2/../dir3);
 	checkfile(pb1, ref);
 
-	/* finally, atomic cross-directory rename */
+	/* atomic cross-directory rename */
 	md(pb3, mp, dir2/subdir);
 	if (rump_sys_rename(pb1, pb3) == -1)
 		atf_tc_fail_errno(rename 9);
 	checkfile(pb3, ref);
+
+	/* rename directory over an empty directory */
+	md(pb1, mp, parent);
+	md(pb2, mp, parent/dir1);
+	md(pb3, mp, parent/dir2);
+	RL(rump_sys_mkdir(pb1, 0777));
+	RL(rump_sys_mkdir(pb2, 0777));
+	RL(rump_sys_mkdir(pb3, 0777));
+	RL(rump_sys_rename(pb2, pb3));
+
+	RL(rump_sys_stat(pb1, sb));
+	ATF_CHECK_EQ(sb.st_nlink, 3);
+	RL(rump_sys_rmdir(pb3));
+	if (FSTYPE_TMPFS(tc))
+		atf_tc_expect_signal(-1, PR kern/44288);
+	RL(rump_sys_rmdir(pb1));
 }
 
 static void



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 14:27:32 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Comment out msdosfs skip -- i'm not sure if it will still fail with
the stack size problem, but at least it fails due to yet another
refcounting snafu in the msdosfs rename method.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.16 src/tests/fs/vfs/t_vnops.c:1.17
--- src/tests/fs/vfs/t_vnops.c:1.16	Tue Mar  1 14:21:46 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 14:27:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.16 2011/03/01 14:21:46 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.17 2011/03/01 14:27:32 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -172,8 +172,8 @@
 	char pb1[MAXPATHLEN], pb2[MAXPATHLEN], pb3[MAXPATHLEN];
 	struct stat ref, sb;
 
-	if (FSTYPE_MSDOS(tc))
-		atf_tc_skip(test fails in some setups, reason unknown);
+	//if (FSTYPE_MSDOS(tc))
+		//atf_tc_skip(test fails in some setups, reason unknown);
 
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip(rename not supported by fs);



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:04:48 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Rmdir the dir you're in and its parent and try to cd ..
Fails on tmpfs (crash), puffs (cd .. succeeds) and rumpfs (cd .. succeeds).

another testcase derived from the bugfinding genious of Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.17 src/tests/fs/vfs/t_vnops.c:1.18
--- src/tests/fs/vfs/t_vnops.c:1.17	Tue Mar  1 14:27:32 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 15:04:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.17 2011/03/01 14:27:32 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.18 2011/03/01 15:04:47 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -152,6 +152,34 @@
 }
 
 static void
+dir_rmdirdotdot(const atf_tc_t *tc, const char *mp)
+{
+	char pb[MAXPATHLEN];
+	int xerrno;
+
+	USES_DIRS;
+
+	FSTEST_ENTER();
+	RL(rump_sys_mkdir(test, 0777));
+	RL(rump_sys_chdir(test));
+
+	RL(rump_sys_mkdir(subtest, 0777));
+	RL(rump_sys_chdir(subtest));
+
+	md(pb, mp, test/subtest);
+	RL(rump_sys_rmdir(pb));
+	md(pb, mp, test);
+	RL(rump_sys_rmdir(pb));
+
+	if (FSTYPE_NFS(tc))
+		xerrno = ESTALE;
+	else
+		xerrno = ENOENT;
+	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir(..) == -1);
+	FSTEST_EXIT();
+}
+
+static void
 checkfile(const char *path, struct stat *refp)
 {
 	char buf[MAXPATHLEN];
@@ -749,6 +777,7 @@
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
 ATF_TC_FSAPPLY(dir_notempty, non-empty directories cannot be removed);
+ATF_TC_FSAPPLY(dir_rmdirdotdot, remove .. and try to cd out);
 ATF_TC_FSAPPLY(rename_dir, exercise various directory renaming ops);
 ATF_TC_FSAPPLY(rename_dotdot, rename dir ..);
 ATF_TC_FSAPPLY(rename_reg_nodir, rename regular files, no subdirectories);
@@ -768,6 +797,7 @@
 	ATF_TP_FSAPPLY(lookup_complex);
 	ATF_TP_FSAPPLY(dir_simple);
 	ATF_TP_FSAPPLY(dir_notempty);
+	ATF_TP_FSAPPLY(dir_rmdirdotdot);
 	ATF_TP_FSAPPLY(rename_dir);
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:33:35 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
xfail dir_rmdirdotdot for tmpfs (PR kern/44657)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.18 src/tests/fs/vfs/t_vnops.c:1.19
--- src/tests/fs/vfs/t_vnops.c:1.18	Tue Mar  1 15:04:47 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 15:33:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.18 2011/03/01 15:04:47 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.19 2011/03/01 15:33:35 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -175,6 +175,8 @@
 		xerrno = ESTALE;
 	else
 		xerrno = ENOENT;
+	if (FSTYPE_TMPFS(tc))
+		atf_tc_expect_signal(-1, PR kern/44657);
 	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir(..) == -1);
 	FSTEST_EXIT();
 }



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 20:16:33 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
msdosfs xfail for PR kern/44661


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.19 src/tests/fs/vfs/t_vnops.c:1.20
--- src/tests/fs/vfs/t_vnops.c:1.19	Tue Mar  1 15:33:35 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 20:16:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.19 2011/03/01 15:33:35 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.20 2011/03/01 20:16:33 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -298,6 +298,9 @@
 	if (FSTYPE_TMPFS(tc))
 		atf_tc_expect_signal(-1, PR kern/44288);
 	RL(rump_sys_rmdir(pb1));
+
+	if (FSTYPE_MSDOS(tc))
+		atf_tc_expect_fail(PR kern/44661);
 }
 
 static void



CVS commit: src/tests/fs/vfs

2011-02-27 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Feb 27 15:16:31 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Add a small testcase that shrink a file using 2 consecutive ftruncate
calls.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.7 src/tests/fs/vfs/t_io.c:1.8
--- src/tests/fs/vfs/t_io.c:1.7	Wed Feb  2 14:42:15 2011
+++ src/tests/fs/vfs/t_io.c	Sun Feb 27 15:16:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.7 2011/02/02 14:42:15 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.8 2011/02/27 15:16:31 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -158,6 +158,19 @@
 	overwritebody(tc, 116, true);
 }
 
+static void
+shrinkfile(const atf_tc_t *tc, const char *mp)
+{
+	int fd;
+
+	FSTEST_ENTER();
+	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT|O_TRUNC, 0666));
+	RL(rump_sys_ftruncate(fd, 2));
+	RL(rump_sys_ftruncate(fd, 1));
+	rump_sys_close(fd);
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
 ATF_TC_FSAPPLY(extendfile, check that extending a file works);
 ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
@@ -165,6 +178,7 @@
 ATF_TC_FSAPPLY(overwrite512, write a 512 byte file twice);
 ATF_TC_FSAPPLY(overwrite64k, write a 64k byte file twice);
 ATF_TC_FSAPPLY(overwrite_trunc, write 64k + truncate + rewrite);
+ATF_TC_FSAPPLY(shrinkfile, shrink file);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -175,6 +189,7 @@
 	ATF_TP_FSAPPLY(overwrite512);
 	ATF_TP_FSAPPLY(overwrite64k);
 	ATF_TP_FSAPPLY(overwrite_trunc);
+	ATF_TP_FSAPPLY(shrinkfile);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-02-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Feb 28 03:40:45 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add simple test case for access(2), including panicky scenario from
PR kern/44648.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.14 src/tests/fs/vfs/t_vnops.c:1.15
--- src/tests/fs/vfs/t_vnops.c:1.14	Tue Feb 22 21:23:19 2011
+++ src/tests/fs/vfs/t_vnops.c	Mon Feb 28 03:40:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.14 2011/02/22 21:23:19 yamt Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.15 2011/02/28 03:40:45 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -705,6 +705,30 @@
 	FSTEST_EXIT();
 }
 
+static void
+access_simple(const atf_tc_t *tc, const char *mp)
+{
+	int fd;
+	int tmode;
+
+	FSTEST_ENTER();
+	RL(fd = rump_sys_open(tfile, O_CREAT | O_RDWR, 0777));
+	RL(rump_sys_close(fd));
+
+#define ALLACC (F_OK | X_OK | W_OK | R_OK)
+	if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc))
+		tmode = F_OK;
+	else
+		tmode = ALLACC;
+
+	RL(rump_sys_access(tfile, tmode));
+
+	/* PR kern/44648 */
+	ATF_REQUIRE_ERRNO(EINVAL, rump_sys_access(tfile, ALLACC+1) == -1);
+#undef ALLACC
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(lookup_simple, simple lookup (./.. on root));
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
@@ -719,6 +743,7 @@
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
 ATF_TC_FSAPPLY(fcntl_lock, check fcntl F_SETLK);
 ATF_TC_FSAPPLY(fcntl_getlock_pids,fcntl F_GETLK w/ many procs, PR kern/44494);
+ATF_TC_FSAPPLY(access_simple, access(2));
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -737,6 +762,7 @@
 	ATF_TP_FSAPPLY(attrs);
 	ATF_TP_FSAPPLY(fcntl_lock);
 	ATF_TP_FSAPPLY(fcntl_getlock_pids);
+	ATF_TP_FSAPPLY(access_simple);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-02-22 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Tue Feb 22 21:23:20 UTC 2011

Modified Files:
src/tests/fs/vfs: t_ro.c t_vnops.c

Log Message:
add some tests


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_ro.c
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/vfs/t_vnops.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/vfs/t_ro.c
diff -u src/tests/fs/vfs/t_ro.c:1.4 src/tests/fs/vfs/t_ro.c:1.5
--- src/tests/fs/vfs/t_ro.c:1.4	Mon Jan 31 18:53:29 2011
+++ src/tests/fs/vfs/t_ro.c	Tue Feb 22 21:23:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ro.c,v 1.4 2011/01/31 18:53:29 njoly Exp $	*/
+/*	$NetBSD: t_ro.c,v 1.5 2011/02/22 21:23:19 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -42,6 +42,10 @@
 #include ../../h_macros.h
 
 #define AFILE testfile
+#define ADIR testdir
+#define AFIFO testfifo
+#define ASYMLINK testsymlink
+#define ALINK testlink
 #define FUNTEXT this is some non-humppa text
 #define FUNSIZE (sizeof(FUNTEXT)-1)
 
@@ -138,10 +142,50 @@
 	FSTEST_EXIT();
 }
 
+static void
+createdir(const atf_tc_t *tc, const char *mp)
+{
+
+	FSTEST_ENTER();
+	ATF_REQUIRE_ERRNO(EROFS, rump_sys_mkdir(ADIR, 0775) == -1);
+	FSTEST_EXIT();
+}
+
+static void
+createfifo(const atf_tc_t *tc, const char *mp)
+{
+
+	FSTEST_ENTER();
+	ATF_REQUIRE_ERRNO(EROFS, rump_sys_mkfifo(AFIFO, 0775) == -1);
+	FSTEST_EXIT();
+}
+
+static void
+createsymlink(const atf_tc_t *tc, const char *mp)
+{
+
+	FSTEST_ENTER();
+	ATF_REQUIRE_ERRNO(EROFS, rump_sys_symlink(hoge, ASYMLINK) == -1);
+	FSTEST_EXIT();
+}
+
+static void
+createlink(const atf_tc_t *tc, const char *mp)
+{
+
+	FSTEST_ENTER();
+	ATF_REQUIRE_ERRNO(EROFS, rump_sys_link(AFILE, ALINK) == -1);
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY_RO(create, create file on r/o mount, nullgen);
 ATF_TC_FSAPPLY_RO(rmfile, remove file from r/o mount, filegen);
 ATF_TC_FSAPPLY_RO(fileio, can read a file but not write it, filegen);
 ATF_TC_FSAPPLY_RO(attrs, can query but not change attributes, filegen);
+ATF_TC_FSAPPLY_RO(createdir, create directory on r/o mount, nullgen);
+ATF_TC_FSAPPLY_RO(createfifo, create fifo on r/o mount, nullgen);
+ATF_TC_FSAPPLY_RO(createsymlink, create symlink on r/o mount, nullgen);
+ATF_TC_FSAPPLY_RO(createlink, create hardlink on r/o mount, filegen);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -150,6 +194,10 @@
 	ATF_TP_FSAPPLY_RO(rmfile);
 	ATF_TP_FSAPPLY_RO(fileio);
 	ATF_TP_FSAPPLY_RO(attrs);
+	ATF_TP_FSAPPLY_RO(createdir);
+	ATF_TP_FSAPPLY_RO(createfifo);
+	ATF_TP_FSAPPLY_RO(createsymlink);
+	ATF_TP_FSAPPLY_RO(createlink);
 
 	return atf_no_error();
 }

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.13 src/tests/fs/vfs/t_vnops.c:1.14
--- src/tests/fs/vfs/t_vnops.c:1.13	Mon Jan 31 10:01:26 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Feb 22 21:23:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.13 2011/01/31 10:01:26 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.14 2011/02/22 21:23:19 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -409,6 +409,26 @@
 }
 
 static void
+create_exist(const atf_tc_t *tc, const char *mp)
+{
+	const char *name = hoge;
+	int fd;
+
+	RL(rump_sys_chdir(mp));
+	RL(fd = rump_sys_open(name, O_RDWR|O_CREAT|O_EXCL, 0666));
+	RL(rump_sys_close(fd));
+	RL(rump_sys_unlink(name));
+	RL(fd = rump_sys_open(name, O_RDWR|O_CREAT, 0666));
+	RL(rump_sys_close(fd));
+	RL(fd = rump_sys_open(name, O_RDWR|O_CREAT, 0666));
+	RL(rump_sys_close(fd));
+	ATF_REQUIRE_ERRNO(EEXIST,
+	(fd = rump_sys_open(name, O_RDWR|O_CREAT|O_EXCL, 0666)));
+	RL(rump_sys_unlink(name));
+	RL(rump_sys_chdir(/));
+}
+
+static void
 rename_nametoolong(const atf_tc_t *tc, const char *mp)
 {
 	char *name;
@@ -693,6 +713,7 @@
 ATF_TC_FSAPPLY(rename_dotdot, rename dir ..);
 ATF_TC_FSAPPLY(rename_reg_nodir, rename regular files, no subdirectories);
 ATF_TC_FSAPPLY(create_nametoolong, create file with name too long);
+ATF_TC_FSAPPLY(create_exist, create with O_EXCL);
 ATF_TC_FSAPPLY(rename_nametoolong, rename to file with name too long);
 ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
@@ -710,6 +731,7 @@
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);
 	ATF_TP_FSAPPLY(create_nametoolong);
+	ATF_TP_FSAPPLY(create_exist);
 	ATF_TP_FSAPPLY(rename_nametoolong);
 	ATF_TP_FSAPPLY(symlink_zerolen);
 	ATF_TP_FSAPPLY(attrs);



CVS commit: src/tests/fs/vfs

2011-02-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Feb  2 14:42:15 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
add a few overwrite-related tests


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.6 src/tests/fs/vfs/t_io.c:1.7
--- src/tests/fs/vfs/t_io.c:1.6	Mon Jan  3 09:35:33 2011
+++ src/tests/fs/vfs/t_io.c	Wed Feb  2 14:42:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.6 2011/01/03 09:35:33 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.7 2011/02/02 14:42:15 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -117,10 +117,54 @@
 	extendbody(tc, 37);
 }
 
+static void
+overwritebody(const atf_tc_t *tc, off_t count, bool dotrunc)
+{
+	char *buf;
+	int fd;
+
+	REQUIRE_LIBC(buf = malloc(count), NULL);
+	FSTEST_ENTER();
+	RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR));
+	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count);
+	RL(rump_sys_close(fd));
+
+	RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR));
+	if (dotrunc)
+		RL(rump_sys_ftruncate(fd, 0));
+	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count);
+	RL(rump_sys_close(fd));
+	FSTEST_EXIT();
+}
+
+static void
+overwrite512(const atf_tc_t *tc, const char *mp)
+{
+
+	overwritebody(tc, 512, false);
+}
+
+static void
+overwrite64k(const atf_tc_t *tc, const char *mp)
+{
+
+	overwritebody(tc, 116, false);
+}
+
+static void
+overwrite_trunc(const atf_tc_t *tc, const char *mp)
+{
+
+	overwritebody(tc, 116, true);
+}
+
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
 ATF_TC_FSAPPLY(extendfile, check that extending a file works);
 ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
   with a append-only fd);
+ATF_TC_FSAPPLY(overwrite512, write a 512 byte file twice);
+ATF_TC_FSAPPLY(overwrite64k, write a 64k byte file twice);
+ATF_TC_FSAPPLY(overwrite_trunc, write 64k + truncate + rewrite);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -128,6 +172,9 @@
 	ATF_TP_FSAPPLY(holywrite);
 	ATF_TP_FSAPPLY(extendfile);
 	ATF_TP_FSAPPLY(extendfile_append);
+	ATF_TP_FSAPPLY(overwrite512);
+	ATF_TP_FSAPPLY(overwrite64k);
+	ATF_TP_FSAPPLY(overwrite_trunc);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-01-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 31 10:01:26 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add test case for F_GETLK pid-oddness from PR kern/44494.

I found the test case a little difficult to understand (because of
many indices), so I added a few more comments after I think I
figured out what was going on.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.12 src/tests/fs/vfs/t_vnops.c:1.13
--- src/tests/fs/vfs/t_vnops.c:1.12	Tue Jan 11 14:03:38 2011
+++ src/tests/fs/vfs/t_vnops.c	Mon Jan 31 10:01:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.12 2011/01/11 14:03:38 kefren Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.13 2011/01/31 10:01:26 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,10 +29,12 @@
 #include sys/stat.h
 #include sys/statvfs.h
 
+#include assert.h
 #include atf-c.h
 #include fcntl.h
 #include libgen.h
 #include stdlib.h
+#include string.h
 #include unistd.h
 
 #include rump/rump_syscalls.h
@@ -567,6 +569,122 @@
 	FSTEST_EXIT();
 }
 
+static int
+flock_compare(const void *p, const void *q)
+{
+	int a = ((const struct flock *)p)-l_start;
+	int b = ((const struct flock *)q)-l_start;
+	return a  b ? -1 : (a  b ? 1 : 0);
+}
+
+static void
+fcntl_getlock_pids(const atf_tc_t *tc, const char *mp)
+{
+	/* test non-overlaping ranges */
+	struct flock expect[4];
+	const struct flock lock[4] = {
+		{ 0, 2, 0, F_WRLCK, SEEK_SET },
+		{ 2, 1, 0, F_WRLCK, SEEK_SET },
+		{ 7, 5, 0, F_WRLCK, SEEK_SET },
+		{ 4, 3, 0, F_WRLCK, SEEK_SET },
+	};
+
+	int fd[4];
+	struct lwp *lwp[4];
+	pid_t prevpid = 0;
+
+	unsigned int i, j;
+	const off_t sz = 8192;
+	int omode  = 0755;
+	int oflags = O_RDWR | O_CREAT;
+
+	memcpy(expect, lock, sizeof(lock));
+	qsort(expect, __arraycount(expect), sizeof(expect[0]), flock_compare);
+
+	FSTEST_ENTER();
+
+	/*
+	 * First, we create 4 processes and let each lock a range of the
+	 * file.  Note that the third and fourth processes lock in
+	 * reverse order, i.e. the greater pid locks a range before
+	 * the lesser pid.
+	 */
+	for(i = 0; i  __arraycount(lwp); i++) {
+		RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
+
+		lwp[i] = rump_pub_lwproc_curlwp();
+		assert(rump_sys_getpid()  prevpid);
+		prevpid = rump_sys_getpid();
+
+		RL(fd[i] = rump_sys_open(TESTFILE, oflags, omode));
+		oflags = O_RDWR;
+		omode  = 0;
+
+		RL(rump_sys_ftruncate(fd[i], sz));
+		RL(rump_sys_fcntl(fd[i], F_SETLK, lock[i]));
+	}
+
+	atf_tc_expect_fail(PR kern/44494);
+	/*
+	 * In the context of each pid , do GETLK for a readlock from
+	 * i = [0,__arraycount(locks)].  If we try to lock from the same
+	 * start offset as the lock our current process holds, check
+	 * that we fail on the offset of the next lock (else if branch).
+	 * Otherwise, expect to get a lock for the current offset
+	 * (if branch).  The else branch is purely for the last
+	 * process where we expect no blocking locks.
+	 */
+	for(i = 0; i  __arraycount(lwp); i++) {
+		rump_pub_lwproc_switch(lwp[i]);
+
+		for(j = 0; j  __arraycount(lwp); j++) {
+			struct flock l;
+			l = expect[j];
+			l.l_len = sz;
+			l.l_type = F_RDLCK;
+
+			RL(rump_sys_fcntl(fd[i], F_GETLK, l));
+
+			if(expect[j].l_start != lock[i].l_start) {
+/*
+ * lock set by another process
+ */
+ATF_CHECK(l.l_type != F_UNLCK);
+ATF_CHECK_EQ(l.l_start, expect[j].l_start);
+ATF_CHECK_EQ(l.l_len,   expect[j].l_len);
+			} else if (j != __arraycount(lwp) - 1) {
+/*
+ * lock set by the current process
+ */
+ATF_CHECK(l.l_type != F_UNLCK);
+ATF_CHECK_EQ(l.l_start, expect[j+1].l_start);
+ATF_CHECK_EQ(l.l_len,   expect[j+1].l_len);
+			} else {
+/*
+ * there are no other locks after the
+ * current process lock
+ */
+ATF_CHECK_EQ(l.l_type,   F_UNLCK);
+ATF_CHECK_EQ(l.l_start,  expect[j].l_start);
+ATF_CHECK_EQ(l.l_len,sz);
+ATF_CHECK_EQ(l.l_pid,expect[j].l_pid);
+ATF_CHECK_EQ(l.l_whence, expect[j].l_whence);
+			}
+		}
+	}
+
+	/*
+	 * Release processes.  This also releases the fds and locks
+	 * making fs unmount possible
+	 */
+	for(i = 0; i  __arraycount(lwp); i++) {
+		rump_pub_lwproc_switch(lwp[i]);
+		rump_pub_lwproc_releaselwp();
+	}
+
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(lookup_simple, simple lookup (./.. on root));
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
@@ -579,6 +697,7 @@
 ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
 ATF_TC_FSAPPLY(fcntl_lock, check fcntl F_SETLK);
+ATF_TC_FSAPPLY(fcntl_getlock_pids,fcntl F_GETLK w/ many procs, PR kern/44494);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -595,6 +714,7 @@
 	ATF_TP_FSAPPLY(symlink_zerolen);
 	

CVS commit: src/tests/fs/vfs

2011-01-31 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Jan 31 18:53:29 UTC 2011

Modified Files:
src/tests/fs/vfs: t_ro.c

Log Message:
Now that PR/44302 is fixed, fs/vfs/t_ro:sysvbfs_rmfile should not fail
anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_ro.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/vfs/t_ro.c
diff -u src/tests/fs/vfs/t_ro.c:1.3 src/tests/fs/vfs/t_ro.c:1.4
--- src/tests/fs/vfs/t_ro.c:1.3	Fri Jan  7 11:39:27 2011
+++ src/tests/fs/vfs/t_ro.c	Mon Jan 31 18:53:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ro.c,v 1.3 2011/01/07 11:39:27 pooka Exp $	*/
+/*	$NetBSD: t_ro.c,v 1.4 2011/01/31 18:53:29 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -84,8 +84,6 @@
 {
 
 	FSTEST_ENTER();
-	if (FSTYPE_SYSVBFS(tc))
-		atf_tc_expect_fail(PR kern/44302);
 	ATF_REQUIRE_ERRNO(EROFS, rump_sys_unlink(AFILE) == -1);
 	FSTEST_EXIT();
 }



CVS commit: src/tests/fs/vfs

2011-01-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan 13 10:33:02 UTC 2011

Modified Files:
src/tests/fs/vfs: t_union.c

Log Message:
Add a test case for a r/o lower layer which attempts to create some
whiteouts and opaque dirs in the upper layer.  The sad news is this
simple test fails across the board.  It's pretty hard to figure
out how unionfs should work in $fs given that even the simplest
things don't work with ffs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_union.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/vfs/t_union.c
diff -u src/tests/fs/vfs/t_union.c:1.3 src/tests/fs/vfs/t_union.c:1.4
--- src/tests/fs/vfs/t_union.c:1.3	Wed Jan 12 22:42:24 2011
+++ src/tests/fs/vfs/t_union.c	Thu Jan 13 10:33:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_union.c,v 1.3 2011/01/12 22:42:24 pooka Exp $	*/
+/*	$NetBSD: t_union.c,v 1.4 2011/01/13 10:33:01 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -60,23 +60,18 @@
 	return EPROGMISMATCH;
 }
 
-#define TFILE tensti
+/*
+ * Mount a unionfs for testing.  Before calling, mp contains
+ * the upper layer.  Lowerpath is constructed so that the directory
+ * contains rumpfs.
+ */
 static void
-basic(const atf_tc_t *tc, const char *mp)
+mountunion(const char *mp, char *lowerpath)
 {
-	char lowerpath[MAXPATHLEN];
-	char dbuf[8192];
 	struct union_args unionargs;
-	struct stat sb;
-	struct dirent *dp;
-	int error, fd, dsize;
 
-	snprintf(lowerpath, sizeof(lowerpath), %s.lower, mp);
-
-	RL(rump_sys_mkdir(lowerpath, 0777));
-
-	/* create a file in the lower layer */
-	xput_tfile(lowerpath, TFILE);
+	sprintf(lowerpath, /lower);
+	rump_sys_mkdir(lowerpath, 0777);
 
 	/* mount the union with our testfs as the upper layer */
 	memset(unionargs, 0, sizeof(unionargs));
@@ -91,6 +86,38 @@
 			atf_tc_fail_errno(union mount);
 		}
 	}
+}
+
+#if 0
+static void
+toggleroot(void)
+{
+	static int status;
+
+	status ^= MNT_RDONLY;
+
+	printf(0x%x\n, status);
+	RL(rump_sys_mount(MOUNT_RUMPFS, /, status | MNT_UPDATE, NULL, 0));
+}
+#endif
+
+#define TFILE tensti
+#define TDIR testdir
+#define TDFILE TDIR /indir
+
+static void
+basic(const atf_tc_t *tc, const char *mp)
+{
+	char lowerpath[MAXPATHLEN];
+	char dbuf[8192];
+	struct stat sb;
+	struct dirent *dp;
+	int error, fd, dsize;
+
+	mountunion(mp, lowerpath);
+
+	/* create a file in the lower layer */
+	xput_tfile(lowerpath, TFILE);
 
 	/* first, test we can read the old file from the new namespace */
 	error = xread_tfile(mp, TFILE);
@@ -128,11 +155,52 @@
 	RL(rump_sys_unmount(mp, 0));
 }
 
+static void
+whiteout(const atf_tc_t *tc, const char *mp)
+{
+	char lower[MAXPATHLEN];
+	struct stat sb;
+	void *fsarg;
+
+	/*
+	 * XXX: use ffs here to make sure any screwups in rumpfs don't
+	 * affect the test
+	 */
+	RL(ffs_fstest_newfs(tc, fsarg, daimage, 1024*1024*5, NULL));
+	RL(ffs_fstest_mount(tc, fsarg, /lower, 0));
+
+	/* create a file in the lower layer */
+	RL(rump_sys_chdir(/lower));
+	RL(rump_sys_mkdir(TDIR, 0777));
+	RL(rump_sys_mkdir(TDFILE, 0777));
+	RL(rump_sys_chdir(/));
+
+	RL(ffs_fstest_unmount(tc, /lower, 0));
+	RL(ffs_fstest_mount(tc, fsarg, /lower, MNT_RDONLY));
+
+	mountunion(mp, lower);
+
+	FSTEST_ENTER();
+	RL(rump_sys_rmdir(TDIR));
+	ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TDFILE, sb) == -1);
+	ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TDIR, sb) == -1);
+
+	RL(rump_sys_mkdir(TDIR, 0777));
+	RL(rump_sys_stat(TDIR, sb));
+	ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TDFILE, sb) == -1);
+	FSTEST_EXIT();
+
+	RL(rump_sys_unmount(mp, 0));
+}
+
 ATF_TC_FSAPPLY(basic, check basic union functionality);
+ATF_TC_FSAPPLY(whiteout, create whiteout in upper layer);
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_FSAPPLY(basic);
+	ATF_TP_FSAPPLY(whiteout);
+
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-01-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan 13 11:00:20 UTC 2011

Modified Files:
src/tests/fs/vfs: t_union.c

Log Message:
xfail PR kern/44383: whiteouts are generally speaking kaput


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_union.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/vfs/t_union.c
diff -u src/tests/fs/vfs/t_union.c:1.4 src/tests/fs/vfs/t_union.c:1.5
--- src/tests/fs/vfs/t_union.c:1.4	Thu Jan 13 10:33:01 2011
+++ src/tests/fs/vfs/t_union.c	Thu Jan 13 11:00:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_union.c,v 1.4 2011/01/13 10:33:01 pooka Exp $	*/
+/*	$NetBSD: t_union.c,v 1.5 2011/01/13 11:00:19 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -180,6 +180,8 @@
 
 	mountunion(mp, lower);
 
+	/* all file systems fail sooner or later */
+	atf_tc_expect_fail(PR kern/44383);
 	FSTEST_ENTER();
 	RL(rump_sys_rmdir(TDIR));
 	ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TDFILE, sb) == -1);



CVS commit: src/tests/fs/vfs

2011-01-12 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan 12 21:45:39 UTC 2011

Modified Files:
src/tests/fs/vfs: t_union.c

Log Message:
Instead of hardcoding fs list just try to mount union and skip all
file systems which return EOPNOTSUPP.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_union.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/vfs/t_union.c
diff -u src/tests/fs/vfs/t_union.c:1.1 src/tests/fs/vfs/t_union.c:1.2
--- src/tests/fs/vfs/t_union.c:1.1	Wed Jan 12 21:13:27 2011
+++ src/tests/fs/vfs/t_union.c	Wed Jan 12 21:45:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_union.c,v 1.1 2011/01/12 21:13:27 pooka Exp $	*/
+/*	$NetBSD: t_union.c,v 1.2 2011/01/12 21:45:39 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -22,9 +22,6 @@
 
 #define MSTR magic bus
 
-#define HAS_WHITEOUT (FSTYPE_FFS(tc) || FSTYPE_FFSLOG(tc) ||	\
-FSTYPE_LFS(tc) || FSTYPE_RUMPFS(tc))
-
 static void
 xput_tfile(const char *mp, const char *path)
 {
@@ -74,10 +71,6 @@
 	struct dirent *dp;
 	int error, fd, dsize;
 
-	if (!HAS_WHITEOUT) {
-		atf_tc_skip(file system does not support VOP_WHITEOUT);
-	}
-
 	snprintf(lowerpath, sizeof(lowerpath), %s.lower, mp);
 
 	RL(rump_sys_mkdir(lowerpath, 0777));
@@ -91,8 +84,13 @@
 	unionargs.mntflags = UNMNT_BELOW;
 
 	if (rump_sys_mount(MOUNT_UNION, mp, 0,
-	unionargs, sizeof(unionargs)) == -1)
-		atf_tc_fail_errno(union mount);
+	unionargs, sizeof(unionargs)) == -1) {
+		if (errno == EOPNOTSUPP) {
+			atf_tc_skip(fs does not support VOP_WHITEOUT);
+		} else {
+			atf_tc_fail_errno(union mount);
+		}
+	}
 
 	/* first, test we can read the old file from the new namespace */
 	error = xread_tfile(mp, TFILE);



CVS commit: src/tests/fs/vfs

2011-01-12 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan 12 22:42:24 UTC 2011

Modified Files:
src/tests/fs/vfs: t_union.c

Log Message:
xfail for PR kern/44377


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_union.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/vfs/t_union.c
diff -u src/tests/fs/vfs/t_union.c:1.2 src/tests/fs/vfs/t_union.c:1.3
--- src/tests/fs/vfs/t_union.c:1.2	Wed Jan 12 21:45:39 2011
+++ src/tests/fs/vfs/t_union.c	Wed Jan 12 22:42:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_union.c,v 1.2 2011/01/12 21:45:39 pooka Exp $	*/
+/*	$NetBSD: t_union.c,v 1.3 2011/01/12 22:42:24 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -106,7 +106,11 @@
 	
 	/* check that we can whiteout stuff in the upper layer */
 	FSTEST_ENTER();
+	if (FSTYPE_FFSLOG(tc)) {
+		atf_tc_expect_signal(SIGABRT, PR kern/44377);
+	}
 	RL(rump_sys_unlink(TFILE));
+	atf_tc_expect_pass();
 	ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TFILE, sb) == -1);
 	FSTEST_EXIT();
 



CVS commit: src/tests/fs/vfs

2011-01-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 11 09:32:50 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
need unrace-catcher for ffslog


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.17 src/tests/fs/vfs/t_renamerace.c:1.18
--- src/tests/fs/vfs/t_renamerace.c:1.17	Fri Jan  7 12:18:25 2011
+++ src/tests/fs/vfs/t_renamerace.c	Tue Jan 11 09:32:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.17 2011/01/07 12:18:25 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.18 2011/01/11 09:32:50 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -133,6 +133,7 @@
 	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
+	/* XXX: unracy execution not caught */
 	if (FSTYPE_P2K_FFS(tc))
 		atf_tc_expect_fail(PR kern/44336); /* child dies */
 
@@ -155,7 +156,7 @@
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.
 	 */
 	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
-	FSTYPE_MSDOS(tc) || FSTYPE_P2K_FFS(tc))
+	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
 		abort();
 }
 



CVS commit: src/tests/fs/vfs

2011-01-11 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Tue Jan 11 14:03:39 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
add test for kern/43321, blessed by pooka@


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.11 src/tests/fs/vfs/t_vnops.c:1.12
--- src/tests/fs/vfs/t_vnops.c:1.11	Tue Jan  4 11:17:22 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Jan 11 14:03:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.11 2011/01/04 11:17:22 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.12 2011/01/11 14:03:38 kefren Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -523,6 +523,50 @@
 	FSTEST_EXIT();
 }
 
+static void
+fcntl_lock(const atf_tc_t *tc, const char *mp)
+{
+	int fd, fd2;
+	struct flock l;
+	struct lwp *lwp1, *lwp2;
+
+	FSTEST_ENTER();
+	l.l_pid = 0;
+	l.l_start = l.l_len = 1024;
+	l.l_type = F_RDLCK | F_WRLCK;
+	l.l_whence = SEEK_END;
+
+	lwp1 = rump_pub_lwproc_curlwp();
+	RL(fd = rump_sys_open(TESTFILE, O_RDWR | O_CREAT, 0755));
+	RL(rump_sys_ftruncate(fd, 8192));
+
+	/* PR kern/43321 */
+	RL(rump_sys_fcntl(fd, F_SETLK, l));
+
+	/* Next, we fork and try to lock the same area */
+	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
+	lwp2 = rump_pub_lwproc_curlwp();
+	RL(fd2 = rump_sys_open(TESTFILE, O_RDWR, 0));
+	ATF_REQUIRE_ERRNO(EAGAIN, rump_sys_fcntl(fd2, F_SETLK, l));
+
+	/* Switch back and unlock... */
+	rump_pub_lwproc_switch(lwp1);
+	l.l_type = F_UNLCK;
+	RL(rump_sys_fcntl(fd, F_SETLK, l));
+
+	/* ... and try to lock again */
+	rump_pub_lwproc_switch(lwp2);
+	l.l_type = F_RDLCK | F_WRLCK;
+	RL(rump_sys_fcntl(fd2, F_SETLK, l));
+
+	RL(rump_sys_close(fd2));
+	rump_pub_lwproc_releaselwp();
+
+	RL(rump_sys_close(fd));
+
+	FSTEST_EXIT();
+}
+
 ATF_TC_FSAPPLY(lookup_simple, simple lookup (./.. on root));
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
@@ -534,6 +578,7 @@
 ATF_TC_FSAPPLY(rename_nametoolong, rename to file with name too long);
 ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
 ATF_TC_FSAPPLY(attrs, check setting attributes works);
+ATF_TC_FSAPPLY(fcntl_lock, check fcntl F_SETLK);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -549,6 +594,7 @@
 	ATF_TP_FSAPPLY(rename_nametoolong);
 	ATF_TP_FSAPPLY(symlink_zerolen);
 	ATF_TP_FSAPPLY(attrs);
+	ATF_TP_FSAPPLY(fcntl_lock);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 11:39:28 UTC 2011

Modified Files:
src/tests/fs/vfs: t_ro.c

Log Message:
expect correct errno in nfsro case.  from yamt


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_ro.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/vfs/t_ro.c
diff -u src/tests/fs/vfs/t_ro.c:1.2 src/tests/fs/vfs/t_ro.c:1.3
--- src/tests/fs/vfs/t_ro.c:1.2	Fri Dec 31 18:26:25 2010
+++ src/tests/fs/vfs/t_ro.c	Fri Jan  7 11:39:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ro.c,v 1.2 2010/12/31 18:26:25 pooka Exp $	*/
+/*	$NetBSD: t_ro.c,v 1.3 2011/01/07 11:39:27 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -95,6 +95,12 @@
 {
 	int fd;
 	char buf[FUNSIZE+1];
+	int expected;
+
+	if (FSTYPE_NFSRO(tc))
+		expected = EACCES;
+	else
+		expected = EROFS;
 
 	FSTEST_ENTER();
 	RL(fd = rump_sys_open(AFILE, O_RDONLY));
@@ -103,8 +109,8 @@
 	ATF_REQUIRE_STREQ(buf, FUNTEXT);
 	RL(rump_sys_close(fd));
 
-	ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_WRONLY) == -1);
-	ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_RDWR) == -1);
+	ATF_REQUIRE_ERRNO(expected, rump_sys_open(AFILE, O_WRONLY) == -1);
+	ATF_REQUIRE_ERRNO(expected, rump_sys_open(AFILE, O_RDWR) == -1);
 	FSTEST_EXIT();
 }
 



CVS commit: src/tests/fs/vfs

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 11:41:55 UTC 2011

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
P2K_FFS uses puffs and therefore does not GOP_ALLOC either


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.4 src/tests/fs/vfs/t_full.c:1.5
--- src/tests/fs/vfs/t_full.c:1.4	Thu Nov 11 17:44:44 2010
+++ src/tests/fs/vfs/t_full.c	Fri Jan  7 11:41:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.4 2010/11/11 17:44:44 pooka Exp $	*/
+/*	$NetBSD: t_full.c,v 1.5 2011/01/07 11:41:54 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
 	size_t bonus;
 	int fd, i = 0;
 
-	if (FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
+	if (FSTYPE_P2K_FFS(tc) || FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
 		atf_tc_skip(fs does not support explicit block allocation 
 		(GOP_ALLOC));
 	}



CVS commit: src/tests/fs/vfs

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 11:53:23 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
ffs -o log dies in renamerace_dirs just like the rest.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.15 src/tests/fs/vfs/t_renamerace.c:1.16
--- src/tests/fs/vfs/t_renamerace.c:1.15	Sun Jan  2 12:58:17 2011
+++ src/tests/fs/vfs/t_renamerace.c	Fri Jan  7 11:53:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.15 2011/01/02 12:58:17 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.16 2011/01/07 11:53:23 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -130,7 +130,7 @@
 
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
-	FSTYPE_MSDOS(tc))
+	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));



CVS commit: src/tests/fs/vfs

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 12:01:11 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vfsops.c

Log Message:
use X-fs.mntname for f_fstypename.  ignore p2k_ffs there.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/vfs/t_vfsops.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/vfs/t_vfsops.c
diff -u src/tests/fs/vfs/t_vfsops.c:1.8 src/tests/fs/vfs/t_vfsops.c:1.9
--- src/tests/fs/vfs/t_vfsops.c:1.8	Fri Nov 19 17:46:02 2010
+++ src/tests/fs/vfs/t_vfsops.c	Fri Jan  7 12:01:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vfsops.c,v 1.8 2010/11/19 17:46:02 pooka Exp $	*/
+/*	$NetBSD: t_vfsops.c,v 1.9 2011/01/07 12:01:11 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -51,14 +51,14 @@
 static void
 tstatvfs(const atf_tc_t *tc, const char *path)
 {
-	const char *fstype = atf_tc_get_md_var(tc, X-fs.type);
+	const char *fstype = atf_tc_get_md_var(tc, X-fs.mntname);
 	struct statvfs svb;
 
 	if (rump_sys_statvfs1(path, svb, ST_WAIT) == -1)
 		atf_tc_fail_errno(statvfs);
 
 	ATF_REQUIRE(svb.f_namemax  0  svb.f_namemax = MAXNAMLEN);
-	if (!FSTYPE_PUFFS(tc))
+	if (!(FSTYPE_PUFFS(tc) || FSTYPE_P2K_FFS(tc)))
 		ATF_REQUIRE_STREQ(svb.f_fstypename, fstype);
 	ATF_REQUIRE_STREQ(svb.f_mntonname, path);
 }



CVS commit: src/tests/fs/vfs

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 12:18:25 UTC 2011

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
xfail PR kern/44336


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.16 src/tests/fs/vfs/t_renamerace.c:1.17
--- src/tests/fs/vfs/t_renamerace.c:1.16	Fri Jan  7 11:53:23 2011
+++ src/tests/fs/vfs/t_renamerace.c	Fri Jan  7 12:18:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.16 2011/01/07 11:53:23 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.17 2011/01/07 12:18:25 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -133,6 +133,9 @@
 	FSTYPE_MSDOS(tc) || FSTYPE_FFSLOG(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
+	if (FSTYPE_P2K_FFS(tc))
+		atf_tc_expect_fail(PR kern/44336); /* child dies */
+
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());
 
@@ -152,7 +155,7 @@
 	 * (i.e. not on tmpfs/mfs).  So do the usual kludge.
 	 */
 	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
-	FSTYPE_MSDOS(tc))
+	FSTYPE_MSDOS(tc) || FSTYPE_P2K_FFS(tc))
 		abort();
 }
 



CVS commit: src/tests/fs/vfs

2011-01-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan  3 09:35:33 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Give this a chance of working on non-4kB pagesize.
from martin's sparc64 test run


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.5 src/tests/fs/vfs/t_io.c:1.6
--- src/tests/fs/vfs/t_io.c:1.5	Sat Jan  1 20:43:01 2011
+++ src/tests/fs/vfs/t_io.c	Mon Jan  3 09:35:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.5 2011/01/01 20:43:01 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.6 2011/01/03 09:35:33 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 	RL(rump_sys_pwrite(fd, buf, 1, getpagesize()));
 
 	memset(buf, 'B', sizeof(buf));
-	RL(rump_sys_pwrite(fd, buf, 2, 0xfff));
+	RL(rump_sys_pwrite(fd, buf, 2, getpagesize()-1));
 
 	REQUIRE_LIBC(b2 = malloc(2 * getpagesize()), NULL);
 	REQUIRE_LIBC(b3 = malloc(2 * getpagesize()), NULL);



CVS commit: src/tests/fs/vfs

2011-01-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Jan  1 20:26:22 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Check that extending a file grows its size (with and without O_APPEND).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.2 src/tests/fs/vfs/t_io.c:1.3
--- src/tests/fs/vfs/t_io.c:1.2	Thu Nov 11 16:03:55 2010
+++ src/tests/fs/vfs/t_io.c	Sat Jan  1 20:26:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.2 2010/11/11 16:03:55 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.3 2011/01/01 20:26:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -41,6 +41,9 @@
 #include ../common/h_fsmacros.h
 #include ../../h_macros.h
 
+#define TESTSTR this is a string.  collect enough and you'll have Em
+#define TESTSZ sizeof(TESTSTR)
+
 static void
 holywrite(const atf_tc_t *tc, const char *mp)
 {
@@ -49,7 +52,7 @@
 	size_t therange = getpagesize()+1;
 	int fd;
 
-	RL(rump_sys_chdir(mp));
+	FSTEST_ENTER();
 
 	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT|O_TRUNC, 0666));
 
@@ -70,15 +73,61 @@
 	ATF_REQUIRE_EQ(memcmp(b2, b3, therange), 0);
 
 	rump_sys_close(fd);
-	rump_sys_chdir(/);
+	FSTEST_EXIT();
+}
+
+static void
+extendbody(const atf_tc_t *tc, off_t seekcnt)
+{
+	char buf[TESTSZ+1];
+	struct stat sb;
+	int fd;
+
+	FSTEST_ENTER();
+	RL(fd = rump_sys_open(testfile,
+	O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)));
+	RL(rump_sys_ftruncate(fd, seekcnt));
+	RL(rump_sys_fstat(fd, sb));
+	if (FSTYPE_SYSVBFS(tc)  seekcnt)
+		atf_tc_expect_fail(fail);
+	ATF_REQUIRE_EQ(sb.st_size, seekcnt);
+	atf_tc_expect_pass();
+
+	ATF_REQUIRE_EQ(rump_sys_write(fd, TESTSTR, TESTSZ), TESTSZ);
+	ATF_REQUIRE_EQ(rump_sys_pread(fd, buf, TESTSZ, seekcnt), TESTSZ);
+	ATF_REQUIRE_STREQ(buf, TESTSTR);
+
+	RL(rump_sys_fstat(fd, sb));
+	ATF_REQUIRE_EQ(sb.st_size, TESTSZ + seekcnt);
+	RL(rump_sys_close(fd));
+	FSTEST_EXIT();
+}
+
+static void
+extendfile(const atf_tc_t *tc, const char *mp)
+{
+
+	extendbody(tc, 0);
+}
+
+static void
+extendfile_append(const atf_tc_t *tc, const char *mp)
+{
+
+	extendbody(tc, 37);
 }
 
 ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
+ATF_TC_FSAPPLY(extendfile, check that extending a file works);
+ATF_TC_FSAPPLY(extendfile_append, check that extending a file works 
+  with a append-only fd);
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_FSAPPLY(holywrite);
+	ATF_TP_FSAPPLY(extendfile);
+	ATF_TP_FSAPPLY(extendfile_append);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2011-01-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Jan  1 20:30:57 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
fill in number of PR kern/44307


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.3 src/tests/fs/vfs/t_io.c:1.4
--- src/tests/fs/vfs/t_io.c:1.3	Sat Jan  1 20:26:22 2011
+++ src/tests/fs/vfs/t_io.c	Sat Jan  1 20:30:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.3 2011/01/01 20:26:22 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.4 2011/01/01 20:30:56 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -89,7 +89,7 @@
 	RL(rump_sys_ftruncate(fd, seekcnt));
 	RL(rump_sys_fstat(fd, sb));
 	if (FSTYPE_SYSVBFS(tc)  seekcnt)
-		atf_tc_expect_fail(fail);
+		atf_tc_expect_fail(PR kern/44307);
 	ATF_REQUIRE_EQ(sb.st_size, seekcnt);
 	atf_tc_expect_pass();
 



CVS commit: src/tests/fs/vfs

2011-01-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Jan  1 20:43:01 UTC 2011

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
Guess-fix a signed vs. unsigned compiler warning report by pgoyette
(it doesn't trigger in my src working copy for whatever reason).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.4 src/tests/fs/vfs/t_io.c:1.5
--- src/tests/fs/vfs/t_io.c:1.4	Sat Jan  1 20:30:56 2011
+++ src/tests/fs/vfs/t_io.c	Sat Jan  1 20:43:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.4 2011/01/01 20:30:56 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.5 2011/01/01 20:43:01 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@
 	ATF_REQUIRE_STREQ(buf, TESTSTR);
 
 	RL(rump_sys_fstat(fd, sb));
-	ATF_REQUIRE_EQ(sb.st_size, TESTSZ + seekcnt);
+	ATF_REQUIRE_EQ(sb.st_size, (off_t)TESTSZ + seekcnt);
 	RL(rump_sys_close(fd));
 	FSTEST_EXIT();
 }



CVS commit: src/tests/fs/vfs

2010-12-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Dec 31 18:26:25 UTC 2010

Modified Files:
src/tests/fs/vfs: t_ro.c

Log Message:
fill in PR kern/44302


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_ro.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/vfs/t_ro.c
diff -u src/tests/fs/vfs/t_ro.c:1.1 src/tests/fs/vfs/t_ro.c:1.2
--- src/tests/fs/vfs/t_ro.c:1.1	Fri Dec 31 18:20:32 2010
+++ src/tests/fs/vfs/t_ro.c	Fri Dec 31 18:26:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ro.c,v 1.1 2010/12/31 18:20:32 pooka Exp $	*/
+/*	$NetBSD: t_ro.c,v 1.2 2010/12/31 18:26:25 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
 
 	FSTEST_ENTER();
 	if (FSTYPE_SYSVBFS(tc))
-		atf_tc_expect_fail(sysbvfs unlink (PR MISSING));
+		atf_tc_expect_fail(PR kern/44302);
 	ATF_REQUIRE_ERRNO(EROFS, rump_sys_unlink(AFILE) == -1);
 	FSTEST_EXIT();
 }



CVS commit: src/tests/fs/vfs

2010-11-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Nov 19 17:46:02 UTC 2010

Modified Files:
src/tests/fs/vfs: t_vfsops.c

Log Message:
Convert skipped tests into proper xfails (a lazy bum is me).

prompted by pgoyette


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_vfsops.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/vfs/t_vfsops.c
diff -u src/tests/fs/vfs/t_vfsops.c:1.7 src/tests/fs/vfs/t_vfsops.c:1.8
--- src/tests/fs/vfs/t_vfsops.c:1.7	Mon Aug 16 10:47:16 2010
+++ src/tests/fs/vfs/t_vfsops.c	Fri Nov 19 17:46:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vfsops.c,v 1.7 2010/08/16 10:47:16 pooka Exp $	*/
+/*	$NetBSD: t_vfsops.c,v 1.8 2010/11/19 17:46:02 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -134,10 +134,6 @@
 	void *fhp;
 	int fd;
 
-	/* should repeat above, but ... */
-	if (FSTYPE_TMPFS(tc))
-		atf_tc_skip(file handles broken (PR kern/43605));
-
 	RL(rump_sys_chdir(path));
 	RL(fd = rump_sys_open(FNAME, O_RDWR | O_CREAT, 0777));
 	RL(rump_sys_close(fd));
@@ -158,6 +154,8 @@
 	if (FSTYPE_MSDOS(tc) || FSTYPE_LFS(tc))
 		atf_tc_expect_fail(fhopen() for removed file succeeds 
 		(PR kern/43745));
+	if (FSTYPE_TMPFS(tc))
+		atf_tc_expect_fail(PR kern/43605);
 	ATF_REQUIRE_ERRNO(ESTALE, rump_sys_fhopen(fhp, fhsize, O_RDONLY) == -1);
 	atf_tc_expect_pass();
 
@@ -177,8 +175,7 @@
 	unsigned long seed;
 	int fd;
 
-	if (FSTYPE_TMPFS(tc))
-		atf_tc_skip(file handles broken (PR kern/43605));
+	/* XXX: this test succeeds accidentally on tmpfs, PR kern/43605 */
 
 	srandom(seed = time(NULL));
 	printf(RNG seed %lu\n, seed);



CVS commit: src/tests/fs/vfs

2010-11-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov 11 16:03:55 UTC 2010

Modified Files:
src/tests/fs/vfs: t_io.c

Log Message:
use atf interfaces for error reportage


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_io.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/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.1 src/tests/fs/vfs/t_io.c:1.2
--- src/tests/fs/vfs/t_io.c:1.1	Thu Aug 19 02:36:02 2010
+++ src/tests/fs/vfs/t_io.c	Thu Nov 11 16:03:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.1 2010/08/19 02:36:02 pooka Exp $	*/
+/*	$NetBSD: t_io.c,v 1.2 2010/11/11 16:03:55 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -67,8 +67,7 @@
 	memset(b3, 0, therange);
 	memset(b3 + getpagesize() - 1, 'B', 2);
 
-	if (memcmp(b2, b3, therange) != 0)
-		abort();
+	ATF_REQUIRE_EQ(memcmp(b2, b3, therange), 0);
 
 	rump_sys_close(fd);
 	rump_sys_chdir(/);



CVS commit: src/tests/fs/vfs

2010-11-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov 11 17:44:44 UTC 2010

Modified Files:
src/tests/fs/vfs: t_full.c t_renamerace.c t_vnops.c

Log Message:
skip tests which use features which rumpfs does not support
(namely: vop_rename and a file system size limit)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_full.c
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/vfs/t_renamerace.c
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/t_vnops.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.3 src/tests/fs/vfs/t_full.c:1.4
--- src/tests/fs/vfs/t_full.c:1.3	Sat Aug 28 10:56:11 2010
+++ src/tests/fs/vfs/t_full.c	Thu Nov 11 17:44:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.3 2010/08/28 10:56:11 wiz Exp $	*/
+/*	$NetBSD: t_full.c,v 1.4 2010/11/11 17:44:44 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,8 +56,9 @@
 	size_t bonus;
 	int fd, i = 0;
 
-	if (FSTYPE_PUFFS(tc)) {
-		atf_tc_skip(puffs does not support explicit block allocation (GOP_ALLOC));
+	if (FSTYPE_PUFFS(tc) || FSTYPE_RUMPFS(tc)) {
+		atf_tc_skip(fs does not support explicit block allocation 
+		(GOP_ALLOC));
 	}
 
 	bonus = 0;

Index: src/tests/fs/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.13 src/tests/fs/vfs/t_renamerace.c:1.14
--- src/tests/fs/vfs/t_renamerace.c:1.13	Mon Nov  1 14:04:02 2010
+++ src/tests/fs/vfs/t_renamerace.c	Thu Nov 11 17:44:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.13 2010/11/01 14:04:02 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.14 2010/11/11 17:44:44 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -87,6 +87,9 @@
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	RZ(rump_pub_lwproc_newproc());
 	RL(wrkpid = rump_sys_getpid());
 
@@ -122,6 +125,9 @@
 	if (FSTYPE_SYSVBFS(tc))
 		atf_tc_skip(directories not supported);
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	/* XXX: msdosfs also sometimes hangs */
 	if (FSTYPE_FFS(tc) || FSTYPE_EXT2FS(tc) || FSTYPE_LFS(tc) ||
 	FSTYPE_MSDOS(tc))

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.9 src/tests/fs/vfs/t_vnops.c:1.10
--- src/tests/fs/vfs/t_vnops.c:1.9	Thu Sep  9 11:42:52 2010
+++ src/tests/fs/vfs/t_vnops.c	Thu Nov 11 17:44:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.9 2010/09/09 11:42:52 njoly Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.10 2010/11/11 17:44:44 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -171,6 +171,9 @@
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	USES_DIRS;
 
 	md(pb1, mp, dir1);
@@ -251,6 +254,9 @@
 rename_dotdot(const atf_tc_t *tc, const char *mp)
 {
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	USES_DIRS;
 
 	if (rump_sys_chdir(mp) == -1)
@@ -284,6 +290,9 @@
 	struct stat sb;
 	ino_t f1ino, f2ino;
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
@@ -403,6 +412,9 @@
 	long val;
 	size_t len;
 
+	if (FSTYPE_RUMPFS(tc))
+		atf_tc_skip(rename not supported by fs);
+
 	if (rump_sys_chdir(mp) == -1)
 		atf_tc_fail_errno(chdir mountpoint);
 



CVS commit: src/tests/fs/vfs

2010-11-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Nov  1 14:04:02 UTC 2010

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Create the process we use later in the test.  Otherwise cwd doesn't
go right and the test fails because of attempting to create files
in the wrong directory.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.12 src/tests/fs/vfs/t_renamerace.c:1.13
--- src/tests/fs/vfs/t_renamerace.c:1.12	Wed Sep  1 19:41:28 2010
+++ src/tests/fs/vfs/t_renamerace.c	Mon Nov  1 14:04:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.12 2010/09/01 19:41:28 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.13 2010/11/01 14:04:02 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -87,6 +87,9 @@
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
+	RZ(rump_pub_lwproc_newproc());
+	RL(wrkpid = rump_sys_getpid());
+
 	RL(rump_sys_chdir(mp));
 	for (i = 0; i  NWRK; i++)
 		pthread_create(pt1[i], NULL, w1, NULL);



CVS commit: src/tests/fs/vfs

2010-09-09 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Sep  9 11:42:52 UTC 2010

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
s/dirs/symlinks/ in USES_SYMLINKS message.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.8 src/tests/fs/vfs/t_vnops.c:1.9
--- src/tests/fs/vfs/t_vnops.c:1.8	Mon Sep  6 15:27:18 2010
+++ src/tests/fs/vfs/t_vnops.c	Thu Sep  9 11:42:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.8 2010/09/06 15:27:18 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.9 2010/09/09 11:42:52 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 
 #define USES_SYMLINKS	\
 if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc))		\
-	atf_tc_skip(dirs not supported by file system)
+	atf_tc_skip(symlinks not supported by file system)
 
 static char *
 md(char *buf, const char *base, const char *tail)



CVS commit: src/tests/fs/vfs

2010-09-06 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  6 15:21:34 UTC 2010

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
symlink to a zero-len target (and watch tmpfs go kabloom)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.6 src/tests/fs/vfs/t_vnops.c:1.7
--- src/tests/fs/vfs/t_vnops.c:1.6	Sun Aug  1 14:50:54 2010
+++ src/tests/fs/vfs/t_vnops.c	Mon Sep  6 15:21:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.6 2010/08/01 14:50:54 mlelstv Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.7 2010/09/06 15:21:34 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -44,6 +44,10 @@
 #define USES_DIRS \
 if (FSTYPE_SYSVBFS(tc)) atf_tc_skip(dirs not supported by file system)
 
+#define USES_SYMLINKS	\
+if (FSTYPE_SYSVBFS(tc) || FSTYPE_MSDOS(tc))		\
+	atf_tc_skip(dirs not supported by file system)
+
 static char *
 md(char *buf, const char *base, const char *tail)
 {
@@ -438,6 +442,17 @@
 	rump_sys_chdir(/);
 }
 
+static void
+symlink_zerolen(const atf_tc_t *tc, const char *mp)
+{
+
+	USES_SYMLINKS;
+
+	RL(rump_sys_chdir(mp));
+	RL(rump_sys_symlink(, afile));
+	RL(rump_sys_chdir(/));
+}
+
 ATF_TC_FSAPPLY(lookup_simple, simple lookup (./.. on root));
 ATF_TC_FSAPPLY(lookup_complex, lookup of non-dot entries);
 ATF_TC_FSAPPLY(dir_simple, mkdir/rmdir);
@@ -447,6 +462,7 @@
 ATF_TC_FSAPPLY(rename_reg_nodir, rename regular files, no subdirectories);
 ATF_TC_FSAPPLY(create_nametoolong, create file with name too long);
 ATF_TC_FSAPPLY(rename_nametoolong, rename to file with name too long);
+ATF_TC_FSAPPLY(symlink_zerolen, symlink with 0-len target);
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -460,6 +476,7 @@
 	ATF_TP_FSAPPLY(rename_reg_nodir);
 	ATF_TP_FSAPPLY(create_nametoolong);
 	ATF_TP_FSAPPLY(rename_nametoolong);
+	ATF_TP_FSAPPLY(symlink_zerolen);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/vfs

2010-09-06 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  6 15:27:18 UTC 2010

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
fill in PR number: kern/43843


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.7 src/tests/fs/vfs/t_vnops.c:1.8
--- src/tests/fs/vfs/t_vnops.c:1.7	Mon Sep  6 15:21:34 2010
+++ src/tests/fs/vfs/t_vnops.c	Mon Sep  6 15:27:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.7 2010/09/06 15:21:34 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.8 2010/09/06 15:27:18 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -449,6 +449,11 @@
 	USES_SYMLINKS;
 
 	RL(rump_sys_chdir(mp));
+
+	if (FSTYPE_TMPFS(tc)) {
+		atf_tc_expect_signal(SIGABRT, PR kern/43843);
+	}
+
 	RL(rump_sys_symlink(, afile));
 	RL(rump_sys_chdir(/));
 }



CVS commit: src/tests/fs/vfs

2010-08-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 28 10:56:12 UTC 2010

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
Use explanation for GOP_ALLOC in message from version 1.1.
Ok po...@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.2 src/tests/fs/vfs/t_full.c:1.3
--- src/tests/fs/vfs/t_full.c:1.2	Fri Aug 27 08:15:30 2010
+++ src/tests/fs/vfs/t_full.c	Sat Aug 28 10:56:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.2 2010/08/27 08:15:30 pooka Exp $	*/
+/*	$NetBSD: t_full.c,v 1.3 2010/08/28 10:56:11 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 	int fd, i = 0;
 
 	if (FSTYPE_PUFFS(tc)) {
-		atf_tc_skip(puffs does not support GOP_ALLOC);
+		atf_tc_skip(puffs does not support explicit block allocation (GOP_ALLOC));
 	}
 
 	bonus = 0;



CVS commit: src/tests/fs/vfs

2010-08-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Aug 27 08:15:30 UTC 2010

Modified Files:
src/tests/fs/vfs: t_full.c

Log Message:
Skip the full test for puffs now that we can (yes, atf issue #53)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_full.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/vfs/t_full.c
diff -u src/tests/fs/vfs/t_full.c:1.1 src/tests/fs/vfs/t_full.c:1.2
--- src/tests/fs/vfs/t_full.c:1.1	Tue Aug 17 11:46:16 2010
+++ src/tests/fs/vfs/t_full.c	Fri Aug 27 08:15:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_full.c,v 1.1 2010/08/17 11:46:16 pooka Exp $	*/
+/*	$NetBSD: t_full.c,v 1.2 2010/08/27 08:15:30 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -57,10 +57,7 @@
 	int fd, i = 0;
 
 	if (FSTYPE_PUFFS(tc)) {
-		/* XXX: I would *LIKE* to skip this, but atf won't let me */
-		return;
-
-		atf_tc_skip(puffs does not support explicit block allocation);
+		atf_tc_skip(puffs does not support GOP_ALLOC);
 	}
 
 	bonus = 0;



CVS commit: src/tests/fs/vfs

2010-08-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 26 18:06:44 UTC 2010

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
chdir() once per process is enough, no need to do it for every
thread (and doing so would cause occasional failures when some
thread would cd out of the test mountpoint while another thread
was still running in there).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.10 src/tests/fs/vfs/t_renamerace.c:1.11
--- src/tests/fs/vfs/t_renamerace.c:1.10	Thu Aug 26 15:07:16 2010
+++ src/tests/fs/vfs/t_renamerace.c	Thu Aug 26 18:06:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.10 2010/08/26 15:07:16 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.11 2010/08/26 18:06:44 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -32,7 +32,6 @@
 	int fd;
 
 	rump_pub_lwp_alloc_and_switch(0, 10);
-	rump_sys_chdir(arg);
 
 	while (!quittingtime) {
 		fd = rump_sys_open(rename.test1,
@@ -43,8 +42,6 @@
 		rump_sys_close(fd);
 	}
 
-	rump_sys_chdir(/);
-
 	return NULL;
 }
 
@@ -53,7 +50,6 @@
 {
 
 	rump_pub_lwp_alloc_and_switch(0, 10);
-	rump_sys_chdir(arg);
 
 	while (!quittingtime) {
 		if (rump_sys_mkdir(rename.test1, 0777) == -1)
@@ -61,8 +57,6 @@
 		rump_sys_rmdir(rename.test1);
 	}
 
-	rump_sys_chdir(/);
-
 	return NULL;
 }
 
@@ -71,14 +65,11 @@
 {
 
 	rump_pub_lwp_alloc_and_switch(0, 11);
-	rump_sys_chdir(arg);
 
 	while (!quittingtime) {
 		rump_sys_rename(rename.test1, rename.test2);
 	}
 
-	rump_sys_chdir(/);
-
 	return NULL;
 }
 
@@ -95,11 +86,12 @@
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
+	RL(rump_sys_chdir(mp));
 	for (i = 0; i  NWRK; i++)
-		pthread_create(pt1[i], NULL, w1, __UNCONST(mp));
+		pthread_create(pt1[i], NULL, w1, NULL);
 
 	for (i = 0; i  NWRK; i++)
-		pthread_create(pt2[i], NULL, w2, __UNCONST(mp));
+		pthread_create(pt2[i], NULL, w2, NULL);
 
 	sleep(5);
 	quittingtime = 1;
@@ -108,6 +100,7 @@
 		pthread_join(pt1[i], NULL);
 	for (i = 0; i  NWRK; i++)
 		pthread_join(pt2[i], NULL);
+	RL(rump_sys_chdir(/));
 
 	/*
 	 * XXX: does not always fail on LFS, especially for unicpu
@@ -130,14 +123,16 @@
 	FSTYPE_MSDOS(tc))
 		atf_tc_expect_signal(-1, PR kern/43626);
 
-	pthread_create(pt1, NULL, w1_dirs, __UNCONST(mp));
-	pthread_create(pt2, NULL, w2, __UNCONST(mp));
+	RL(rump_sys_chdir(mp));
+	pthread_create(pt1, NULL, w1_dirs, NULL);
+	pthread_create(pt2, NULL, w2, NULL);
 
 	sleep(5);
 	quittingtime = 1;
 
 	pthread_join(pt1, NULL);
 	pthread_join(pt2, NULL);
+	RL(rump_sys_chdir(/));
 
 	/*
 	 * Doesn't always trigger when run on a slow backend



CVS commit: src/tests/fs/vfs

2010-08-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 25 18:11:20 UTC 2010

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
Start many more threads for the renamerace since it seems to catch
more errors.

Add a sleepkludge to deal with NFS's sillyrename brokenness.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/vfs/t_renamerace.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/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.8 src/tests/fs/vfs/t_renamerace.c:1.9
--- src/tests/fs/vfs/t_renamerace.c:1.8	Fri Jul 16 19:16:41 2010
+++ src/tests/fs/vfs/t_renamerace.c	Wed Aug 25 18:11:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.8 2010/07/16 19:16:41 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.9 2010/08/25 18:11:20 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -37,7 +37,7 @@
 	while (!quittingtime) {
 		fd = rump_sys_open(rename.test1,
 		O_WRONLY|O_CREAT|O_TRUNC, 0666);
-		if (fd == -1)
+		if (fd == -1  errno != EEXIST)
 			atf_tc_fail_errno(create);
 		rump_sys_unlink(rename.test1);
 		rump_sys_close(fd);
@@ -82,10 +82,12 @@
 	return NULL;
 }
 
+#define NWRK 8
 static void
 renamerace(const atf_tc_t *tc, const char *mp)
 {
-	pthread_t pt1, pt2;
+	pthread_t pt1[NWRK], pt2[NWRK];
+	int i;
 
 	if (FSTYPE_LFS(tc))
 		atf_tc_expect_signal(-1, PR kern/43582);
@@ -93,14 +95,19 @@
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip(test fails in some setups, reason unknown);
 
-	pthread_create(pt1, NULL, w1, __UNCONST(mp));
-	pthread_create(pt2, NULL, w2, __UNCONST(mp));
+	for (i = 0; i  NWRK; i++)
+		pthread_create(pt1[i], NULL, w1, __UNCONST(mp));
+
+	for (i = 0; i  NWRK; i++)
+		pthread_create(pt2[i], NULL, w2, __UNCONST(mp));
 
 	sleep(5);
 	quittingtime = 1;
 
-	pthread_join(pt1, NULL);
-	pthread_join(pt2, NULL);
+	for (i = 0; i  NWRK; i++)
+		pthread_join(pt1[i], NULL);
+	for (i = 0; i  NWRK; i++)
+		pthread_join(pt2[i], NULL);
 
 	/*
 	 * XXX: does not always fail on LFS, especially for unicpu
@@ -108,6 +115,14 @@
 	 */
 	if (FSTYPE_LFS(tc))
 		abort();
+
+	/*
+	 * NFS sillyrename is broken and may linger on in the file system.
+	 * This sleep lets them finish so we don't get transient unmount
+	 * failures.
+	 */
+	if (FSTYPE_NFS(tc))
+		sleep(1);
 }
 
 static void



CVS commit: src/tests/fs/vfs

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 19 02:36:03 UTC 2010

Modified Files:
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/vfs: t_io.c

Log Message:
Start adding some I/O tests.  This one does a sparse write to the
second page on a file, then writes the first, and finally checks
it can read something expected.  Adapted the from program supplied
by yamt in PR kern/36429.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_io.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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.10 src/tests/fs/vfs/Makefile:1.11
--- src/tests/fs/vfs/Makefile:1.10	Tue Aug 17 11:46:16 2010
+++ src/tests/fs/vfs/Makefile	Thu Aug 19 02:36:02 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2010/08/17 11:46:16 pooka Exp $
+#	$NetBSD: Makefile,v 1.11 2010/08/19 02:36:02 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -7,6 +7,7 @@
 WARNS=		4
 
 TESTS_C+=	t_full
+TESTS_C+=	t_io
 TESTS_C+=	t_renamerace
 TESTS_C+=	t_rmdirrace
 TESTS_C+=	t_vfsops

Added files:

Index: src/tests/fs/vfs/t_io.c
diff -u /dev/null src/tests/fs/vfs/t_io.c:1.1
--- /dev/null	Thu Aug 19 02:36:03 2010
+++ src/tests/fs/vfs/t_io.c	Thu Aug 19 02:36:02 2010
@@ -0,0 +1,85 @@
+/*	$NetBSD: t_io.c,v 1.1 2010/08/19 02:36:02 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 sys/statvfs.h
+
+#include atf-c.h
+#include fcntl.h
+#include libgen.h
+#include stdlib.h
+#include unistd.h
+
+#include rump/rump_syscalls.h
+#include rump/rump.h
+
+#include ../common/h_fsmacros.h
+#include ../../h_macros.h
+
+static void
+holywrite(const atf_tc_t *tc, const char *mp)
+{
+	char buf[1024];
+	char *b2, *b3;
+	size_t therange = getpagesize()+1;
+	int fd;
+
+	RL(rump_sys_chdir(mp));
+
+	RL(fd = rump_sys_open(file, O_RDWR|O_CREAT|O_TRUNC, 0666));
+
+	memset(buf, 'A', sizeof(buf));
+	RL(rump_sys_pwrite(fd, buf, 1, getpagesize()));
+
+	memset(buf, 'B', sizeof(buf));
+	RL(rump_sys_pwrite(fd, buf, 2, 0xfff));
+
+	REQUIRE_LIBC(b2 = malloc(2 * getpagesize()), NULL);
+	REQUIRE_LIBC(b3 = malloc(2 * getpagesize()), NULL);
+
+	RL(rump_sys_pread(fd, b2, therange, 0));
+
+	memset(b3, 0, therange);
+	memset(b3 + getpagesize() - 1, 'B', 2);
+
+	if (memcmp(b2, b3, therange) != 0)
+		abort();
+
+	rump_sys_close(fd);
+	rump_sys_chdir(/);
+}
+
+ATF_TC_FSAPPLY(holywrite, create a sparse file and fill hole);
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_FSAPPLY(holywrite);
+
+	return atf_no_error();
+}



CVS commit: src/tests/fs/vfs

2010-08-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Aug 17 11:46:16 UTC 2010

Modified Files:
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/vfs: t_full.c

Log Message:
Add test which fills up the file system and expects ENOSPC.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_full.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/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.9 src/tests/fs/vfs/Makefile:1.10
--- src/tests/fs/vfs/Makefile:1.9	Mon Jul 26 16:25:19 2010
+++ src/tests/fs/vfs/Makefile	Tue Aug 17 11:46:16 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2010/07/26 16:25:19 pooka Exp $
+#	$NetBSD: Makefile,v 1.10 2010/08/17 11:46:16 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -6,6 +6,7 @@
 TESTSDIR=	${TESTSBASE}/fs/vfs
 WARNS=		4
 
+TESTS_C+=	t_full
 TESTS_C+=	t_renamerace
 TESTS_C+=	t_rmdirrace
 TESTS_C+=	t_vfsops

Added files:

Index: src/tests/fs/vfs/t_full.c
diff -u /dev/null src/tests/fs/vfs/t_full.c:1.1
--- /dev/null	Tue Aug 17 11:46:16 2010
+++ src/tests/fs/vfs/t_full.c	Tue Aug 17 11:46:16 2010
@@ -0,0 +1,101 @@
+/*	$NetBSD: t_full.c,v 1.1 2010/08/17 11:46:16 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 sys/statvfs.h
+
+#include atf-c.h
+#include fcntl.h
+#include libgen.h
+#include stdlib.h
+#include unistd.h
+
+#include rump/rump_syscalls.h
+#include rump/rump.h
+
+#include ../common/h_fsmacros.h
+#include ../../h_macros.h
+
+/*
+ * Write this much over the image size.  This is to force an NFS commit,
+ * since we might just stuff data into the cache and miss the problem.
+ */
+#define NFSBONUS (116)
+
+static void
+fillfs(const atf_tc_t *tc, const char *mp)
+{
+	char buf[8192];
+	size_t written;
+	ssize_t n = 0; /* xxxgcc */
+	size_t bonus;
+	int fd, i = 0;
+
+	if (FSTYPE_PUFFS(tc)) {
+		/* XXX: I would *LIKE* to skip this, but atf won't let me */
+		return;
+
+		atf_tc_skip(puffs does not support explicit block allocation);
+	}
+
+	bonus = 0;
+	if (FSTYPE_NFS(tc))
+		bonus = NFSBONUS;
+
+	if (rump_sys_chdir(mp) == -1)
+		atf_tc_fail_errno(chdir mountpoint);
+	fd = rump_sys_open(afile, O_CREAT | O_RDWR);
+	if (fd == -1)
+		atf_tc_fail_errno(create file);
+
+	for (written = 0; written  FSTEST_IMGSIZE + bonus; written +=n) {
+		memset(buf, i++, sizeof(buf)); /* known garbage */
+		n = rump_sys_write(fd, buf, sizeof(buf));
+		if (n == -1)
+			break;
+	}
+	if (n == -1) {
+		if (errno != ENOSPC)
+			atf_tc_fail_errno(write);
+	} else {
+		atf_tc_fail(filled file system over size limit);
+	}
+
+	rump_sys_close(fd);
+	rump_sys_chdir(/);
+}
+
+ATF_TC_FSAPPLY(fillfs, fills file system, expects ENOSPC);
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_FSAPPLY(fillfs);
+
+	return atf_no_error();
+}



  1   2   >