CVS commit: src/tests/fs/vfs

2023-05-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  8 19:23:45 UTC 2023

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

Log Message:
fix the grammar in comments reported by Jim Spath in misc/57397.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.62 src/tests/fs/vfs/t_vnops.c:1.63
--- src/tests/fs/vfs/t_vnops.c:1.62	Tue Feb  1 18:27:24 2022
+++ src/tests/fs/vfs/t_vnops.c	Mon May  8 19:23:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.62 2022/02/01 18:27:24 martin Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.63 2023/05/08 19:23:45 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -104,9 +104,9 @@ lookup_complex(const atf_tc_t *tc, const
 	 * 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
+	 * the 2nd lookup atime to 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
+	 * both references may happen within the same 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).
@@ -167,7 +167,7 @@ dir_simple(const atf_tc_t *tc, const cha
 	if (rump_sys_stat(pb, ) == -1)
 		atf_tc_fail_errno("stat new directory");
 
-	/* check we can remove then and that it makes them unreachable */
+	/* check we can remove them and that it makes them unreachable */
 	if (rump_sys_rmdir(pb) == -1)
 		atf_tc_fail_errno("rmdir");
 	if (rump_sys_stat(pb, ) != -1 || errno != ENOENT)



CVS commit: src/tests/fs/vfs

2023-05-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  8 19:23:45 UTC 2023

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

Log Message:
fix the grammar in comments reported by Jim Spath in misc/57397.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 16:35:28 UTC 2022

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

Log Message:
remove zfs from the exception list; it now works like the other fs's.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_link.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_link.c
diff -u src/tests/fs/vfs/t_link.c:1.4 src/tests/fs/vfs/t_link.c:1.5
--- src/tests/fs/vfs/t_link.c:1.4	Wed Mar 30 10:24:50 2022
+++ src/tests/fs/vfs/t_link.c	Wed Mar 30 12:35:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_link.c,v 1.4 2022/03/30 14:24:50 christos Exp $	*/
+/*	$NetBSD: t_link.c,v 1.5 2022/03/30 16:35:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -53,10 +53,6 @@
 	if (FSTYPE_PUFFS(tc) || FSTYPE_P2K_FFS(tc))			\
 	atf_tc_skip("userlevel pass not supported, "		\
 		"since sysctl might not be set in underlying system")
-#define USES_OWNCHECK			\
-	if (FSTYPE_ZFS(tc))		\
-	atf_tc_skip("zfs not supported since it has its "		\
-		"own rules for hardlinks")
 
 
 static void
@@ -69,7 +65,6 @@ hardlink(const atf_tc_t *tc, const char 
 
 	USES_OWNER;
 	USES_USERLEVEL;
-	USES_OWNCHECK;
 
 	FSTEST_ENTER();
 



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 16:35:28 UTC 2022

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

Log Message:
remove zfs from the exception list; it now works like the other fs's.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/vfs/t_link.c

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



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 14:24:50 UTC 2022

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

Log Message:
update copyright.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_link.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_link.c
diff -u src/tests/fs/vfs/t_link.c:1.3 src/tests/fs/vfs/t_link.c:1.4
--- src/tests/fs/vfs/t_link.c:1.3	Wed Mar 30 09:43:42 2022
+++ src/tests/fs/vfs/t_link.c	Wed Mar 30 10:24:50 2022
@@ -1,9 +1,12 @@
-/*	$NetBSD: t_link.c,v 1.3 2022/03/30 13:43:42 christos Exp $	*/
+/*	$NetBSD: t_link.c,v 1.4 2022/03/30 14:24:50 christos Exp $	*/
 
 /*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 14:24:50 UTC 2022

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

Log Message:
update copyright.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/vfs/t_link.c

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



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 13:43:42 UTC 2022

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

Log Message:
skip userlevel filesystems that have their own rules (they depend on the
system setting of the sysctl on NetBSD) and zfs because it implements its
own rules for hardlinks to files (does its own permission checks).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_link.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_link.c
diff -u src/tests/fs/vfs/t_link.c:1.2 src/tests/fs/vfs/t_link.c:1.3
--- src/tests/fs/vfs/t_link.c:1.2	Tue Mar 29 18:30:07 2022
+++ src/tests/fs/vfs/t_link.c	Wed Mar 30 09:43:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_link.c,v 1.2 2022/03/29 22:30:07 christos Exp $	*/
+/*	$NetBSD: t_link.c,v 1.3 2022/03/30 13:43:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -43,9 +43,17 @@
 #include "../common/h_fsmacros.h"
 #include "h_macros.h"
 
-#define USES_OWNER			 \
-	if (FSTYPE_MSDOS(tc))		 \
+#define USES_OWNER			\
+	if (FSTYPE_MSDOS(tc))		\
 	atf_tc_skip("owner not supported by file system")
+#define USES_USERLEVEL			\
+	if (FSTYPE_PUFFS(tc) || FSTYPE_P2K_FFS(tc))			\
+	atf_tc_skip("userlevel pass not supported, "		\
+		"since sysctl might not be set in underlying system")
+#define USES_OWNCHECK			\
+	if (FSTYPE_ZFS(tc))		\
+	atf_tc_skip("zfs not supported since it has its "		\
+		"own rules for hardlinks")
 
 
 static void
@@ -57,6 +65,8 @@ hardlink(const atf_tc_t *tc, const char 
 	int one = 1, fd;
 
 	USES_OWNER;
+	USES_USERLEVEL;
+	USES_OWNCHECK;
 
 	FSTEST_ENTER();
 



CVS commit: src/tests/fs/vfs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 13:43:42 UTC 2022

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

Log Message:
skip userlevel filesystems that have their own rules (they depend on the
system setting of the sysctl on NetBSD) and zfs because it implements its
own rules for hardlinks to files (does its own permission checks).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/vfs/t_link.c

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



CVS commit: src/tests/fs/vfs

2022-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 29 22:30:07 UTC 2022

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

Log Message:
ignore EOPNOTSUPP errors for fs's that don't support hard links.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_link.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_link.c
diff -u src/tests/fs/vfs/t_link.c:1.1 src/tests/fs/vfs/t_link.c:1.2
--- src/tests/fs/vfs/t_link.c:1.1	Mon Mar 28 16:51:04 2022
+++ src/tests/fs/vfs/t_link.c	Tue Mar 29 18:30:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_link.c,v 1.1 2022/03/28 20:51:04 christos Exp $	*/
+/*	$NetBSD: t_link.c,v 1.2 2022/03/29 22:30:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@ hardlink(const atf_tc_t *tc, const char 
 	if (rump_sys_setuid(u2) == -1)
 		atf_tc_fail_errno("setuid");
 if (rump_sys_link(name, link) == -1) {
-		if (allowed)
+		if (errno != EOPNOTSUPP && allowed)
 			atf_tc_fail_errno("link");
 	} else {
 		if (!allowed)



CVS commit: src/tests/fs/vfs

2022-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 29 22:30:07 UTC 2022

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

Log Message:
ignore EOPNOTSUPP errors for fs's that don't support hard links.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_link.c

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



CVS commit: src/tests/fs/vfs

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:51:04 UTC 2022

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

Log Message:
Add a test for hardlink sysctl limiting.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_link.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.27 src/tests/fs/vfs/Makefile:1.28
--- src/tests/fs/vfs/Makefile:1.27	Mon Mar  2 06:09:13 2020
+++ src/tests/fs/vfs/Makefile	Mon Mar 28 16:51:04 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2020/03/02 11:09:13 christos Exp $
+#	$NetBSD: Makefile,v 1.28 2022/03/28 20:51:04 christos Exp $
 #
 
 .include 
@@ -6,6 +6,7 @@
 TESTSDIR=	${TESTSBASE}/fs/vfs
 WARNS=		4
 
+TESTS_C+=	t_link
 TESTS_C+=	t_full
 TESTS_C+=	t_io
 TESTS_C+=	t_renamerace
@@ -19,6 +20,12 @@ TESTS_C+=	t_mtime_write
 TESTS_C+=	t_vfsops
 TESTS_C+=	t_vnops
 
+
+.PATH: ${NETBSDSRCDIR}/lib/libc/gen
+CPPFLAGS.sysctlbyname.c += -DRUMP_ACTION
+CPPFLAGS.sysctlgetmibinfo.c += -DRUMP_ACTION
+SRCS.t_link+= sysctlbyname.c sysctlgetmibinfo.c t_link.c
+
 LDADD+=-lrumpnet_shmif -lrumpnet -lrumpnet_net -lrumpnet_netinet# TCP/IP
 LDADD+=-lrumpfs_nfs		# NFS
 LDADD+=-lrumpfs_ext2fs		# ext2fs

Added files:

Index: src/tests/fs/vfs/t_link.c
diff -u /dev/null src/tests/fs/vfs/t_link.c:1.1
--- /dev/null	Mon Mar 28 16:51:05 2022
+++ src/tests/fs/vfs/t_link.c	Mon Mar 28 16:51:04 2022
@@ -0,0 +1,150 @@
+/*	$NetBSD: t_link.c,v 1.1 2022/03/28 20:51:04 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2011 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 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "../common/h_fsmacros.h"
+#include "h_macros.h"
+
+#define USES_OWNER			 \
+	if (FSTYPE_MSDOS(tc))		 \
+	atf_tc_skip("owner not supported by file system")
+
+
+static void
+hardlink(const atf_tc_t *tc, const char *mp, uid_t u1, uid_t u2,
+bool sysctl, bool allowed)
+{
+	const char name[] = "foo";
+	const char link[] = "bar";
+	int one = 1, fd;
+
+	USES_OWNER;
+
+	FSTEST_ENTER();
+
+	if (sysctl) {
+		if (sysctlbyname(
+		"security.models.extensions.hardlink_check_uid",
+		NULL, 0, , sizeof(one)) == -1)
+			atf_tc_fail_errno("sysctlbyname");
+	}
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_chmod(".", 0777) == -1)
+		atf_tc_fail_errno("chmod");
+	if (rump_sys_setuid(u1) == -1)
+		atf_tc_fail_errno("setuid");
+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_releaselwp();
+
+	rump_pub_lwproc_rfork(RUMP_RFCFDG);
+	if (rump_sys_setuid(u2) == -1)
+		atf_tc_fail_errno("setuid");
+if (rump_sys_link(name, link) == -1) {
+		if (allowed)
+			atf_tc_fail_errno("link");
+	} else {
+		if (!allowed)
+			atf_tc_fail("failed to disallow hard link");
+	}
+	rump_pub_lwproc_releaselwp();
+
+	FSTEST_EXIT();
+}
+
+
+static void
+hardlink_sameuser(const atf_tc_t *tc, const char *mp)
+{
+	hardlink(tc, mp, 1, 1, false, true);
+}
+
+static void
+hardlink_sameuser_sysctl(const atf_tc_t *tc, const char *mp)
+{
+	hardlink(tc, mp, 1, 1, true, true);
+}
+
+static void
+hardlink_otheruser(const atf_tc_t *tc, const char *mp)
+{
+	hardlink(tc, mp, 1, 2, false, true);
+}
+
+static void
+hardlink_otheruser_sysctl(const atf_tc_t *tc, const char *mp)
+{
+	hardlink(tc, 

CVS commit: src/tests/fs/vfs

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:51:04 UTC 2022

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

Log Message:
Add a test for hardlink sysctl limiting.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_link.c

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



Re: CVS commit: src/tests/fs/vfs

2022-02-05 Thread Robert Elz
Date:Sat, 5 Feb 2022 22:20:16 +
From:David Brownlee 
Message-ID:  


  | Oops, my earliest unix experience was on a BSD4.3 variant, so I was
  | spoiled by ffs and didn't realise the (in this context) helpful v7fs
  | behaviour with overlong filename components.

To clarify ... I meant7th edition (and earlier) filesystems, not
necessarily the thing we have called v7fs about which I know
nothing ... thiugh I wondered when I saw your PR whether a name
length problem might be what caused that.

kre


Re: CVS commit: src/tests/fs/vfs

2022-02-05 Thread David Brownlee
On Wed, 2 Feb 2022 at 17:24, Robert Elz  wrote:
>
> Date:Wed, 2 Feb 2022 15:26:21 +
> From:David Brownlee 
> Message-ID:  
> 
>
>   | So, we just need an optional flag when mounting v7fs to truncate any
>   | looked up filename component to 14 characters
>
> That's not, or shouldn't be, necessary - that always happened, the limit was
> what was stored in the directory, not on the length of the pathname components
> passed to namei.
>
> Further, v7fs (systems of that vintage) had no concept at all of a maximum
> pathname length (provided there was available ram to store the string).
>

(Apologies for continuing further down this rabbit hole :)

Oops, my earliest unix experience was on a BSD4.3 variant, so I was
spoiled by ffs and didn't realise the (in this context) helpful v7fs
behaviour with overlong filename components.

As a quick test extracting rescue.tar.xz into a v7fs and chrooting
into rescue/sh works, and rsyncing enough to get /bin/sh chrooting
also works (extracting base.tar.xz runs into issues - PR bin/56690)

Actually, there were enough other issues found in PR bin/56690 that I
would have to regretfully recommend against v7fs for production NetBSD
systems (ahem :)

David


Re: CVS commit: src/tests/fs/vfs

2022-02-02 Thread Robert Elz
Date:Wed, 2 Feb 2022 15:26:21 +
From:David Brownlee 
Message-ID:  


  | So, we just need an optional flag when mounting v7fs to truncate any
  | looked up filename component to 14 characters

That's not, or shouldn't be, necessary - that always happened, the limit was
what was stored in the directory, not on the length of the pathname components
passed to namei.

Further, v7fs (systems of that vintage) had no concept at all of a maximum
pathname length (provided there was available ram to store the string).

kre



Re: CVS commit: src/tests/fs/vfs

2022-02-02 Thread Jason Thorpe



> On Feb 2, 2022, at 6:47 AM, Robert Elz  wrote:
> 
>Date:Wed, 2 Feb 2022 07:11:45 +
>From:David Holland 
>Message-ID:  
> 
>  | v7fs isn't a compat interface for old users,
> 
> That's sad, I could do with something just for me!
> 
>  | it's a compat interface for old disk images :-)
> 
> And makefs -t v7fs fits into that purpose how?
> 
> So maybe it is for us truly old fogies (can we have v6fs as well?
> Then I'd really feel at home.)   Can I have a v7fs as root, and
> boot from it?   Does sysinst support it?

I thought we maybe supported a system whose ROM boots from it?

-- thorpej



Re: CVS commit: src/tests/fs/vfs

2022-02-02 Thread Michael
Hello,

On Wed, 02 Feb 2022 21:47:25 +0700
Robert Elz  wrote:

> So maybe it is for us truly old fogies (can we have v6fs as well?

Well, there is this thing...
https://github.com/jaylogue/retro-fuse

A user-space filesystem (FUSE) for accessing ancient Unix filesystems.

retro-fuse provides a way to mount filesystems created by ancient Unix
systems on modern OSes. The current version of retro-fuse supports
mounting filesystems created by fifth, sixth and seventh-edition
research Unix, as well as 2.9BSD and 2.11BSD. It can also initialize
such filesystems.

have fun
Michael


Re: CVS commit: src/tests/fs/vfs

2022-02-02 Thread David Brownlee
On Wed, 2 Feb 2022 at 14:47, Robert Elz  wrote:
>
> Date:Wed, 2 Feb 2022 07:11:45 +
> From:David Holland 
> Message-ID:  
>
>   | v7fs isn't a compat interface for old users,
>
> That's sad, I could do with something just for me!

Sounds like we need a compat_kre(8) - assuming it would be more
correct to provide the appropriate trailing slash behaviour for all
filesystems in that mode? :-p

>   | it's a compat interface for old disk images :-)
>
> And makefs -t v7fs fits into that purpose how?
>
> So maybe it is for us truly old fogies (can we have v6fs as well?
> Then I'd really feel at home.)   Can I have a v7fs as root, and
> boot from it?

Maybe?
- Throw together a bootxx_v7fs
- Leave /dev with just MAKEDEV so the system will mount a mfs /dev
- Convert symlinks to hard links or file copies when setting up
- Then it's just the 14 character filename component limit: excluding
drm firmware, kernel modules and X config most filename components are
14 characters or less - but there are a few libraries in /lib with
longer filenames - lib/libcrypto.so.14 lib/libtermcap.so.0
lib/libterminfo.so.1 and lib/libpthread.so.1 are likely to be
problematic

So, we just need an optional flag when mounting v7fs to truncate any
looked up filename component to 14 characters, then we're good to go.
Actually, I'm a little concerned about how close it could be to being
possible! :)

>   Does sysinst support it?

It would be under the --spinal-tap option

David


Re: CVS commit: src/tests/fs/vfs

2022-02-02 Thread Robert Elz
Date:Wed, 2 Feb 2022 07:11:45 +
From:David Holland 
Message-ID:  

  | v7fs isn't a compat interface for old users,

That's sad, I could do with something just for me!

  | it's a compat interface for old disk images :-)

And makefs -t v7fs fits into that purpose how?

So maybe it is for us truly old fogies (can we have v6fs as well?
Then I'd really feel at home.)   Can I have a v7fs as root, and
boot from it?   Does sysinst support it?

kre


Re: CVS commit: src/tests/fs/vfs

2022-02-01 Thread David Holland
On Wed, Feb 02, 2022 at 05:43:45AM +0700, Robert Elz wrote:
 >   | Test mkdir(2) with one or more trailing slashes - this currently fails
 >   | for v7fs.
 > 
 > As it should I think, trailing slashes are not simply deleted in v7fs.
 >
 > [...]
 > 
 > If this was ever changed, it would not truly be a v7fs any more.

v7fs isn't a compat interface for old users, it's a compat interface
for old disk images :-)

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/tests/fs/vfs

2022-02-01 Thread Robert Elz
Date:Tue, 1 Feb 2022 18:27:24 +
From:"Martin Husemann" 
Message-ID:  <20220201182724.90f82f...@cvs.netbsd.org>

  | Test mkdir(2) with one or more trailing slashes - this currently fails
  | for v7fs.

As it should I think, trailing slashes are not simply deleted in v7fs.

If you do

mkdir /path/to/dir/

in a v7 fs, then you're guaranteed (unless some other error happens earlier)
either ENOENT if /path/to/dir doesn't already exist, ENOTDIR if it it does
but isn't a directory, or EEXIST if it exists and is a directory.   The thing
to be created always follows the final slash, everything prior to that is
path to look up, and must all exist and be directories (with appropriate
permissions, etc).In this case the "thing" is "" which is (kind of) an
alias for "." (without ever actually looking up ".").   It can never not
exist if the preceding path all exists.

If this was ever changed, it would not truly be a v7fs any more.

kre

ps: I never understood the fascination with always writing directory names
with a trailing / - it seems to come largely from filename completion
where the '/' is added if the name found is a directory, so you can just
go on typing anything that is to follow in the path (but could easily be
removed again if no more components are added - just isn't) but it makes
no sense for this to have happened with mkdir, filename completion can
only find files that exist, not ones to be created, so it couldn't be that
which adds the '/' after the directory name - some human must be doing
that, but why?  It seems to be to be just meaningless extra unneeded typing.




CVS commit: src/tests/fs/vfs

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 18:27:24 UTC 2022

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

Log Message:
Test mkdir(2) with one or more trailing slashes - this currently fails
for v7fs.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.61 src/tests/fs/vfs/t_vnops.c:1.62
--- src/tests/fs/vfs/t_vnops.c:1.61	Thu Sep 16 21:29:42 2021
+++ src/tests/fs/vfs/t_vnops.c	Tue Feb  1 18:27:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.61 2021/09/16 21:29:42 andvar Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.62 2022/02/01 18:27:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -175,6 +175,45 @@ dir_simple(const atf_tc_t *tc, const cha
 }
 
 static void
+do_dir_slash(const atf_tc_t *tc, const char *mountpath, const char *addend)
+{
+	char plain[MAXPATHLEN], with_slash[MAXPATHLEN];
+	struct stat sb;
+
+	USES_DIRS;
+
+	/* check we can create directories with one or more / appended */
+	snprintf(plain, sizeof(plain), "%s/dir%s", mountpath, addend);
+	snprintf(with_slash, sizeof(with_slash), "%s/dir/", mountpath);
+	if (rump_sys_mkdir(with_slash, 0777) == -1)
+		atf_tc_fail_errno("mkdir");
+	if (rump_sys_stat(plain, ) == -1)
+		atf_tc_fail_errno("stat new directory");
+	if (rump_sys_rmdir(plain) == -1)
+		atf_tc_fail_errno("rmdir");
+	if (rump_sys_stat(with_slash, ) != -1 || errno != ENOENT)
+		atf_tc_fail("ENOENT expected from stat");
+}
+
+static void
+dir_slash(const atf_tc_t *tc, const char *mountpath)
+{
+	do_dir_slash(tc, mountpath, "/");
+}
+
+static void
+dir_2slash(const atf_tc_t *tc, const char *mountpath)
+{
+	do_dir_slash(tc, mountpath, "//");
+}
+
+static void
+dir_3slash(const atf_tc_t *tc, const char *mountpath)
+{
+	do_dir_slash(tc, mountpath, "///");
+}
+
+static void
 dir_notempty(const atf_tc_t *tc, const char *mountpath)
 {
 	char pb[MAXPATHLEN], pb2[MAXPATHLEN];
@@ -1026,6 +1065,9 @@ lstat_symlink(const atf_tc_t *tc, const 
 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");
+ATF_TC_FSAPPLY(dir_slash, "mkdir with appended slash");
+ATF_TC_FSAPPLY(dir_2slash, "mkdir with two slashes appended");
+ATF_TC_FSAPPLY(dir_3slash, "mkdir with three slashes appended");
 ATF_TC_FSAPPLY(dir_notempty, "non-empty directories cannot be removed");
 ATF_TC_FSAPPLY(dir_rmdirdotdot, "remove .. and try to cd out (PR kern/44657)");
 ATF_TC_FSAPPLY(rename_dir, "exercise various directory renaming ops "
@@ -1058,6 +1100,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_FSAPPLY(dir_simple);
 	ATF_TP_FSAPPLY(dir_notempty);
 	ATF_TP_FSAPPLY(dir_rmdirdotdot);
+	ATF_TP_FSAPPLY(dir_slash);
+	ATF_TP_FSAPPLY(dir_2slash);
+	ATF_TP_FSAPPLY(dir_3slash);
 	ATF_TP_FSAPPLY(rename_dir);
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);



CVS commit: src/tests/fs/vfs

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 18:27:24 UTC 2022

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

Log Message:
Test mkdir(2) with one or more trailing slashes - this currently fails
for v7fs.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.



CVS commit: src/tests/fs/vfs

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 17:23:37 UTC 2022

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

Log Message:
Extend the time to wait for the thread to quit.

It seems that alarm(1) is not enough time for the thread to actually exit after 
quittingtime = 1.
It randomly failed with "Test program received signal 14" on a slow environment.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 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.43 src/tests/fs/vfs/t_renamerace.c:1.44
--- src/tests/fs/vfs/t_renamerace.c:1.43	Sat Nov 27 15:23:33 2021
+++ src/tests/fs/vfs/t_renamerace.c	Mon Jan 31 17:23:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.43 2021/11/27 15:23:33 gson Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.44 2022/01/31 17:23:37 ryo Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -244,7 +244,7 @@ renamerace_cycle(const atf_tc_t *tc, con
 	sleep(10);
 	quittingtime = 1;
 
-	alarm(1);
+	alarm(5);
 	pthread_join(pt_rmdir, NULL);
 	pthread_join(pt_rename1, NULL);
 	pthread_join(pt_rename2, NULL);



CVS commit: src/tests/fs/vfs

2022-01-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jan 31 17:23:37 UTC 2022

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

Log Message:
Extend the time to wait for the thread to quit.

It seems that alarm(1) is not enough time for the thread to actually exit after 
quittingtime = 1.
It randomly failed with "Test program received signal 14" on a slow environment.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 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.



CVS commit: src/tests/fs/vfs

2021-11-27 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Nov 27 15:23:33 UTC 2021

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

Log Message:
Force failure of the nfs_renamerace_cycle, p2k_ffs_renamerace_cycle,
and puffs_renamerace_cycle test cases as they fail only randomly or
only on some systems.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 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.42 src/tests/fs/vfs/t_renamerace.c:1.43
--- src/tests/fs/vfs/t_renamerace.c:1.42	Sat Oct 23 17:43:08 2021
+++ src/tests/fs/vfs/t_renamerace.c	Sat Nov 27 15:23:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.42 2021/10/23 17:43:08 hannken Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.43 2021/11/27 15:23:33 gson Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -253,6 +253,12 @@ renamerace_cycle(const atf_tc_t *tc, con
 
 	if (FSTYPE_UDF(tc))
 		atf_tc_fail("PR kern/56253 did not trigger this time");
+	if (FSTYPE_P2K_FFS(tc))
+		atf_tc_fail("did not fail this time");
+	if (FSTYPE_PUFFS(tc))
+		atf_tc_fail("did not fail this time");
+	if (FSTYPE_NFS(tc))
+		atf_tc_fail("did not fail this time");
 }
 
 ATF_TC_FSAPPLY(renamerace, "rename(2) race with file unlinked mid-operation");



CVS commit: src/tests/fs/vfs

2021-11-27 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Nov 27 15:23:33 UTC 2021

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

Log Message:
Force failure of the nfs_renamerace_cycle, p2k_ffs_renamerace_cycle,
and puffs_renamerace_cycle test cases as they fail only randomly or
only on some systems.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 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.



CVS commit: src/tests/fs/vfs

2021-10-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Oct 23 17:43:08 UTC 2021

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

Log Message:
After converting msdosfs_rename() to use genfs_sane_rename() the
MSDOS tests should pass.

Tested on QEMU/nvmm archs i386 and amd64.

Should resolve PR kern/43626 (directory renaming more than a little racy)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 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.41 src/tests/fs/vfs/t_renamerace.c:1.42
--- src/tests/fs/vfs/t_renamerace.c:1.41	Wed Jun 16 23:58:07 2021
+++ src/tests/fs/vfs/t_renamerace.c	Sat Oct 23 17:43:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.41 2021/06/16 23:58:07 riastradh Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.42 2021/10/23 17:43:08 hannken Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -183,19 +183,6 @@ renamerace(const atf_tc_t *tc, const cha
 
 	if (FSTYPE_UDF(tc))
 		atf_tc_fail("race did not trigger this time");
-
-	if (FSTYPE_MSDOS(tc)) {
-		atf_tc_expect_fail("PR kern/43626");
-		/*
-		 * XXX: race does not trigger every time at least
-		 * on amd64/qemu.
-		 */
-		if (msdosfs_fstest_unmount(tc, mp, 0) != 0) {
-			rump_pub_vfs_mount_print(mp, 1);
-			atf_tc_fail_errno("unmount failed");
-		}
-		atf_tc_fail("race did not trigger this time");
-	}
 }
 
 static void
@@ -210,10 +197,6 @@ renamerace_dirs(const atf_tc_t *tc, cons
 	if (FSTYPE_UDF(tc))
 		atf_tc_expect_fail("PR kern/53865");
 
-	/* 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());
 
@@ -230,13 +213,6 @@ renamerace_dirs(const atf_tc_t *tc, cons
 
 	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.
-	 */
-	if (FSTYPE_MSDOS(tc))
-		abort();
 }
 
 static void
@@ -257,10 +233,6 @@ renamerace_cycle(const atf_tc_t *tc, con
 	if (FSTYPE_UDF(tc))
 		atf_tc_expect_fail("sometimes fails with ENOSPC, PR kern/56253");
 
-	/* 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());
 
@@ -281,13 +253,6 @@ renamerace_cycle(const atf_tc_t *tc, con
 
 	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.
-	 */
-	if (FSTYPE_MSDOS(tc))
-		abort();
 }
 
 ATF_TC_FSAPPLY(renamerace, "rename(2) race with file unlinked mid-operation");



CVS commit: src/tests/fs/vfs

2021-10-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Oct 23 17:43:08 UTC 2021

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

Log Message:
After converting msdosfs_rename() to use genfs_sane_rename() the
MSDOS tests should pass.

Tested on QEMU/nvmm archs i386 and amd64.

Should resolve PR kern/43626 (directory renaming more than a little racy)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 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.



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.



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.



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

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.



CVS commit: src/tests/fs/vfs

2019-09-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Sep 21 14:25:42 UTC 2019

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

Log Message:
Initialise the sometvs array of struct timeval that is to be used to
validate that utimes() cannot update the times of a file on a read only
filesystem.   The values are never actually used, but since
src/sys/kern/vfs_syscalls.c 1.535
they are validated for sanity, and the syscall returns EINVAL if the
values passed are invalid (tv_usec <0 or >= 100).  If that happens
we don't get as far as the test which produces the EROFS that is expected
from this test (these tests - one for each filesystem type).

So, init the timeval structs (just to 0, the values will still not be
used) so that the EINVAL doesn't bite us before we're eaten by the EROFS
which is the way we're supposed to die.

If the syscall API args were labelled as "const" the compiler probably
would have caught the use of uninit'd vars and complained much sooner.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/tests/fs/vfs/t_ro.c:1.8
--- src/tests/fs/vfs/t_ro.c:1.7	Tue Jul 16 17:29:17 2019
+++ src/tests/fs/vfs/t_ro.c	Sat Sep 21 14:25:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ro.c,v 1.7 2019/07/16 17:29:17 martin Exp $	*/
+/*	$NetBSD: t_ro.c,v 1.8 2019/09/21 14:25:42 kre Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -120,7 +120,7 @@ fileio(const atf_tc_t *tc, const char *m
 static void
 attrs(const atf_tc_t *tc, const char *mp)
 {
-	struct timeval sometvs[2];
+	struct timeval sometvs[2] = { {0,0}, {0,0} };
 	struct stat sb;
 	int fd;
 



CVS commit: src/tests/fs/vfs

2019-09-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Sep 21 14:25:42 UTC 2019

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

Log Message:
Initialise the sometvs array of struct timeval that is to be used to
validate that utimes() cannot update the times of a file on a read only
filesystem.   The values are never actually used, but since
src/sys/kern/vfs_syscalls.c 1.535
they are validated for sanity, and the syscall returns EINVAL if the
values passed are invalid (tv_usec <0 or >= 100).  If that happens
we don't get as far as the test which produces the EROFS that is expected
from this test (these tests - one for each filesystem type).

So, init the timeval structs (just to 0, the values will still not be
used) so that the EINVAL doesn't bite us before we're eaten by the EROFS
which is the way we're supposed to die.

If the syscall API args were labelled as "const" the compiler probably
would have caught the use of uninit'd vars and complained much sooner.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.



CVS commit: src/tests/fs/vfs

2019-08-17 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Aug 17 09:44:02 UTC 2019

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

Log Message:
The udf_renamerace test case no longer fails due to PR kern/49046, but
it does fail due to PR kern/53865 on real hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.



CVS commit: src/tests/fs/vfs

2019-08-17 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Aug 17 09:44:02 UTC 2019

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

Log Message:
The udf_renamerace test case no longer fails due to PR kern/49046, but
it does fail due to PR kern/53865 on real hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/tests/fs/vfs/t_renamerace.c:1.36
--- src/tests/fs/vfs/t_renamerace.c:1.35	Sun Jan 13 14:35:00 2019
+++ src/tests/fs/vfs/t_renamerace.c	Sat Aug 17 09:44:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.35 2019/01/13 14:35:00 gson Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.36 2019/08/17 09:44:01 gson Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -102,7 +102,7 @@ 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("PR kern/49046");
+		atf_tc_expect_fail("PR kern/53865");
 
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 	RL(wrkpid = rump_sys_getpid());



CVS commit: src/tests/fs/vfs

2019-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 16 21:13:28 UTC 2019

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

Log Message:
fix misplaced paren


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/tests/fs/vfs/t_io.c:1.19
--- src/tests/fs/vfs/t_io.c:1.18	Tue Jul 16 13:29:17 2019
+++ src/tests/fs/vfs/t_io.c	Tue Jul 16 17:13:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.18 2019/07/16 17:29:17 martin Exp $	*/
+/*	$NetBSD: t_io.c,v 1.19 2019/07/16 21:13:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@ extendbody(const atf_tc_t *tc, off_t see
 
 	FSTEST_ENTER();
 	RL(fd = rump_sys_open("testfile",
-	O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)), 0600);
+	O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0), 0600));
 	RL(rump_sys_ftruncate(fd, seekcnt));
 	RL(rump_sys_fstat(fd, ));
 	ATF_REQUIRE_EQ(sb.st_size, seekcnt);



CVS commit: src/tests/fs/vfs

2019-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 16 21:13:28 UTC 2019

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

Log Message:
fix misplaced paren


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.



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

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.



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

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.



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.



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.



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-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.



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-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.



CVS commit: src/tests/fs/vfs

2016-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 20 15:48:18 UTC 2016

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

Log Message:
- use snprintf
- print the argument that caused the error


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 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.



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-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.



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.



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-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.



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.



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-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.



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.



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.



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

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.



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-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.



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.



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.



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

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.



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-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.



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-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.



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-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.



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-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.



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-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.



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-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.



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-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.



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.



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

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.



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-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.



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-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.



  1   2   3   >