CVS commit: src/tests/fs/ffs

2020-08-20 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Thu Aug 20 07:23:20 UTC 2020

Modified Files:
src/tests/fs/ffs: ffs_common.sh

Log Message:
Remove non-functional cleanup code from test_case() and test_case_root().
It had no effect because RUMP_SOCKETS_LIST is not set in the shell
running the cleanup phase.  Even if RUMP_SOCKETS_LIST had been set,
the code would still not have worked correctly because it ran
rump.halt via "atf_check -s exit:1", which would cause the first
successful halting of a rump processes to be treated as a failure
and abort the cleanup without halting any other rump processes still
running.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/ffs/ffs_common.sh

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/ffs/ffs_common.sh
diff -u src/tests/fs/ffs/ffs_common.sh:1.4 src/tests/fs/ffs/ffs_common.sh:1.5
--- src/tests/fs/ffs/ffs_common.sh:1.4	Mon Aug 17 06:18:39 2020
+++ src/tests/fs/ffs/ffs_common.sh	Thu Aug 20 07:23:20 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ffs_common.sh,v 1.4 2020/08/17 06:18:39 gson Exp $ 
+# $NetBSD: ffs_common.sh,v 1.5 2020/08/20 07:23:20 gson Exp $ 
 
 create_ffs()
 {
@@ -30,7 +30,7 @@ test_case()
 	local check_function="${1}"; shift
 	local descr="${1}"; shift
 	
-	atf_test_case "${name}" cleanup
+	atf_test_case "${name}"
 
 	eval "${name}_head() { \
 		atf_set "descr" "${descr}"
@@ -41,12 +41,6 @@ test_case()
 		export RUMP_SERVER=unix://\${RUMP_SOCKET}; \
 		${check_function} " "${@}" "; \
 	}"
-	eval "${name}_cleanup() { \
-		for s in \${RUMP_SOCKETS_LIST}; do \
-			export RUMP_SERVER=unix://\${s}; \
-			atf_check -s exit:1 -o ignore -e ignore rump.halt; \
-		done; \
-	}"
 	tests="${tests} ${name}"
 }
 
@@ -56,7 +50,7 @@ test_case_root()
 	local check_function="${1}"; shift
 	local descr="${1}"; shift
 	
-	atf_test_case "${name}" cleanup
+	atf_test_case "${name}"
 
 	eval "${name}_head() { \
 		atf_set "descr" "${descr}"
@@ -68,12 +62,6 @@ test_case_root()
 		export RUMP_SERVER=unix://\${RUMP_SOCKET}; \
 		${check_function} " "${@}" "; \
 	}"
-	eval "${name}_cleanup() { \
-		for s in \${RUMP_SOCKETS_LIST}; do \
-			export RUMP_SERVER=unix://\${s}; \
-			atf_check -s exit:1 -o ignore -e ignore rump.halt; \
-		done; \
-	}"
 	tests="${tests} ${name}"
 }
 



CVS commit: src/tests/fs/ffs

2020-08-17 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Mon Aug 17 06:18:39 UTC 2020

Modified Files:
src/tests/fs/ffs: ffs_common.sh

Log Message:
Remove unused function rump_shutdown()


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/ffs/ffs_common.sh

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/ffs/ffs_common.sh
diff -u src/tests/fs/ffs/ffs_common.sh:1.3 src/tests/fs/ffs/ffs_common.sh:1.4
--- src/tests/fs/ffs/ffs_common.sh:1.3	Sat Oct  8 13:23:53 2016
+++ src/tests/fs/ffs/ffs_common.sh	Mon Aug 17 06:18:39 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ffs_common.sh,v 1.3 2016/10/08 13:23:53 gson Exp $ 
+# $NetBSD: ffs_common.sh,v 1.4 2020/08/17 06:18:39 gson Exp $ 
 
 create_ffs()
 {
@@ -23,17 +23,6 @@ create_ffs_server()
 		${sarg} ${IMG} ${RUMP_SERVER}
 }
 
-rump_shutdown()
-{
-	for s in ${RUMP_SOCKETS_LIST}; do
-		atf_check -s exit:0 env RUMP_SERVER=unix://${s} rump.halt;
-	done
-# check that the quota inode creation didn't corrupt the filesystem
-	atf_check -s exit:0 -o "match:already clean" \
-		-o "match:Phase 6 - Check Quotas" \
-		fsck_ffs -nf -F ${IMG}
-}
-
 # from tests/ipf/h_common.sh via tests/sbin/resize_ffs
 test_case()
 {



CVS commit: src/tests/fs/ffs

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 23:52:20 UTC 2020

Modified Files:
src/tests/fs/ffs: t_extattr.c

Log Message:
make sure that 0 length files get their extattrs cleaned up on deletion
(there was an optimization to not call truncate if size == 0).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/t_extattr.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/ffs/t_extattr.c
diff -u src/tests/fs/ffs/t_extattr.c:1.1 src/tests/fs/ffs/t_extattr.c:1.2
--- src/tests/fs/ffs/t_extattr.c:1.1	Fri Apr 10 18:58:47 2020
+++ src/tests/fs/ffs/t_extattr.c	Sun Apr 12 19:52:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $	*/
+/*	$NetBSD: t_extattr.c,v 1.2 2020/04/12 23:52:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $");
+__RCSID("$NetBSD: t_extattr.c,v 1.2 2020/04/12 23:52:20 christos Exp $");
 
 #include 
 #include 
@@ -51,14 +51,6 @@ __RCSID("$NetBSD: t_extattr.c,v 1.1 2020
 
 #include "h_macros.h"
 
-ATF_TC_WITH_CLEANUP(extattr);
-ATF_TC_HEAD(extattr, tc)
-{
-	atf_tc_set_md_var(tc, "descr", "test extended attribute support in "
-	"ffsv2");
-	atf_tc_set_md_var(tc, "timeout", "5");
-}
-
 #define IMGNAME "extattr.img"
 
 #define G "/garage"
@@ -90,12 +82,9 @@ check_list(const char *buf, ssize_t nr)
 const char *newfs = "newfs -O 2 -F -s 1 " IMGNAME;
 #define FAKEBLK "/dev/formula1"
 
-ATF_TC_BODY(extattr, tc)
-{
+static void
+start(void) {
 	struct ufs_args args;
-	ssize_t nr;
-	int fd;
-	char buf[512];
 
 	if (system(newfs) == -1)
 		atf_tc_fail_errno("newfs failed");
@@ -113,6 +102,33 @@ ATF_TC_BODY(extattr, tc)
 	/* create extattr */
 	if (rump_sys_chdir(G) == 1)
 		atf_tc_fail_errno("chdir");
+}
+
+static void
+finish(void) {
+	if (rump_sys_chdir("/") == 1)
+		atf_tc_fail_errno("chdir");
+	if (rump_sys_unmount(G, 0) == -1)
+		atf_tc_fail_errno("unmount failed");
+}
+
+
+ATF_TC_WITH_CLEANUP(extattr_simple);
+ATF_TC_HEAD(extattr_simple, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "test extended attribute creation"
+	" and removal ffsv2");
+	atf_tc_set_md_var(tc, "timeout", "5");
+}
+
+ATF_TC_BODY(extattr_simple, tc)
+{
+	ssize_t nr;
+	int fd;
+	char buf[512];
+
+	start();
+
 	if ((fd = rump_sys_open(M, O_RDWR | O_CREAT, 0600)) == -1)
 		atf_tc_fail_errno("open");
 	if (rump_sys_write(fd, "hi mom\n", 7) != 7)
@@ -161,9 +177,46 @@ ATF_TC_BODY(extattr, tc)
 		atf_tc_fail_errno("close");
 	if (rump_sys_unlink(M) == -1)
 		atf_tc_fail_errno("unlink");
+
+	finish();
+}
+
+ATF_TC_CLEANUP(extattr_simple, tc)
+{
+
+	unlink(IMGNAME);
+}
+
+ATF_TC_WITH_CLEANUP(extattr_create_unlink);
+ATF_TC_HEAD(extattr_create_unlink, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "test extended attribute creation"
+	" and unlinking file with ACLs");
+	atf_tc_set_md_var(tc, "timeout", "5");
+}
+
+ATF_TC_BODY(extattr_create_unlink, tc)
+{
+	int fd;
+
+	start();
+	if ((fd = rump_sys_open(M, O_RDWR | O_CREAT, 0600)) == -1)
+		atf_tc_fail_errno("open");
+
+	if (rump_sys_close(fd) == -1)
+		atf_tc_fail_errno("close");
+
+	/* create extattr */
+	if (rump_sys_extattr_set_file(M, EXTATTR_NAMESPACE_USER, T, S, 9) == -1)
+		atf_tc_fail_errno("extattr_set_file");
+
+	if (rump_sys_unlink(M) == -1)
+		atf_tc_fail_errno("unlink");
+	finish();
+
 }
 
-ATF_TC_CLEANUP(extattr, tc)
+ATF_TC_CLEANUP(extattr_create_unlink, tc)
 {
 
 	unlink(IMGNAME);
@@ -171,6 +224,7 @@ ATF_TC_CLEANUP(extattr, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
-	ATF_TP_ADD_TC(tp, extattr);
+	ATF_TP_ADD_TC(tp, extattr_simple);
+	ATF_TP_ADD_TC(tp, extattr_create_unlink);
 	return atf_no_error();
 }



CVS commit: src/tests/fs/ffs

2020-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 10 22:58:47 UTC 2020

Modified Files:
src/tests/fs/ffs: Makefile
Added Files:
src/tests/fs/ffs: t_extattr.c

Log Message:
New extended attributes test (does not work until we commit kernel changes)


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/fs/ffs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_extattr.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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.20 src/tests/fs/ffs/Makefile:1.21
--- src/tests/fs/ffs/Makefile:1.20	Sun Mar  1 13:08:13 2020
+++ src/tests/fs/ffs/Makefile	Fri Apr 10 18:58:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2020/03/01 18:08:13 christos Exp $
+#	$NetBSD: Makefile,v 1.21 2020/04/10 22:58:47 christos Exp $
 #
 
 .include 
@@ -20,6 +20,7 @@ TESTS_SH+=	${name}
 TESTS_SH_SRC_${name}=	ffs_common.sh quotas_common.sh ${name}.sh
 .endfor
 
+TESTS_C+=	t_extattr
 TESTS_C+=	t_fifos
 TESTS_C+=	t_snapshot
 TESTS_C+=	t_snapshot_log

Added files:

Index: src/tests/fs/ffs/t_extattr.c
diff -u /dev/null src/tests/fs/ffs/t_extattr.c:1.1
--- /dev/null	Fri Apr 10 18:58:47 2020
+++ src/tests/fs/ffs/t_extattr.c	Fri Apr 10 18:58:47 2020
@@ -0,0 +1,176 @@
+/*	$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2020 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:
+ * 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 
+__RCSID("$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "h_macros.h"
+
+ATF_TC_WITH_CLEANUP(extattr);
+ATF_TC_HEAD(extattr, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "test extended attribute support in "
+	"ffsv2");
+	atf_tc_set_md_var(tc, "timeout", "5");
+}
+
+#define IMGNAME "extattr.img"
+
+#define G "/garage"
+#define M "mercedes"
+#define C "carburator"
+#define E "engine"
+#define T "trunk"
+#define S "suitcase"
+
+static const char *attrs[] = { E, T };
+
+static void
+check_list(const char *buf, ssize_t nr)
+{
+	size_t p = 0;
+	for (size_t i = 0; i < __arraycount(attrs); i++) {
+		size_t l = buf[p++];
+		if (l != strlen(attrs[i]))
+		atf_tc_fail("got invalid len %zu expected %zu", l,
+			strlen(attrs[i]));
+		if (strncmp([p], attrs[i], l) != 0)
+			atf_tc_fail("got invalid str %.*s expected %s", (int)l,
+			[p], attrs[i]);
+		p += l;
+	}
+}
+
+// Make it ffsv2
+const char *newfs = "newfs -O 2 -F -s 1 " IMGNAME;
+#define FAKEBLK "/dev/formula1"
+
+ATF_TC_BODY(extattr, tc)
+{
+	struct ufs_args args;
+	ssize_t nr;
+	int fd;
+	char buf[512];
+
+	if (system(newfs) == -1)
+		atf_tc_fail_errno("newfs failed");
+
+	memset(, 0, sizeof(args));
+	args.fspec = __UNCONST(FAKEBLK);
+
+	rump_init();
+	if (rump_sys_mkdir(G, 0777) == -1)
+		atf_tc_fail_errno("cannot create mountpoint");
+	rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
+	if (rump_sys_mount(MOUNT_FFS, G, 0, , sizeof(args))==-1)
+		atf_tc_fail_errno("rump_sys_mount failed");
+
+	/* create extattr */
+	if (rump_sys_chdir(G) == 1)
+		atf_tc_fail_errno("chdir");
+	if ((fd = rump_sys_open(M, O_RDWR | O_CREAT, 0600)) == -1)
+		atf_tc_fail_errno("open");
+	if (rump_sys_write(fd, "hi mom\n", 7) != 7)
+		atf_tc_fail_errno("write");
+
+	if (rump_sys_extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, E, C, 11) == -1)
+		atf_tc_fail_errno("exattr_set_fd");
+	if 

CVS commit: src/tests/fs/ffs

2017-03-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Mar 22 21:33:54 UTC 2017

Added Files:
src/tests/fs/ffs: t_update_log.c

Log Message:
add tests for the mount update from rw to rw+log, which used to case the panic
reported in PR kern/52056


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_update_log.c

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

Added files:

Index: src/tests/fs/ffs/t_update_log.c
diff -u /dev/null src/tests/fs/ffs/t_update_log.c:1.1
--- /dev/null	Wed Mar 22 21:33:54 2017
+++ src/tests/fs/ffs/t_update_log.c	Wed Mar 22 21:33:53 2017
@@ -0,0 +1,148 @@
+/*	$NetBSD: t_update_log.c,v 1.1 2017/03/22 21:33:53 jdolecek Exp $	*/
+
+/*
+ * Check log behaviour on mount updates
+ */
+
+#include 
+
+#define FSTEST_IMGSIZE (96 * 512)
+#include "../common/h_fsmacros.h"
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include "h_macros.h"
+
+ATF_TC(updaterwtolog);
+ATF_TC_HEAD(updaterwtolog, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "mounts file system with "
+	"rw, then rw+log");
+}
+
+/*
+ * PR kern/52056
+ * This doesn't trigger panic with old, despite same operations triggering
+ * it with live kernel.
+ * Steps:
+ * 1. boot singleuser
+ * 2. mount -u /
+ * 3. echo abc > abc
+ * 4. mount -u -o log /
+ * 5. echo abc >> abc
+ *
+ * Keeping around just in case.
+ */
+ATF_TC_BODY(updaterwtolog, tc)
+{
+	char buf[1024];
+	struct ufs_args args;
+	int n = 10, fd;
+	const char *newfs_args = "-O2";
+	const char teststring[] = "6c894efc21094525ca1f974c0189b3b0c4e1f28d";
+
+snprintf(buf, sizeof(buf), "newfs -q user -q group -F -s 4000 -n %d "
+"%s %s", (n + 3), newfs_args, FSTEST_IMGNAME);
+if (system(buf) == -1)
+atf_tc_fail_errno("cannot create file system");
+
+rump_init();
+if (rump_sys_mkdir(FSTEST_MNTNAME, 0777) == -1)
+atf_tc_fail_errno("mount point create");
+
+rump_pub_etfs_register("/diskdev", FSTEST_IMGNAME, RUMP_ETFS_BLK);
+
+args.fspec = __UNCONST("/diskdev");
+
+if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, MNT_RDONLY,
+, sizeof(args)) == -1)
+atf_tc_fail_errno("mount ffs rw %s", FSTEST_MNTNAME);
+
+	if (rump_sys_chdir(FSTEST_MNTNAME) == 1)
+		atf_tc_fail_errno("chdir");
+
+if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, MNT_UPDATE,
+, sizeof(args)) == -1)
+atf_tc_fail_errno("mount ffs rw %s", FSTEST_MNTNAME);
+
+	RL(fd = rump_sys_open("dummy", O_CREAT | O_RDWR, 0755));
+	RL(rump_sys_write(fd, teststring, strlen(teststring)));
+	rump_sys_close(fd);
+
+if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, MNT_LOG|MNT_UPDATE,
+, sizeof(args)) == -1)
+atf_tc_fail_errno("mount ffs rw log update %s", FSTEST_MNTNAME);
+
+	RL(fd = rump_sys_open("dummy", O_APPEND | O_RDWR, 0755));
+	RL(rump_sys_write(fd, teststring, strlen(teststring)));
+	rump_sys_close(fd);
+
+	/* otherwise we're do-ne */
+}
+
+ATF_TC(updaterwtolog_async);
+ATF_TC_HEAD(updaterwtolog_async, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "mounts file system with "
+	"rw+async, then rw+async+log");
+}
+
+/*
+ * PR kern/52056
+ */
+ATF_TC_BODY(updaterwtolog_async, tc)
+{
+	char buf[1024];
+	struct ufs_args args;
+	int n = 10, fd;
+	const char *newfs_args = "-O2";
+
+snprintf(buf, sizeof(buf), "newfs -q user -q group -F -s 4000 -n %d "
+"%s %s", (n + 3), newfs_args, FSTEST_IMGNAME);
+if (system(buf) == -1)
+atf_tc_fail_errno("cannot create file system");
+
+rump_init();
+if (rump_sys_mkdir(FSTEST_MNTNAME, 0777) == -1)
+atf_tc_fail_errno("mount point create");
+
+rump_pub_etfs_register("/diskdev", FSTEST_IMGNAME, RUMP_ETFS_BLK);
+
+args.fspec = __UNCONST("/diskdev");
+
+if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, 0,
+, sizeof(args)) == -1)
+atf_tc_fail_errno("mount ffs rw %s", FSTEST_MNTNAME);
+
+	if (rump_sys_chdir(FSTEST_MNTNAME) == 1)
+		atf_tc_fail_errno("chdir");
+
+	RL(fd = rump_sys_open("dummy", O_CREAT | O_RDWR, 0755));
+	sprintf(buf, "test file");
+	RL(rump_sys_write(fd, buf, strlen(buf)));
+	rump_sys_close(fd);
+
+if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, MNT_LOG|MNT_ASYNC|MNT_UPDATE,
+, sizeof(args)) == -1)
+atf_tc_fail_errno("mount ffs rw log update %s", FSTEST_MNTNAME);
+
+	/* otherwise we're do-ne */
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+	ATF_TP_ADD_TC(tp, updaterwtolog);
+	ATF_TP_ADD_TC(tp, updaterwtolog_async);
+
+	return atf_no_error();
+}



CVS commit: src/tests/fs/ffs

2016-10-08 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Oct  8 13:23:53 UTC 2016

Modified Files:
src/tests/fs/ffs: ffs_common.sh

Log Message:
Incrase timeout for the benefit of the walk_list_user test case which
sometimes times out under qemu under Linux, where the timing is more
accurate than under qemu under NetBSD where the the 60 second timeout
typically takes more than 60 seconds to trigger.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/ffs/ffs_common.sh

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/ffs/ffs_common.sh
diff -u src/tests/fs/ffs/ffs_common.sh:1.2 src/tests/fs/ffs/ffs_common.sh:1.3
--- src/tests/fs/ffs/ffs_common.sh:1.2	Mon Jul 29 13:15:24 2013
+++ src/tests/fs/ffs/ffs_common.sh	Sat Oct  8 13:23:53 2016
@@ -1,4 +1,4 @@
-# $NetBSD: ffs_common.sh,v 1.2 2013/07/29 13:15:24 skrll Exp $ 
+# $NetBSD: ffs_common.sh,v 1.3 2016/10/08 13:23:53 gson Exp $ 
 
 create_ffs()
 {
@@ -45,7 +45,7 @@ test_case()
 
 	eval "${name}_head() { \
 		atf_set "descr" "${descr}"
-		atf_set "timeout" "60"
+		atf_set "timeout" "120"
 	}"
 	eval "${name}_body() { \
 		RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \



CVS commit: src/tests/fs/ffs

2013-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 29 13:15:24 UTC 2013

Modified Files:
src/tests/fs/ffs: ffs_common.sh

Log Message:
Slow hardware needs longer, especially for default_deny_user_big


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/ffs_common.sh

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/ffs/ffs_common.sh
diff -u src/tests/fs/ffs/ffs_common.sh:1.1 src/tests/fs/ffs/ffs_common.sh:1.2
--- src/tests/fs/ffs/ffs_common.sh:1.1	Wed Jan 18 20:51:23 2012
+++ src/tests/fs/ffs/ffs_common.sh	Mon Jul 29 13:15:24 2013
@@ -1,4 +1,4 @@
-# $NetBSD: ffs_common.sh,v 1.1 2012/01/18 20:51:23 bouyer Exp $ 
+# $NetBSD: ffs_common.sh,v 1.2 2013/07/29 13:15:24 skrll Exp $ 
 
 create_ffs()
 {
@@ -72,7 +72,7 @@ test_case_root()
 	eval ${name}_head() { \
 		atf_set descr ${descr}
 		atf_set require.user root
-		atf_set timeout 60
+		atf_set timeout 360
 	}
 	eval ${name}_body() { \
 		RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \



CVS commit: src/tests/fs/ffs

2013-01-21 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jan 22 06:24:12 UTC 2013

Modified Files:
src/tests/fs/ffs: t_miscquota.sh

Log Message:
spelling


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/ffs/t_miscquota.sh

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/ffs/t_miscquota.sh
diff -u src/tests/fs/ffs/t_miscquota.sh:1.7 src/tests/fs/ffs/t_miscquota.sh:1.8
--- src/tests/fs/ffs/t_miscquota.sh:1.7	Sun Sep 30 21:26:58 2012
+++ src/tests/fs/ffs/t_miscquota.sh	Tue Jan 22 06:24:11 2013
@@ -1,4 +1,4 @@
-# $NetBSD: t_miscquota.sh,v 1.7 2012/09/30 21:26:58 bouyer Exp $ 
+# $NetBSD: t_miscquota.sh,v 1.8 2013/01/22 06:24:11 dholland Exp $ 
 #
 #  Copyright (c) 2011 Manuel Bouyer
 #  All rights reserved.
@@ -53,10 +53,10 @@ test_case log_unlink_remount quota_log \
 -oRL le 1 user
 
 
-test_case_root defaut_deny_user quota_defaut_deny \
+test_case_root default_deny_user quota_default_deny \
 new quota entry denied by default entry 5 -b le 1 user
 
-test_case_root defaut_deny_user_big quota_defaut_deny \
+test_case_root default_deny_user_big quota_default_deny \
 new quota entry denied by default entry, with list on more than one block 5000 -b le 1 user
 
 
@@ -170,7 +170,7 @@ quota_log()
 	rump_quota_shutdown
 }
 
-quota_defaut_deny()
+quota_default_deny()
 {
 	local nusers=$1; shift
 	create_ffs_server $*



CVS commit: src/tests/fs/ffs

2012-11-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Nov 27 15:59:16 UTC 2012

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
Rename fsbsize2big to fsbsizeovermaxphys to accurately match what it tests.
Additionally, compute failing size dynamically by doubling MAXPHYS instead
of assuming 128K will be too big enough.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.11 src/tests/fs/ffs/t_mount.c:1.12
--- src/tests/fs/ffs/t_mount.c:1.11	Sun Nov  7 17:51:17 2010
+++ src/tests/fs/ffs/t_mount.c	Tue Nov 27 15:59:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.11 2010/11/07 17:51:17 jmmv Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.12 2012/11/27 15:59:15 jakllsch Exp $	*/
 
 /*
  * Basic tests for mounting
@@ -44,8 +44,8 @@ ATF_TC_BODY(48Kimage, tc)
 	FSTEST_DESTRUCTOR(tc, ffs, tmp);
 }
 
-ATF_TC(fsbsize2big);
-ATF_TC_HEAD(fsbsize2big, tc)
+ATF_TC(fsbsizeovermaxphys);
+ATF_TC_HEAD(fsbsizeovermaxphys, tc)
 {
 
 	atf_tc_set_md_var(tc, descr, mounts file system with 
@@ -53,11 +53,7 @@ ATF_TC_HEAD(fsbsize2big, tc)
 	/* PR kern/43727 */
 }
 
-#define MYBLOCKSIZE 131072
-#if MAXPHYS = MYBLOCKSIZE
-#error MAXPHYS too large for test to work
-#endif
-ATF_TC_BODY(fsbsize2big, tc)
+ATF_TC_BODY(fsbsizeovermaxphys, tc)
 {
 	char cmd[1024];
 	struct ufs_args args;
@@ -68,7 +64,7 @@ ATF_TC_BODY(fsbsize2big, tc)
 	 * so do things the oldfashioned manual way.
 	 */
 	snprintf(cmd, sizeof(cmd), newfs -G -b %d -F -s 1 
-	ffs.img  /dev/null, MYBLOCKSIZE);
+	ffs.img  /dev/null, MAXPHYS * 2);
 	if (system(cmd))
 		atf_tc_fail(cannot create file system);
 
@@ -94,7 +90,7 @@ ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, 48Kimage);
-	ATF_TP_ADD_TC(tp, fsbsize2big);
+	ATF_TP_ADD_TC(tp, fsbsizeovermaxphys);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/ffs

2012-11-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Nov 27 16:01:49 UTC 2012

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
Add fsbsizeovermaxbsize test that tests mouting a FS with block size greater
than MAXBSIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.12 src/tests/fs/ffs/t_mount.c:1.13
--- src/tests/fs/ffs/t_mount.c:1.12	Tue Nov 27 15:59:15 2012
+++ src/tests/fs/ffs/t_mount.c	Tue Nov 27 16:01:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.12 2012/11/27 15:59:15 jakllsch Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.13 2012/11/27 16:01:49 jakllsch Exp $	*/
 
 /*
  * Basic tests for mounting
@@ -86,11 +86,53 @@ ATF_TC_BODY(fsbsizeovermaxphys, tc)
 	/* otherwise we're do-ne */
 }
 
+ATF_TC(fsbsizeovermaxbsize);
+ATF_TC_HEAD(fsbsizeovermaxbsize, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, mounts file system with 
+	blocksize  MAXBSIZE);
+}
+
+ATF_TC_BODY(fsbsizeovermaxbsize, tc)
+{
+	char cmd[1024];
+	struct ufs_args args;
+	struct statvfs svb;
+
+	/*
+	 * We cannot pass newfs parameters via the fstest interface,
+	 * so do things the oldfashioned manual way.
+	 */
+	snprintf(cmd, sizeof(cmd), newfs -G -b %d -F -s 1 
+	ffs.img  /dev/null, MAXBSIZE * 2);
+	if (system(cmd))
+		atf_tc_fail(cannot create file system);
+
+	rump_init();
+	if (rump_pub_etfs_register(/devdisk, ffs.img, RUMP_ETFS_BLK))
+		atf_tc_fail(cannot register rump fake device);
+
+	args.fspec = __UNCONST(/devdisk);
+
+	if (rump_sys_mkdir(/mp, 0777) == -1)
+		atf_tc_fail_errno(create mountpoint);
+
+	/* mount succeeded?  bad omen.  confirm we're in trouble.  */
+	if (rump_sys_mount(MOUNT_FFS, /mp, 0, args, sizeof(args)) != -1) {
+		rump_sys_statvfs1(/mp, svb, ST_WAIT);
+		atf_tc_fail(not expecting to be alive);
+	}
+
+	/* otherwise we're do-ne */
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, 48Kimage);
 	ATF_TP_ADD_TC(tp, fsbsizeovermaxphys);
+	ATF_TP_ADD_TC(tp, fsbsizeovermaxbsize);
 
 	return atf_no_error();
 }



CVS commit: src/tests/fs/ffs

2012-08-24 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Fri Aug 24 20:25:50 UTC 2012

Modified Files:
src/tests/fs/ffs: h_ffs_server.c

Log Message:
h_ffs_server.c is not a test program.  Remove unnecessary traces of atf.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/h_ffs_server.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/ffs/h_ffs_server.c
diff -u src/tests/fs/ffs/h_ffs_server.c:1.1 src/tests/fs/ffs/h_ffs_server.c:1.2
--- src/tests/fs/ffs/h_ffs_server.c:1.1	Wed Jan 18 20:51:23 2012
+++ src/tests/fs/ffs/h_ffs_server.c	Fri Aug 24 20:25:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_ffs_server.c,v 1.1 2012/01/18 20:51:23 bouyer Exp $	*/
+/*	$NetBSD: h_ffs_server.c,v 1.2 2012/08/24 20:25:50 jmmv Exp $	*/
 
 /*
  * rump server for advanced quota tests
@@ -19,8 +19,6 @@
 #include rump/rump.h
 #include rump/rump_syscalls.h
 
-#include ../../h_macros.h
-
 int background = 0;
 
 static void
@@ -91,7 +89,7 @@ main(int argc, char **argv)
 		die(rump init failed, error);
 
 	if (rump_sys_mkdir(FSTEST_MNTNAME, 0777) == -1)
-		atf_tc_fail_errno(mount point create);
+		die(mount point create, errno);
 	rump_pub_etfs_register(/diskdev, filename, RUMP_ETFS_BLK);
 	uargs.fspec = __UNCONST(/diskdev);
 	if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, (log) ? MNT_LOG : 0,



CVS commit: src/tests/fs/ffs

2012-02-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Feb 13 17:55:12 UTC 2012

Modified Files:
src/tests/fs/ffs: t_miscquota.sh

Log Message:
Update reference output to match yesterday's fix. ok martin@ for releng


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/ffs/t_miscquota.sh

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/ffs/t_miscquota.sh
diff -u src/tests/fs/ffs/t_miscquota.sh:1.5 src/tests/fs/ffs/t_miscquota.sh:1.6
--- src/tests/fs/ffs/t_miscquota.sh:1.5	Wed Feb  1 05:12:45 2012
+++ src/tests/fs/ffs/t_miscquota.sh	Mon Feb 13 17:55:12 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_miscquota.sh,v 1.5 2012/02/01 05:12:45 dholland Exp $ 
+# $NetBSD: t_miscquota.sh,v 1.6 2012/02/13 17:55:12 dholland Exp $ 
 #
 #  Copyright (c) 2011 Manuel Bouyer
 #  All rights reserved.
@@ -82,7 +82,7 @@ quota_walk_list()
 		i=$((i + 1))
 	done
 	# do a repquota
-	atf_check -s exit:0 -o 'match:user 409600 blocks  *81920 20 0' \
+	atf_check -s exit:0 -o 'match:user 409600 block  *81920 20 0' \
 	env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -x -${expect} /mnt
 	rump_quota_shutdown
 }



CVS commit: src/tests/fs/ffs

2011-03-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 12 13:43:58 UTC 2011

Modified Files:
src/tests/fs/ffs: quotas_common.sh

Log Message:
Add support for multiple rump servers in shutdown and cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/ffs/quotas_common.sh

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/ffs/quotas_common.sh
diff -u src/tests/fs/ffs/quotas_common.sh:1.2 src/tests/fs/ffs/quotas_common.sh:1.3
--- src/tests/fs/ffs/quotas_common.sh:1.2	Sun Mar  6 17:08:40 2011
+++ src/tests/fs/ffs/quotas_common.sh	Sat Mar 12 13:43:58 2011
@@ -1,4 +1,4 @@
-# $NetBSD: quotas_common.sh,v 1.2 2011/03/06 17:08:40 bouyer Exp $ 
+# $NetBSD: quotas_common.sh,v 1.3 2011/03/12 13:43:58 bouyer Exp $ 
 
 create_with_quotas()
 {
@@ -25,7 +25,9 @@
 
 rump_shutdown()
 {
-	atf_check -s exit:0 rump.halt
+	for s in ${RUMP_SOCKETS_LIST}; do
+		atf_check -s exit:0 env RUMP_SERVER=unix://${s} rump.halt;
+	done
 # check that the quota inode creation didn't corrupt the filesystem
 	atf_check -s exit:0 -o match:already clean \
 		-o match:Phase 6 - Check Quotas \
@@ -46,10 +48,15 @@
 		atf_set timeout 60
 	}
 	eval ${name}_body() { \
+		RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \
+		export RUMP_SERVER=unix://\${RUMP_SOCKET}; \
 		${check_function}  ${@} ; \
 	}
 	eval ${name}_cleanup() { \
-		atf_check -s exit:1 -o ignore -e ignore rump.halt; \
+		for s in \${RUMP_SOCKETS_LIST}; do \
+			export RUMP_SERVER=unix://\${s}; \
+			atf_check -s exit:1 -o ignore -e ignore rump.halt; \
+		done; \
 	}
 	tests=${tests} ${name}
 }
@@ -68,10 +75,15 @@
 		atf_set timeout 60
 	}
 	eval ${name}_body() { \
+		RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \
+		export RUMP_SERVER=unix://\${RUMP_SOCKET}; \
 		${check_function}  ${@} ; \
 	}
 	eval ${name}_cleanup() { \
-		atf_check -s exit:1 -o ignore -e ignore rump.halt; \
+		for s in \${RUMP_SOCKETS_LIST}; do \
+			export RUMP_SERVER=unix://\${s}; \
+			atf_check -s exit:1 -o ignore -e ignore rump.halt; \
+		done; \
 	}
 	tests=${tests} ${name}
 }
@@ -80,9 +92,7 @@
 {
 	IMG=fsimage
 	DIR=target
-	RUMP_SOCKET=test
-	RUMP_SERVER=unix://${RUMP_SOCKET}
-	export RUMP_SERVER
+	RUMP_SOCKET=test;
 	for i in ${tests}; do
 		atf_add_test_case $i
 	done



CVS commit: src/tests/fs/ffs

2011-03-09 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Wed Mar  9 20:13:47 UTC 2011

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

Log Message:
Don't descend into non-existing subdirectory clients.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/ffs/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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.15 src/tests/fs/ffs/Makefile:1.16
--- src/tests/fs/ffs/Makefile:1.15	Sun Mar  6 17:08:39 2011
+++ src/tests/fs/ffs/Makefile	Wed Mar  9 20:13:47 2011
@@ -1,10 +1,8 @@
-#	$NetBSD: Makefile,v 1.15 2011/03/06 17:08:39 bouyer Exp $
+#	$NetBSD: Makefile,v 1.16 2011/03/09 20:13:47 tron Exp $
 #
 
 .include bsd.own.mk
 
-SUBDIR=		clients
-
 TESTSDIR=	${TESTSBASE}/fs/ffs
 WARNS=		4
 



CVS commit: src/tests/fs/ffs/clients

2011-03-06 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Mar  7 03:29:26 UTC 2011

Modified Files:
src/tests/fs/ffs/clients: Makefile

Log Message:
Fix link error.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/ffs/clients/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/ffs/clients/Makefile
diff -u src/tests/fs/ffs/clients/Makefile:1.2 src/tests/fs/ffs/clients/Makefile:1.3
--- src/tests/fs/ffs/clients/Makefile:1.2	Sun Mar  6 17:08:41 2011
+++ src/tests/fs/ffs/clients/Makefile	Mon Mar  7 03:29:26 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2011/03/06 17:08:41 bouyer Exp $
+#	$NetBSD: Makefile,v 1.3 2011/03/07 03:29:26 enami Exp $
 #
 
 .include bsd.own.mk
@@ -9,8 +9,9 @@
 PROGS=			rump_quota rump_repquota rump_edquota rump_quotactl
 
 .PATH: ${NETBSDSRCDIR}/usr.bin/quota
-SRCS.rump_quota=	quota.c printquota.c getvfsquota.c quota_rumpops.c 
-SRCS.rump_repquota=	printquota.c quota_rumpops.c
+SRCS.rump_quota=	quota.c printquota.c getvfsquota.c quota_rumpops.c \
+			quotautil.c
+SRCS.rump_repquota=	printquota.c quota_rumpops.c quotautil.c
 SRCS.rump_edquota=	printquota.c getvfsquota.c quota_rumpops.c
 CPPFLAGS.quota.c+=	-I${NETBSDSRCDIR}/usr.bin/quota
 CPPFLAGS.printquota.c+=	-I${NETBSDSRCDIR}/usr.bin/quota
@@ -21,7 +22,7 @@
 CPPFLAGS.repquota.c+=	-I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota
 
 .PATH: ${NETBSDSRCDIR}/usr.sbin/edquota
-SRCS.rump_edquota+=	edquota.c
+SRCS.rump_edquota+=	edquota.c quotautil.c
 CPPFLAGS.edquota.c+=	-I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota
 
 .PATH: ${NETBSDSRCDIR}/usr.sbin/quotactl



CVS commit: src/tests/fs/ffs

2010-11-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Nov 19 12:36:50 UTC 2010

Modified Files:
src/tests/fs/ffs: Makefile
Added Files:
src/tests/fs/ffs: t_snapshot_v2.c

Log Message:
test snapshots on ffsv2 too


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/ffs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_snapshot_v2.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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.13 src/tests/fs/ffs/Makefile:1.14
--- src/tests/fs/ffs/Makefile:1.13	Fri Nov  5 11:32:09 2010
+++ src/tests/fs/ffs/Makefile	Fri Nov 19 12:36:49 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2010/11/05 11:32:09 pooka Exp $
+#	$NetBSD: Makefile,v 1.14 2010/11/19 12:36:49 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -9,6 +9,7 @@
 TESTS_C+=	t_fifos
 TESTS_C+=	t_snapshot
 TESTS_C+=	t_snapshot_log
+TESTS_C+=	t_snapshot_v2
 TESTS_C+=	t_mount
 
 LDADD+=-lrumpfs_ffs		# ffs

Added files:

Index: src/tests/fs/ffs/t_snapshot_v2.c
diff -u /dev/null src/tests/fs/ffs/t_snapshot_v2.c:1.1
--- /dev/null	Fri Nov 19 12:36:50 2010
+++ src/tests/fs/ffs/t_snapshot_v2.c	Fri Nov 19 12:36:49 2010
@@ -0,0 +1,42 @@
+/*	$NetBSD: t_snapshot_v2.c,v 1.1 2010/11/19 12:36:49 pooka Exp $	*/
+
+#include sys/types.h
+#include sys/mount.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ufs/ufs/ufsmount.h
+
+#include atf-c.h
+#include fcntl.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ../../h_macros.h
+
+#define IMGNAME ffs.img
+#define NEWFS newfs -F -s 1 -O 2  IMGNAME
+#define BAKNAME /mnt/le_snapp
+
+static void
+mount_diskfs(const char *fspec, const char *path)
+{
+	struct ufs_args uargs;
+
+	uargs.fspec = __UNCONST(fspec);
+
+	if (rump_sys_mount(MOUNT_FFS, path, 0, uargs, sizeof(uargs)) == -1)
+		atf_tc_fail_errno(mount ffs %s, path);
+}
+
+static void
+begin(void)
+{
+
+	/* empty */
+}
+
+#include ../common/snapshot.c



CVS commit: src/tests/fs/ffs

2010-11-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Nov  5 11:32:09 UTC 2010

Modified Files:
src/tests/fs/ffs: Makefile
Added Files:
src/tests/fs/ffs: t_snapshot_log.c

Log Message:
test fss with underlying fs mounted with MNT_LOG


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/ffs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_snapshot_log.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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.12 src/tests/fs/ffs/Makefile:1.13
--- src/tests/fs/ffs/Makefile:1.12	Thu Sep 23 09:39:14 2010
+++ src/tests/fs/ffs/Makefile	Fri Nov  5 11:32:09 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2010/09/23 09:39:14 he Exp $
+#	$NetBSD: Makefile,v 1.13 2010/11/05 11:32:09 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -8,6 +8,7 @@
 
 TESTS_C+=	t_fifos
 TESTS_C+=	t_snapshot
+TESTS_C+=	t_snapshot_log
 TESTS_C+=	t_mount
 
 LDADD+=-lrumpfs_ffs		# ffs

Added files:

Index: src/tests/fs/ffs/t_snapshot_log.c
diff -u /dev/null src/tests/fs/ffs/t_snapshot_log.c:1.1
--- /dev/null	Fri Nov  5 11:32:09 2010
+++ src/tests/fs/ffs/t_snapshot_log.c	Fri Nov  5 11:32:09 2010
@@ -0,0 +1,45 @@
+/*	$NetBSD: t_snapshot_log.c,v 1.1 2010/11/05 11:32:09 pooka Exp $	*/
+
+#include sys/types.h
+#include sys/mount.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ufs/ufs/ufsmount.h
+
+#include atf-c.h
+#include fcntl.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ../../h_macros.h
+
+#define IMGNAME ffs.img
+#define NEWFS newfs -F -s 1  IMGNAME
+#define BAKNAME /mnt/le_snapp
+
+static void
+mount_diskfs(const char *fspec, const char *path)
+{
+	struct ufs_args uargs;
+	static int flags = MNT_LOG;
+
+	uargs.fspec = __UNCONST(fspec);
+
+	if (rump_sys_mount(MOUNT_FFS,
+	path, flags, uargs, sizeof(uargs)) == -1)
+		atf_tc_fail_errno(mount ffs %s, path);
+	flags = 0;
+}
+
+static void
+begin(void)
+{
+
+	/* empty */
+}
+
+#include ../common/snapshot.c



CVS commit: src/tests/fs/ffs

2010-08-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  9 17:42:26 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
Check that mounting a file system with blocksize  MAXPHYS returns an error.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.7 src/tests/fs/ffs/t_mount.c:1.8
--- src/tests/fs/ffs/t_mount.c:1.7	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Aug  9 17:42:26 2010
@@ -1,6 +1,11 @@
-/*	$NetBSD: t_mount.c,v 1.7 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.8 2010/08/09 17:42:26 pooka Exp $	*/
 
 /*
+ * Basic tests for mounting
+ */
+
+/*
+ * 48Kimage:
  * Adapted for rump and atf from a testcase supplied
  * by Hubert Feyrer on netbsd-users@
  */
@@ -14,6 +19,18 @@
 
 #include ../common/h_fsmacros.h
 
+#include sys/types.h
+#include sys/mount.h
+
+#include stdlib.h
+
+#include ufs/ufs/ufsmount.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ../../h_macros.h
+
 ATF_TC(48Kimage);
 ATF_TC_HEAD(48Kimage, tc)
 {
@@ -41,8 +58,53 @@
 		atf_tc_fail(delfs failed);
 }
 
+ATF_TC(fsbsize2big);
+ATF_TC_HEAD(fsbsize2big, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, mounts file system with 
+	blocksize  MAXPHYS);
+	atf_tc_set_md_var(tc, use.fs, true);
+	/* PR kern/43727 */
+}
+
+#define MYBLOCKSIZE 131072
+#if MAXPHYS = MYBLOCKSIZE
+#error MAXPHYS too large for test to work
+#endif
+ATF_TC_BODY(fsbsize2big, tc)
+{
+	char cmd[1024];
+	struct ufs_args args;
+	struct statvfs svb;
+
+	snprintf(cmd, sizeof(cmd), newfs -G -b %d -F -s 1 
+	ffs.img  /dev/null, MYBLOCKSIZE);
+	if (system(cmd))
+		atf_tc_fail(cannot create file system);
+
+	rump_init();
+	if (rump_pub_etfs_register(/devdisk, ffs.img, RUMP_ETFS_BLK))
+		atf_tc_fail(cannot register rump fake device);
+
+	args.fspec = __UNCONST(/devdisk);
+
+	if (rump_sys_mkdir(/mp, 0777) == -1)
+		atf_tc_fail_errno(create mountpoint);
+
+	/* mount succeeded?  bad omen.  confirm we're in trouble.  */
+	if (rump_sys_mount(MOUNT_FFS, /mp, 0, args, sizeof(args)) != -1) {
+		rump_sys_statvfs1(/mp, svb, ST_WAIT);
+	}
+
+	/* otherwise we're do-ne */
+}
+
 ATF_TP_ADD_TCS(tp)
 {
+
 	ATF_TP_ADD_TC(tp, 48Kimage);
+	ATF_TP_ADD_TC(tp, fsbsize2big);
+
 	return atf_no_error();
 }



CVS commit: src/tests/fs/ffs

2010-08-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  9 19:34:59 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
* convert 48k fs image test to FSTEST_CON/DESTRO
* make sure hugeblocksize doesn't accidentally succeed


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.8 src/tests/fs/ffs/t_mount.c:1.9
--- src/tests/fs/ffs/t_mount.c:1.8	Mon Aug  9 17:42:26 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Aug  9 19:34:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.8 2010/08/09 17:42:26 pooka Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.9 2010/08/09 19:34:59 pooka Exp $	*/
 
 /*
  * Basic tests for mounting
@@ -12,11 +12,7 @@
 
 #include atf-c.h
 
-#define IMGNAME image.ffs
-#define IMGSIZE (96 * 512)
-
-#define MNTDIR  /mnt
-
+#define FSTEST_IMGSIZE (96 * 512)
 #include ../common/h_fsmacros.h
 
 #include sys/types.h
@@ -42,20 +38,11 @@
 {
 	void *tmp;
 
-	if (ffs_fstest_newfs(tc, tmp, IMGNAME, IMGSIZE, NULL) != 0)
-		atf_tc_fail(newfs failed);
-
 	atf_tc_expect_fail(PR kern/43573);
-	if (ffs_fstest_mount(tc, tmp, MNTDIR, 0) != 0) {
-		atf_tc_fail(mount failed);
-	}
+	FSTEST_CONSTRUCTOR(tc, ffs, tmp);
 	atf_tc_expect_pass();
 
-	if (ffs_fstest_unmount(tc, MNTDIR, 0) != 0)
-		atf_tc_fail(unmount failed);
-
-	if (ffs_fstest_delfs(tc, tmp) != 0)
-		atf_tc_fail(delfs failed);
+	FSTEST_DESTRUCTOR(tc, ffs, tmp);
 }
 
 ATF_TC(fsbsize2big);
@@ -95,6 +82,7 @@
 	/* mount succeeded?  bad omen.  confirm we're in trouble.  */
 	if (rump_sys_mount(MOUNT_FFS, /mp, 0, args, sizeof(args)) != -1) {
 		rump_sys_statvfs1(/mp, svb, ST_WAIT);
+		atf_tc_fail(not expecting to be alive);
 	}
 
 	/* otherwise we're do-ne */



CVS commit: src/tests/fs/ffs

2010-08-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  9 19:36:30 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
add comment saying why the other test doesn't use fstest


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.9 src/tests/fs/ffs/t_mount.c:1.10
--- src/tests/fs/ffs/t_mount.c:1.9	Mon Aug  9 19:34:59 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Aug  9 19:36:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.9 2010/08/09 19:34:59 pooka Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.10 2010/08/09 19:36:30 pooka Exp $	*/
 
 /*
  * Basic tests for mounting
@@ -65,6 +65,10 @@
 	struct ufs_args args;
 	struct statvfs svb;
 
+	/*
+	 * We cannot pass newfs parameters via the fstest interface,
+	 * so do things the oldfashioned manual way.
+	 */
 	snprintf(cmd, sizeof(cmd), newfs -G -b %d -F -s 1 
 	ffs.img  /dev/null, MYBLOCKSIZE);
 	if (system(cmd))



CVS commit: src/tests/fs/ffs

2010-07-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 19 16:22:05 UTC 2010

Modified Files:
src/tests/fs/ffs: Makefile t_mount.c

Log Message:
Include h_fsmacros instead of ffs.c and link in test lib.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/ffs/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/ffs/t_mount.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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.9 src/tests/fs/ffs/Makefile:1.10
--- src/tests/fs/ffs/Makefile:1.9	Wed Jul 14 21:39:31 2010
+++ src/tests/fs/ffs/Makefile	Mon Jul 19 16:22:05 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2010/07/14 21:39:31 pooka Exp $
+#	$NetBSD: Makefile,v 1.10 2010/07/19 16:22:05 pooka Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/ffs
@@ -14,4 +14,7 @@
 LDADD+=-lrumpvfs_fifofs -lrumpnet_local -lrumpnet_net -lrumpnet	# fifos
 LDADD+=-lrumpvfs -lrump -lrumpuser -lpthread			# base
 
+LDFLAGS+=-L${.CURDIR}/../common
+LDADD+=-lvfstest
+
 .include bsd.test.mk

Index: src/tests/fs/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.5 src/tests/fs/ffs/t_mount.c:1.6
--- src/tests/fs/ffs/t_mount.c:1.5	Tue Jul 13 15:50:31 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Jul 19 16:22:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.5 2010/07/13 15:50:31 njoly Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.6 2010/07/19 16:22:05 pooka Exp $	*/
 
 /*
  * Adapted for rump and atf from a testcase supplied
@@ -7,13 +7,13 @@
 
 #include atf-c.h
 
-#include ../common/ffs.c
-
 #define IMGNAME image.ffs
 #define IMGSIZE (96 * 512)
 
 #define MNTDIR  /mnt
 
+#include ../common/h_fsmacros.h
+
 ATF_TC(48Kimage);
 ATF_TC_HEAD(48Kimage, tc)
 {



CVS commit: src/tests/fs/ffs

2010-07-12 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Jul 13 01:42:22 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
Make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.3 src/tests/fs/ffs/t_mount.c:1.4
--- src/tests/fs/ffs/t_mount.c:1.3	Mon Jul  5 17:12:48 2010
+++ src/tests/fs/ffs/t_mount.c	Tue Jul 13 01:42:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.3 2010/07/05 17:12:48 pooka Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.4 2010/07/13 01:42:21 enami Exp $	*/
 
 /*
  * Adapted for rump and atf from a testcase supplied
@@ -25,19 +25,19 @@
 {
 	void *tmp;
 
-	if (ffs_newfs(tmp, IMGNAME, IMGSIZE) != 0)
+	if (ffs_fstest_newfs(tmp, IMGNAME, IMGSIZE) != 0)
 		atf_tc_fail(newfs failed);
 
 	atf_tc_expect_fail(PR kern/43573);
-	if (ffs_mount(tmp, MNTDIR, 0) != 0) {
+	if (ffs_fstest_mount(tmp, MNTDIR, 0) != 0) {
 		atf_tc_fail(mount failed);
 	}
 	atf_tc_expect_pass();
 
-	if (ffs_unmount(MNTDIR, 0) != 0)
+	if (ffs_fstest_unmount(MNTDIR, 0) != 0)
 		atf_tc_fail(unmount failed);
 
-	if (ffs_delfs(tmp) != 0)
+	if (ffs_fstest_delfs(tmp) != 0)
 		atf_tc_fail(delfs failed);
 }
 



CVS commit: src/tests/fs/ffs

2010-07-05 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Mon Jul  5 16:34:41 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
Use expect_fail instead of defining xfail.  Looks like I missed this one
during the import of atf 0.10.  Thanks po...@.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.1 src/tests/fs/ffs/t_mount.c:1.2
--- src/tests/fs/ffs/t_mount.c:1.1	Wed Jun 30 21:54:56 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Jul  5 16:34:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.1 2010/06/30 21:54:56 njoly Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.2 2010/07/05 16:34:41 jmmv Exp $	*/
 
 /*
  * Adapted for rump and atf from a testcase supplied
@@ -19,7 +19,6 @@
 {
 	atf_tc_set_md_var(tc, descr, mount small 48K ffs image);
 	atf_tc_set_md_var(tc, use.fs, true);
-	atf_tc_set_md_var(tc, xfail, No PR yet);
 }
 
 ATF_TC_BODY(48Kimage, tc)
@@ -29,8 +28,11 @@
 	if (ffs_newfs(tmp, IMGNAME, IMGSIZE) != 0)
 		atf_tc_fail(newfs failed);
 
-	if (ffs_mount(tmp, MNTDIR, 0) != 0)
+	if (ffs_mount(tmp, MNTDIR, 0) != 0) {
+		atf_tc_expect_fail(No PR yet);
 		atf_tc_fail(mount failed);
+		atf_tc_expect_pass();
+	}
 	if (ffs_unmount(MNTDIR, 0) != 0)
 		atf_tc_fail(unmount failed);
 



CVS commit: src/tests/fs/ffs

2010-07-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul  5 17:12:49 UTC 2010

Modified Files:
src/tests/fs/ffs: t_mount.c

Log Message:
* fill PR number to xfail now that we have one -- let's try not
  to add any xfail tests without an associated PR
* move xfail to the correct place


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/ffs/t_mount.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/ffs/t_mount.c
diff -u src/tests/fs/ffs/t_mount.c:1.2 src/tests/fs/ffs/t_mount.c:1.3
--- src/tests/fs/ffs/t_mount.c:1.2	Mon Jul  5 16:34:41 2010
+++ src/tests/fs/ffs/t_mount.c	Mon Jul  5 17:12:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mount.c,v 1.2 2010/07/05 16:34:41 jmmv Exp $	*/
+/*	$NetBSD: t_mount.c,v 1.3 2010/07/05 17:12:48 pooka Exp $	*/
 
 /*
  * Adapted for rump and atf from a testcase supplied
@@ -28,11 +28,12 @@
 	if (ffs_newfs(tmp, IMGNAME, IMGSIZE) != 0)
 		atf_tc_fail(newfs failed);
 
+	atf_tc_expect_fail(PR kern/43573);
 	if (ffs_mount(tmp, MNTDIR, 0) != 0) {
-		atf_tc_expect_fail(No PR yet);
 		atf_tc_fail(mount failed);
-		atf_tc_expect_pass();
 	}
+	atf_tc_expect_pass();
+
 	if (ffs_unmount(MNTDIR, 0) != 0)
 		atf_tc_fail(unmount failed);
 



CVS commit: src/tests/fs/ffs

2010-06-30 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jun 30 16:37:12 UTC 2010

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

Log Message:
qemu has been fixed, so remove timeout
(not that it helped in the first place ...)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.11 src/tests/fs/ffs/t_renamerace.c:1.12
--- src/tests/fs/ffs/t_renamerace.c:1.11	Fri Jun  4 08:39:40 2010
+++ src/tests/fs/ffs/t_renamerace.c	Wed Jun 30 16:37:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.11 2010/06/04 08:39:40 jmmv Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.12 2010/06/30 16:37:12 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -30,8 +30,6 @@
 {
 	atf_tc_set_md_var(tc, descr, rename(2) race against files 
 	unlinked mid-operation, kern/40948);
-	/* XXX: test hangs in qemu for unknown reasons */
-	atf_tc_set_md_var(tc, timeout, 20);
 	atf_tc_set_md_var(tc, use.fs, true);
 }
 
@@ -132,5 +130,6 @@
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, renamerace);
-	return 0; /* ??? */
+
+	return atf_no_error();
 }



CVS commit: src/tests/fs/ffs

2010-05-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun May 30 05:35:49 UTC 2010

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

Log Message:
Use PATH_MAX instead of MAXPATHLEN and include limits.h.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.9 src/tests/fs/ffs/t_renamerace.c:1.10
--- src/tests/fs/ffs/t_renamerace.c:1.9	Wed Oct 14 18:22:50 2009
+++ src/tests/fs/ffs/t_renamerace.c	Sun May 30 05:35:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.9 2009/10/14 18:22:50 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.10 2010/05/30 05:35:48 dholland Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -11,6 +11,7 @@
 #include atf-c.h
 #include errno.h
 #include fcntl.h
+#include limits.h
 #include pthread.h
 #include stdio.h
 #include stdlib.h
@@ -61,7 +62,7 @@
 
 /* XXX: how to do cleanup if we use mkdtemp? */
 #define IMAGENAME /tmp/ffsatf.img
-static char image[MAXPATHLEN];
+static char image[PATH_MAX];
 
 #define FAKEBLK /dev/sp00ka
 



CVS commit: src/tests/fs/ffs

2010-05-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat May  1 10:46:29 UTC 2010

Modified Files:
src/tests/fs/ffs: t_fifos.c

Log Message:
fix !USE_ATF


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/t_fifos.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/ffs/t_fifos.c
diff -u src/tests/fs/ffs/t_fifos.c:1.1 src/tests/fs/ffs/t_fifos.c:1.2
--- src/tests/fs/ffs/t_fifos.c:1.1	Mon Mar 29 13:26:32 2010
+++ src/tests/fs/ffs/t_fifos.c	Sat May  1 10:46:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fifos.c,v 1.1 2010/03/29 13:26:32 pooka Exp $	*/
+/*	$NetBSD: t_fifos.c,v 1.2 2010/05/01 10:46:29 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -32,7 +32,7 @@
 #else
 #include err.h
 #define atf_tc_fail_errno(a) err(1, a)
-#define atf_tc_fail(a, ...) err(1, a)
+#define atf_tc_fail(...) err(1, __VA_ARGS__)
 #endif
 
 #define teststr1 raving  drooling



CVS commit: src/tests/fs/ffs

2010-04-12 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Apr 12 22:58:53 UTC 2010

Modified Files:
src/tests/fs/ffs: Makefile
Added Files:
src/tests/fs/ffs: t_snapshot.c

Log Message:
test for the very basic snapshot features


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/ffs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_snapshot.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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.6 src/tests/fs/ffs/Makefile:1.7
--- src/tests/fs/ffs/Makefile:1.6	Mon Mar 29 13:26:32 2010
+++ src/tests/fs/ffs/Makefile	Mon Apr 12 22:58:53 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2010/03/29 13:26:32 pooka Exp $
+#	$NetBSD: Makefile,v 1.7 2010/04/12 22:58:53 pooka Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/ffs
@@ -6,8 +6,10 @@
 
 TESTS_C=	t_renamerace
 TESTS_C+=	t_fifos
+TESTS_C+=	t_snapshot
 
 LDADD+=-lrumpfs_ffs		# ffs
+LDADD+=-lrumpdev_fss		# snapshot dev
 LDADD+=-lrumpdev_disk -lrumpdev	# disk device
 LDADD+=-lrumpvfs_fifofs -lrumpnet_local -lrumpnet_net -lrumpnet	# fifos
 LDADD+=-lrumpvfs -lrump -lrumpuser -lpthread			# base

Added files:

Index: src/tests/fs/ffs/t_snapshot.c
diff -u /dev/null src/tests/fs/ffs/t_snapshot.c:1.1
--- /dev/null	Mon Apr 12 22:58:53 2010
+++ src/tests/fs/ffs/t_snapshot.c	Mon Apr 12 22:58:53 2010
@@ -0,0 +1,136 @@
+/*	$NetBSD: t_snapshot.c,v 1.1 2010/04/12 22:58:53 pooka Exp $	*/
+
+#include sys/types.h
+#include sys/ioctl.h
+#include sys/mount.h
+
+#include dev/fssvar.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ufs/ufs/ufsmount.h
+
+#include atf-c.h
+#include fcntl.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ../../h_macros.h
+
+#define IMGNAME ffs.img
+#define NEWFS newfs -F -s 1  IMGNAME
+#define BAKNAME /mnt/bak.img
+
+ATF_TC_WITH_CLEANUP(snapshot);
+ATF_TC_HEAD(snapshot, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, basic snapshot features);
+}
+
+static void
+makefile(const char *path)
+{
+	int fd;
+
+	fd = rump_sys_open(path, O_CREAT | O_RDWR, 0777);
+	if (fd == -1)
+		atf_tc_fail_errno(create %s, path);
+	rump_sys_close(fd);
+}
+
+ATF_TC_BODY(snapshot, tc)
+{
+	char buf[1024];
+	struct ufs_args uargs;
+	struct fss_set fss;
+	int fssfd;
+	int fd, fd2;
+
+	if (system(NEWFS) == -1)
+		atf_tc_fail_errno(cannot create file system);
+
+	rump_init();
+
+	if (rump_sys_mkdir(/mnt, 0777) == -1)
+		atf_tc_fail_errno(mount point create);
+	if (rump_sys_mkdir(/snap, 0777) == -1)
+		atf_tc_fail_errno(mount point 2 create);
+
+	rump_pub_etfs_register(./ffs.img, ./ffs.img, RUMP_ETFS_BLK);
+
+	uargs.fspec = __UNCONST(./ffs.img);
+
+	if (rump_sys_mount(MOUNT_FFS, /mnt, 0, uargs, sizeof(uargs)) == -1)
+		atf_tc_fail_errno(mount ffs);
+
+#define TESTSTR1 huihai\n
+#define TESTSZ1 (sizeof(TESTSTR1)-1)
+#define TESTSTR2 baana liten\n
+#define TESTSZ2 (sizeof(TESTSTR2)-1)
+
+	fd = rump_sys_open(/mnt/myfile, O_RDWR | O_CREAT, 0777);
+	if (fd == -1)
+		atf_tc_fail_errno(create file);
+	if (rump_sys_write(fd, TESTSTR1, TESTSZ1) != TESTSZ1)
+		atf_tc_fail_errno(write fail);
+
+	fssfd = rump_sys_open(/dev/rfss0, O_RDWR);
+	if (fd == -1)
+		atf_tc_fail_errno(cannot open fss);
+	makefile(BAKNAME);
+	memset(fss, 0, sizeof(fss));
+	fss.fss_mount = __UNCONST(/mnt);
+	fss.fss_bstore = __UNCONST(BAKNAME);
+	fss.fss_csize = 0;
+	if (rump_sys_ioctl(fssfd, FSSIOCSET, fss) == -1)
+		atf_tc_fail_errno(create snapshot);
+
+	if (rump_sys_pwrite(fd, TESTSTR2, TESTSZ2, 0) != TESTSZ2)
+		atf_tc_fail_errno(write fail);
+	rump_sys_sync();
+
+	uargs.fspec = __UNCONST(/dev/fss0);
+
+	/* technically we should fsck it first? */
+	if (rump_sys_mount(MOUNT_FFS, /snap, 0, uargs, sizeof(uargs)) == -1)
+		atf_tc_fail_errno(mount snapshot);
+
+	/* check for old contents */
+	fd2 = rump_sys_open(/snap/myfile, O_RDONLY);
+	if (fd2 == -1)
+		atf_tc_fail_errno(fail);
+	memset(buf, 0, sizeof(buf));
+	if (rump_sys_read(fd2, buf, sizeof(buf)) == -1)
+		atf_tc_fail_errno(read snap);
+
+	/* check that new files are invisible in the snapshot */
+	makefile(/mnt/newfile);
+	if (rump_sys_open(/snap/newfile, O_RDONLY) != -1)
+		atf_tc_fail(newfile exists in snapshot);
+	if (errno != ENOENT)
+		atf_tc_fail_errno(newfile open should fail with ENOENT);
+
+	/* check that removed files are still visible in the snapshot */
+	rump_sys_unlink(/mnt/myfile);
+
+	if (rump_sys_open(/snap/myfile, O_RDONLY) == -1)
+		atf_tc_fail_errno(unlinked file no longer in snapshot);
+
+	ATF_CHECK(strcmp(buf, TESTSTR1) == 0);
+}
+
+ATF_TC_CLEANUP(snapshot, tc)
+{
+
+	unlink(IMGNAME);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+	ATF_TP_ADD_TC(tp, snapshot);
+	return 0;
+}



CVS commit: src/tests/fs/ffs

2010-04-12 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Apr 12 23:15:24 UTC 2010

Modified Files:
src/tests/fs/ffs: t_snapshot.c

Log Message:
move check next to operation


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/t_snapshot.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/ffs/t_snapshot.c
diff -u src/tests/fs/ffs/t_snapshot.c:1.1 src/tests/fs/ffs/t_snapshot.c:1.2
--- src/tests/fs/ffs/t_snapshot.c:1.1	Mon Apr 12 22:58:53 2010
+++ src/tests/fs/ffs/t_snapshot.c	Mon Apr 12 23:15:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_snapshot.c,v 1.1 2010/04/12 22:58:53 pooka Exp $	*/
+/*	$NetBSD: t_snapshot.c,v 1.2 2010/04/12 23:15:24 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/ioctl.h
@@ -106,6 +106,7 @@
 	memset(buf, 0, sizeof(buf));
 	if (rump_sys_read(fd2, buf, sizeof(buf)) == -1)
 		atf_tc_fail_errno(read snap);
+	ATF_CHECK(strcmp(buf, TESTSTR1) == 0);
 
 	/* check that new files are invisible in the snapshot */
 	makefile(/mnt/newfile);
@@ -116,11 +117,10 @@
 
 	/* check that removed files are still visible in the snapshot */
 	rump_sys_unlink(/mnt/myfile);
-
 	if (rump_sys_open(/snap/myfile, O_RDONLY) == -1)
 		atf_tc_fail_errno(unlinked file no longer in snapshot);
 
-	ATF_CHECK(strcmp(buf, TESTSTR1) == 0);
+	/* done for now */
 }
 
 ATF_TC_CLEANUP(snapshot, tc)



CVS commit: src/tests/fs/ffs

2010-03-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Mar 29 13:26:32 UTC 2010

Modified Files:
src/tests/fs/ffs: Atffile Makefile
Added Files:
src/tests/fs/ffs: t_fifos.c

Log Message:
regression test for fifos on ffs

XXX: same test apart for mount/unmount could be used on other
fifo-supporting file systems (r/w support required, though).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/Atffile
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/ffs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/t_fifos.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/ffs/Atffile
diff -u src/tests/fs/ffs/Atffile:1.1 src/tests/fs/ffs/Atffile:1.2
--- src/tests/fs/ffs/Atffile:1.1	Wed Apr  8 12:08:17 2009
+++ src/tests/fs/ffs/Atffile	Mon Mar 29 13:26:32 2010
@@ -1,6 +1,6 @@
 Content-Type: application/X-atf-atffile; version=1
-X-NetBSD-Id: $NetBSD: Atffile,v 1.1 2009/04/08 12:08:17 pooka Exp $
+X-NetBSD-Id: $NetBSD: Atffile,v 1.2 2010/03/29 13:26:32 pooka Exp $
 
 prop: test-suite = NetBSD
 
-tp: t_renamerace
+tp: t_*

Index: src/tests/fs/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.5 src/tests/fs/ffs/Makefile:1.6
--- src/tests/fs/ffs/Makefile:1.5	Sun Jan 31 14:30:22 2010
+++ src/tests/fs/ffs/Makefile	Mon Mar 29 13:26:32 2010
@@ -1,11 +1,15 @@
-#	$NetBSD: Makefile,v 1.5 2010/01/31 14:30:22 mlelstv Exp $
+#	$NetBSD: Makefile,v 1.6 2010/03/29 13:26:32 pooka Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/ffs
 WARNS=		4
 
 TESTS_C=	t_renamerace
+TESTS_C+=	t_fifos
 
-LDADD+=	-lrumpfs_ffs -lrumpdev_disk -lrumpdev -lrumpvfs -lrump -lrumpuser -lpthread
+LDADD+=-lrumpfs_ffs		# ffs
+LDADD+=-lrumpdev_disk -lrumpdev	# disk device
+LDADD+=-lrumpvfs_fifofs -lrumpnet_local -lrumpnet_net -lrumpnet	# fifos
+LDADD+=-lrumpvfs -lrump -lrumpuser -lpthread			# base
 
 .include bsd.test.mk

Added files:

Index: src/tests/fs/ffs/t_fifos.c
diff -u /dev/null src/tests/fs/ffs/t_fifos.c:1.1
--- /dev/null	Mon Mar 29 13:26:32 2010
+++ src/tests/fs/ffs/t_fifos.c	Mon Mar 29 13:26:32 2010
@@ -0,0 +1,173 @@
+/*	$NetBSD: t_fifos.c,v 1.1 2010/03/29 13:26:32 pooka Exp $	*/
+
+#include sys/types.h
+#include sys/mount.h
+
+#include atf-c.h
+#include errno.h
+#include fcntl.h
+#include pthread.h
+#include stdio.h
+#include stdlib.h
+#include unistd.h
+#include string.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ufs/ufs/ufsmount.h
+
+/* for debugging */
+#define USE_ATF
+
+#ifdef USE_ATF
+#include ../../h_macros.h
+
+ATF_TC_WITH_CLEANUP(fifos);
+ATF_TC_HEAD(fifos, tc)
+{
+	atf_tc_set_md_var(tc, descr, test fifo support in ffs);
+	atf_tc_set_md_var(tc, timeout, 5);
+}
+#else
+#include err.h
+#define atf_tc_fail_errno(a) err(1, a)
+#define atf_tc_fail(a, ...) err(1, a)
+#endif
+
+#define teststr1 raving  drooling
+#define teststr2 haha, charade
+
+static void *
+w1(void *arg)
+{
+	int fd;
+
+	fd = rump_sys_open(sheep, O_WRONLY);
+	if (fd == -1)
+		atf_tc_fail_errno(w1 open);
+	if (rump_sys_write(fd, teststr1, sizeof(teststr1)) != sizeof(teststr1))
+		atf_tc_fail_errno(w1 write);
+	rump_sys_close(fd);
+
+	return NULL;
+}
+
+static void *
+w2(void *arg)
+{
+	int fd;
+
+	fd = rump_sys_open(pigs, O_WRONLY);
+	if (fd == -1)
+		atf_tc_fail_errno(w2 open);
+	if (rump_sys_write(fd, teststr2, sizeof(teststr2)) != sizeof(teststr2))
+		atf_tc_fail_errno(w2 write);
+	rump_sys_close(fd);
+
+	return NULL;
+}
+
+static void *
+r1(void *arg)
+{
+	char buf[32];
+	int fd;
+
+	fd = rump_sys_open(sheep, O_RDONLY);
+	if (fd == -1)
+		atf_tc_fail_errno(r1 open);
+	if (rump_sys_read(fd, buf, sizeof(buf)) != sizeof(teststr1))
+		atf_tc_fail_errno(r1 read);
+	rump_sys_close(fd);
+
+	if (strcmp(teststr1, buf) != 0)
+		atf_tc_fail(got invalid str, %s vs. %s, buf, teststr1);
+
+	return NULL;
+}
+
+static void *
+r2(void *arg)
+{
+	char buf[32];
+	int fd;
+
+	fd = rump_sys_open(pigs, O_RDONLY);
+	if (fd == -1)
+		atf_tc_fail_errno(r2 open);
+	if (rump_sys_read(fd, buf, sizeof(buf)) != sizeof(teststr2))
+		atf_tc_fail_errno(r2 read);
+	rump_sys_close(fd);
+
+	if (strcmp(teststr2, buf) != 0)
+		atf_tc_fail(got invalid str, %s vs. %s, buf, teststr2);
+
+	return NULL;
+}
+
+#define IMGNAME atf.img
+
+const char *newfs = newfs -F -s 1  IMGNAME;
+#define FAKEBLK /dev/sp00ka
+
+#ifdef USE_ATF
+ATF_TC_BODY(fifos, tc)
+#else
+int main(int argc, char *argv[])
+#endif
+{
+	struct ufs_args args;
+	pthread_t ptw1, ptw2, ptr1, ptr2;
+
+	if (system(newfs) == -1)
+		atf_tc_fail_errno(newfs failed);
+
+	memset(args, 0, sizeof(args));
+	args.fspec = __UNCONST(FAKEBLK);
+
+	rump_init();
+	if (rump_sys_mkdir(/animals, 0777) == -1)
+		atf_tc_fail_errno(cannot create mountpoint);
+	rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
+	if (rump_sys_mount(MOUNT_FFS, /animals, 0, args, sizeof(args))==-1)
+		atf_tc_fail_errno(rump_sys_mount failed);
+
+	/* create fifos */
+	if (rump_sys_chdir(/animals) == 1)
+		atf_tc_fail_errno(chdir);
+	if 

CVS commit: src/tests/fs/ffs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 14:30:22 UTC 2010

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

Log Message:
filesystems now use getdisksize() which is in librumpdev_disk.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/ffs/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/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.4 src/tests/fs/ffs/Makefile:1.5
--- src/tests/fs/ffs/Makefile:1.4	Sat May  2 01:15:54 2009
+++ src/tests/fs/ffs/Makefile	Sun Jan 31 14:30:22 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2009/05/02 01:15:54 pooka Exp $
+#	$NetBSD: Makefile,v 1.5 2010/01/31 14:30:22 mlelstv Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/ffs
@@ -6,6 +6,6 @@
 
 TESTS_C=	t_renamerace
 
-LDADD+=	-lrumpfs_ffs -lrumpvfs -lrump -lrumpuser -lpthread
+LDADD+=	-lrumpfs_ffs -lrumpdev_disk -lrumpdev -lrumpvfs -lrump -lrumpuser -lpthread
 
 .include bsd.test.mk



CVS commit: src/tests/fs/ffs

2009-09-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Sep 17 13:12:51 UTC 2009

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

Log Message:
Set timeout to 20 because for some reason this test hangs in qemu.
(Well, it *still* hangs even after the timeout has passed, but at
least there's multiple problems to debug now)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.7 src/tests/fs/ffs/t_renamerace.c:1.8
--- src/tests/fs/ffs/t_renamerace.c:1.7	Mon Aug  3 14:25:24 2009
+++ src/tests/fs/ffs/t_renamerace.c	Thu Sep 17 13:12:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.7 2009/08/03 14:25:24 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.8 2009/09/17 13:12:51 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -29,9 +29,11 @@
 {
 	atf_tc_set_md_var(tc, descr, rename(2) race against files 
 	unlinked mid-operation, kern/40948);
+	/* XXX: test hangs in qemu for unknown reasons */
+	atf_tc_set_md_var(tc, timeout, 20);
 }
 
-int quit;
+volatile int quit;
 
 static void *
 w1(void *arg)



CVS commit: src/tests/fs/ffs

2009-08-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  3 14:25:24 UTC 2009

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

Log Message:
rump_fakeblk - rump_etfs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.6 src/tests/fs/ffs/t_renamerace.c:1.7
--- src/tests/fs/ffs/t_renamerace.c:1.6	Sun May  3 12:10:00 2009
+++ src/tests/fs/ffs/t_renamerace.c	Mon Aug  3 14:25:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.6 2009/05/03 12:10:00 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.7 2009/08/03 14:25:24 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -61,6 +61,8 @@
 #define IMAGENAME /tmp/ffsatf.img
 static char image[MAXPATHLEN];
 
+#define FAKEBLK /dev/sp00ka
+
 ATF_TC_BODY(renamerace, tc)
 {
 	struct ufs_args args;
@@ -83,12 +85,12 @@
 		atf_tc_fail_errno(newfs failed);
 
 	memset(args, 0, sizeof(args));
-	args.fspec = image;
+	args.fspec = __UNCONST(FAKEBLK);
 
 	rump_init();
 	if (rump_sys_mkdir(/mp, 0777) == -1)
 		atf_tc_fail_errno(cannot create mountpoint);
-	rump_fakeblk_register(image);
+	rump_etfs_register(FAKEBLK, image, RUMP_ETFS_BLK);
 	if (rump_sys_mount(MOUNT_FFS, /mp, MNT_LOG, args, sizeof(args))==-1)
 		atf_tc_fail_errno(rump_sys_mount failed);
 



CVS commit: src/tests/fs/ffs

2009-04-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 29 15:46:01 UTC 2009

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

Log Message:
* register fakeblk
* fix error message


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.4 src/tests/fs/ffs/t_renamerace.c:1.5
--- src/tests/fs/ffs/t_renamerace.c:1.4	Sun Apr 26 15:15:38 2009
+++ src/tests/fs/ffs/t_renamerace.c	Wed Apr 29 15:46:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.4 2009/04/26 15:15:38 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.5 2009/04/29 15:46:01 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -86,8 +86,9 @@
 	args.fspec = image;
 
 	rump_init();
+	rump_fakeblk_register(image);
 	if (rump_sys_mount(MOUNT_FFS, /, MNT_LOG, args, sizeof(args)) == -1)
-		atf_tc_fail_errno(ukfs_mount failed);
+		atf_tc_fail_errno(rump_sys_mount failed);
 
 	pthread_create(pt1, NULL, w1, NULL);
 	pthread_create(pt2, NULL, w2, NULL);



CVS commit: src/tests/fs/ffs

2009-04-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr  8 12:08:17 UTC 2009

Added Files:
src/tests/fs/ffs: Atffile Makefile t_renamerace.c

Log Message:
regression test for kern/40948


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/fs/ffs/Atffile src/tests/fs/ffs/Makefile \
src/tests/fs/ffs/t_renamerace.c

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

Added files:

Index: src/tests/fs/ffs/Atffile
diff -u /dev/null src/tests/fs/ffs/Atffile:1.1
--- /dev/null	Wed Apr  8 12:08:17 2009
+++ src/tests/fs/ffs/Atffile	Wed Apr  8 12:08:17 2009
@@ -0,0 +1,6 @@
+Content-Type: application/X-atf-atffile; version=1
+X-NetBSD-Id: $NetBSD: Atffile,v 1.1 2009/04/08 12:08:17 pooka Exp $
+
+prop: test-suite = NetBSD
+
+tp: t_renamerace
Index: src/tests/fs/ffs/Makefile
diff -u /dev/null src/tests/fs/ffs/Makefile:1.1
--- /dev/null	Wed Apr  8 12:08:17 2009
+++ src/tests/fs/ffs/Makefile	Wed Apr  8 12:08:17 2009
@@ -0,0 +1,11 @@
+#	$NetBSD: Makefile,v 1.1 2009/04/08 12:08:17 pooka Exp $
+#
+
+TESTSDIR=	${TESTSBASE}/fs/ffs
+
+TESTS_C=	t_renamerace
+
+LDADD.t_renamerace+=	-lukfs -lrumpfs_ffs -lrumpfs_ufs -lrumpvfs -lrump
+LDADD.t_renamerace+=	-lrumpuser -lpthread
+
+.include bsd.test.mk
Index: src/tests/fs/ffs/t_renamerace.c
diff -u /dev/null src/tests/fs/ffs/t_renamerace.c:1.1
--- /dev/null	Wed Apr  8 12:08:17 2009
+++ src/tests/fs/ffs/t_renamerace.c	Wed Apr  8 12:08:17 2009
@@ -0,0 +1,130 @@
+/*	$NetBSD: t_renamerace.c,v 1.1 2009/04/08 12:08:17 pooka Exp $	*/
+
+/*
+ * Modified for rump and atf from a program supplied
+ * by Nicolas Joly in kern/40948
+ */
+
+#include sys/types.h
+#include sys/mount.h
+
+#include atf-c.h
+#include errno.h
+#include fcntl.h
+#include pthread.h
+#include stdio.h
+#include stdlib.h
+#include unistd.h
+#include string.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+#include rump/ukfs.h
+
+#include ufs/ufs/ufsmount.h
+
+ATF_TC_WITH_CLEANUP(renamerace);
+ATF_TC_HEAD(renamerace, tc)
+{
+	atf_tc_set_md_var(tc, descr, rename(2) race against files 
+	unlinked mid-operation, kern/40948);
+}
+
+int quit;
+
+static void *
+w1(void *arg)
+{
+	int fd;
+
+	while (!quit) {
+		fd = rump_sys_open(/rename.test1,
+		O_WRONLY|O_CREAT|O_TRUNC, 0666);
+		rump_sys_unlink(/rename.test1);
+		rump_sys_close(fd);
+	}
+	return NULL;
+}
+
+static void *
+w2(void *arg)
+{
+
+	while (!quit)
+		rump_sys_rename(/rename.test1, /rename.test2);
+
+	return NULL;
+}
+
+/* XXX: how to do cleanup if we use mkdtemp? */
+#define IMAGENAME /tmp/ffsatf.img
+static char image[MAXPATHLEN];
+
+ATF_TC_BODY(renamerace, tc)
+{
+	struct ufs_args args;
+	char cmd[256];
+	struct ukfs *fs;
+	pthread_t pt1, pt2;
+
+#if 0
+	strcpy(image, TMPPATH);
+	if (mkdtemp(image) == NULL)
+		atf_tc_fail(can't create tmpdir %s: %d (%s),
+		TMPPATH, errno, strerror(errno));
+	strcat(image, /ffsatf.img);
+#else
+	strcpy(image, IMAGENAME);
+#endif
+
+	strcpy(cmd, newfs -F -s 1 );
+	strcat(cmd, image);
+
+	if (system(cmd) == -1)
+		atf_tc_fail(newfs failed: %d (%s), errno, strerror(errno));
+
+	memset(args, 0, sizeof(args));
+	args.fspec = image;
+
+	ukfs_init();
+	fs = ukfs_mount(MOUNT_FFS, ffs, UKFS_DEFAULTMP,
+	0, args, sizeof(args));
+	if (fs == NULL)
+		atf_tc_fail(ukfs_mount failed: %d (%s),
+		errno, strerror(errno));
+
+	pthread_create(pt1, NULL, w1, fs);
+	pthread_create(pt2, NULL, w2, fs);
+
+	sleep(10);
+
+	quit = 1;
+	pthread_join(pt1, NULL);
+	pthread_join(pt2, NULL);
+
+	ukfs_release(fs, 0);
+}
+
+ATF_TC_CLEANUP(renamerace, tc)
+{
+#if 0
+	char *img;
+
+	img = strrchr(image, '/');
+	if (!img)
+		return;
+
+	printf(removing %s\n, img+1);
+	unlink(img+1);
+	*img = '\0';
+	rmdir(img);
+#else
+	unlink(IMAGENAME);
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+	ATF_TP_ADD_TC(tp, renamerace);
+	return 0; /* ??? */
+}



CVS commit: src/tests/fs/ffs

2009-04-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr  8 12:29:05 UTC 2009

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

Log Message:
Hmm, this case was for MNT_LOG so enable it.  No wonder I couldn't
repeat the problem with the patch reverted.  regression test
regression.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/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/ffs/t_renamerace.c
diff -u src/tests/fs/ffs/t_renamerace.c:1.1 src/tests/fs/ffs/t_renamerace.c:1.2
--- src/tests/fs/ffs/t_renamerace.c:1.1	Wed Apr  8 12:08:17 2009
+++ src/tests/fs/ffs/t_renamerace.c	Wed Apr  8 12:29:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.1 2009/04/08 12:08:17 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.2 2009/04/08 12:29:05 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -88,7 +88,7 @@
 
 	ukfs_init();
 	fs = ukfs_mount(MOUNT_FFS, ffs, UKFS_DEFAULTMP,
-	0, args, sizeof(args));
+	MNT_LOG, args, sizeof(args));
 	if (fs == NULL)
 		atf_tc_fail(ukfs_mount failed: %d (%s),
 		errno, strerror(errno));