CVS commit: src/tests/fs/common

2020-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun  1 14:42:03 UTC 2020

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

Log Message:
LIBISPRIVATE=yes


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/common/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/common/Makefile
diff -u src/tests/fs/common/Makefile:1.13 src/tests/fs/common/Makefile:1.14
--- src/tests/fs/common/Makefile:1.13	Sun Oct 13 03:28:14 2019
+++ src/tests/fs/common/Makefile	Mon Jun  1 10:42:03 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2019/10/13 07:28:14 mrg Exp $
+#	$NetBSD: Makefile,v 1.14 2020/06/01 14:42:03 christos Exp $
 #
 
 .include 
@@ -27,7 +27,7 @@ CPPFLAGS+=	-DDEBUG -DLIBWRAP -DRUMP_RPC
 CPPFLAGS+=	-I${LIBC}/include -I${LIBC}/rpc
 
 
-LIBISPRIVATE=	# yup
+LIBISPRIVATE=	yes
 
 # NFS client stuff
 .PATH:	${NETBSDSRCDIR}/sbin/mount_nfs ${NETBSDSRCDIR}/sbin/mount



CVS commit: src/tests/fs/common

2020-03-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 15 12:12:42 UTC 2020

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Hardcode a check for ZFS and too little free space in workdir to skip
ZFS tests if the atf working directory is size restricted (ZFS has a
hardcoded minimal size of 64MB for a storage pool and 128 MB disk size).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.42 src/tests/fs/common/h_fsmacros.h:1.43
--- src/tests/fs/common/h_fsmacros.h:1.42	Tue Jun 19 09:20:46 2018
+++ src/tests/fs/common/h_fsmacros.h	Sun Mar 15 12:12:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.42 2018/06/19 09:20:46 gson Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.43 2020/03/15 12:12:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -249,6 +249,14 @@ static __inline bool
 atf_check_fstype(const atf_tc_t *tc, const char *fs)
 {
 	const char *fstype;
+	struct statvfs fsstat;
+
+	if (strcmp(fs, "zfs") == 0) {
+		/* XXX ZFS hardcodes a minimal size */
+		if (statvfs(".", ) == 0 &&
+		(fsstat.f_frsize * fsstat.f_bfree) <= 64*1024*1024)
+			atf_tc_skip("not enough free space in work directory");
+	}
 
 	if (!atf_tc_has_config_var(tc, "fstype"))
 		return true;



CVS commit: src/tests/fs/common

2019-01-20 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Jan 20 14:50:58 UTC 2019

Modified Files:
src/tests/fs/common: fstest_lfs.c

Log Message:
Call rump_pub_lwproc_newlwp() in the lfs cleaner thread to make its
rump system calls all use the same lwp.  Hopefully this will fix
PR kern/53884.  Also call rump_pub_lwproc_releaselwp() at the end.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/fstest_lfs.c

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

Modified files:

Index: src/tests/fs/common/fstest_lfs.c
diff -u src/tests/fs/common/fstest_lfs.c:1.5 src/tests/fs/common/fstest_lfs.c:1.6
--- src/tests/fs/common/fstest_lfs.c:1.5	Sun Aug 30 18:27:26 2015
+++ src/tests/fs/common/fstest_lfs.c	Sun Jan 20 14:50:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_lfs.c,v 1.5 2015/08/30 18:27:26 dholland Exp $	*/
+/*	$NetBSD: fstest_lfs.c,v 1.6 2019/01/20 14:50:58 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -128,6 +128,8 @@ cleaner(void *arg)
 	const char *the_argv[7];
 	char buf[64];
 
+	rump_pub_lwproc_newlwp(rump_sys_getpid());
+
 	/* this inspired by the cleaner code.  fixme */
 	sprintf(thepath, "/dev/r%s", args->ta_devpath+5);
 	rump_pub_etfs_register(thepath, args->ta_hostpath, RUMP_ETFS_CHR);
@@ -146,6 +148,8 @@ cleaner(void *arg)
 
 	lfs_cleaner_main(5, __UNCONST(the_argv));
 
+	rump_pub_lwproc_releaselwp();
+
 	return NULL;
 }
 



CVS commit: src/tests/fs/common

2015-08-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 30 18:27:26 UTC 2015

Modified Files:
src/tests/fs/common: fstest_lfs.c

Log Message:
Remove rubbish.


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

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

Modified files:

Index: src/tests/fs/common/fstest_lfs.c
diff -u src/tests/fs/common/fstest_lfs.c:1.4 src/tests/fs/common/fstest_lfs.c:1.5
--- src/tests/fs/common/fstest_lfs.c:1.4	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/common/fstest_lfs.c	Sun Aug 30 18:27:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_lfs.c,v 1.4 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: fstest_lfs.c,v 1.5 2015/08/30 18:27:26 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -48,8 +48,6 @@
 #include h_fsmacros.h
 #include mount_lfs.h
 
-sem_t lfs_clearnerloop;
-
 struct lfstestargs {
 	struct ufs_args ta_uargs;
 	pthread_t ta_cleanerthread;



CVS commit: src/tests/fs/common

2015-08-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 29 19:19:43 UTC 2015

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Fix glaringly wrong indent.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.39 src/tests/fs/common/h_fsmacros.h:1.40
--- src/tests/fs/common/h_fsmacros.h:1.39	Tue Mar 24 23:22:47 2015
+++ src/tests/fs/common/h_fsmacros.h	Sat Aug 29 19:19:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.39 2015/03/24 23:22:47 riastradh Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@ do {	\
 			atf_tc_fail_errno(unmount r/w failed);	\
 		if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp,		\
 		FSTEST_MNTNAME, MNT_RDONLY) != 0)			\
-		atf_tc_fail_errno(mount ro failed);			\
+			atf_tc_fail_errno(mount ro failed);		\
 		_func_(tc,FSTEST_MNTNAME);\
 		if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {\
 			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
zfs tests don't actually need privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.38 src/tests/fs/common/h_fsmacros.h:1.39
--- src/tests/fs/common/h_fsmacros.h:1.38	Wed Jun 26 19:29:24 2013
+++ src/tests/fs/common/h_fsmacros.h	Tue Mar 24 23:22:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.38 2013/06/26 19:29:24 reinoud Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.39 2015/03/24 23:22:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -110,10 +110,6 @@ do {	\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
 		atf_tc_set_md_var(tc, X-fs.type, #fs);		\
 		atf_tc_set_md_var(tc, X-fs.mntname, type);		\
-		if (strcmp(#fs, zfs) == 0) {\
-			/* This should not be necessary. */		\
-			atf_tc_set_md_var(tc, require.user, root);	\
-		}			\
 	}\
 	void *fs##func##tmp;		\
 	\
@@ -136,10 +132,6 @@ do {	\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
 		atf_tc_set_md_var(tc, X-fs.type, #_fs_);		\
 		atf_tc_set_md_var(tc, X-fs.mntname, _type_);		\
-		if (strcmp(#_fs_, zfs) == 0) {			\
-			/* This should not be necessary. */		\
-			atf_tc_set_md_var(tc, require.user, root);	\
-		}			\
 	}\
 	void *_fs_##_func_##tmp;	\
 	\



CVS commit: src/tests/fs/common

2014-03-16 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Mar 16 10:28:03 UTC 2014

Modified Files:
src/tests/fs/common: fstest_rumpfs.c

Log Message:
Retrict rumpfs to the provided size, like other filesystems.


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

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

Modified files:

Index: src/tests/fs/common/fstest_rumpfs.c
diff -u src/tests/fs/common/fstest_rumpfs.c:1.1 src/tests/fs/common/fstest_rumpfs.c:1.2
--- src/tests/fs/common/fstest_rumpfs.c:1.1	Thu Nov 11 17:39:29 2010
+++ src/tests/fs/common/fstest_rumpfs.c	Sun Mar 16 10:28:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_rumpfs.c,v 1.1 2010/11/11 17:39:29 pooka Exp $	*/
+/*	$NetBSD: fstest_rumpfs.c,v 1.2 2014/03/16 10:28:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -47,6 +47,13 @@ int
 rumpfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
 off_t size, void *fspriv)
 {
+	char tmp[64];
+	int res;
+
+	snprintf(tmp, sizeof(tmp), %PRId64, size);
+	res = setenv(RUMP_MEMLIMIT, tmp, 0);
+	if (res == -1)
+		return res;
 
 	return rump_init();
 }



CVS commit: src/tests/fs/common

2013-09-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  9 19:47:38 UTC 2013

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
Remove what looks like an outdated assert (there was something very sneaky
about this code, but my memory is fading ...)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/common/fstest_puffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.10 src/tests/fs/common/fstest_puffs.c:1.11
--- src/tests/fs/common/fstest_puffs.c:1.10	Thu Feb 10 16:35:01 2011
+++ src/tests/fs/common/fstest_puffs.c	Mon Sep  9 19:47:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.10 2011/02/10 16:35:01 njoly Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.11 2013/09/09 19:47:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -386,12 +386,6 @@ puffs_fstest_mount(const atf_tc_t *tc, v
 	if (fd == -1)
 		return fd;
 
-#if 0
-	pa-pa_fd = fd;
-#else
-	assert(fd == 0); /* XXX: FIXME */
-#endif
-
 	if (rump_sys_mkdir(path, 0777) == -1)
 		return -1;
 



CVS commit: src/tests/fs/common

2013-07-02 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jul  2 15:00:55 UTC 2013

Modified Files:
src/tests/fs/common: fstest_udf.c

Log Message:
Use the new extension to newfs_udf to generate a decent image for rump to work
on instead of an FFS(!) version.


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

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

Modified files:

Index: src/tests/fs/common/fstest_udf.c
diff -u src/tests/fs/common/fstest_udf.c:1.3 src/tests/fs/common/fstest_udf.c:1.4
--- src/tests/fs/common/fstest_udf.c:1.3	Sun Jun 30 15:42:43 2013
+++ src/tests/fs/common/fstest_udf.c	Tue Jul  2 15:00:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_udf.c,v 1.3 2013/06/30 15:42:43 martin Exp $	*/
+/*	$NetBSD: fstest_udf.c,v 1.4 2013/07/02 15:00:55 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -62,12 +62,11 @@ udf_fstest_newfs(const atf_tc_t *tc, voi
 	struct udftestargs *args;
 	struct sigaction act, oact;
 
-	size /= 512;
 	/*
-	 * XXX newfs should be newfs_udf here!
-	 * But newfs_udf does not support plain file mode.
+	 * Sectorsize can be specified with -S, as a multiple of 512.
+	 * newfs_udf takes humanized number as size in bytes as -s parameter!
 	 */
-	snprintf(cmd, 1024, newfs -F -s %PRId64 %s /dev/null, size, image);
+	snprintf(cmd, 1024, newfs_udf -F -s %PRId64 %s /dev/null, size, image);
 	memset(act, 0, sizeof(act));
 	act.sa_handler = SIG_DFL;
 	sigaction(SIGCHLD, act, oact);



CVS commit: src/tests/fs/common

2013-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 30 15:05:49 UTC 2013

Modified Files:
src/tests/fs/common: fstest_udf.c

Log Message:
Fix copy  pasto, notice by Nicolas Joly, one step closer to solving
PR kern/47974.


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

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

Modified files:

Index: src/tests/fs/common/fstest_udf.c
diff -u src/tests/fs/common/fstest_udf.c:1.1 src/tests/fs/common/fstest_udf.c:1.2
--- src/tests/fs/common/fstest_udf.c:1.1	Wed Jun 26 19:29:24 2013
+++ src/tests/fs/common/fstest_udf.c	Sun Jun 30 15:05:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_udf.c,v 1.1 2013/06/26 19:29:24 reinoud Exp $	*/
+/*	$NetBSD: fstest_udf.c,v 1.2 2013/06/30 15:05:49 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include unistd.h
 #include signal.h
 
-#include ufs/ufs/ufsmount.h
+#include fs/udf/udf_mount.h
 
 #include rump/rump.h
 #include rump/rump_syscalls.h
@@ -47,7 +47,7 @@
 #include h_fsmacros.h
 
 struct udftestargs {
-struct ufs_args ta_uargs;
+struct udf_args ta_uargs;
 char ta_devpath[MAXPATHLEN];
 char ta_imgpath[MAXPATHLEN];
 };



CVS commit: src/tests/fs/common

2013-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 30 15:42:43 UTC 2013

Modified Files:
src/tests/fs/common: fstest_udf.c

Log Message:
Initialize mount args version info.
Add comment about a bogusly used newfs where newfs_udf is meant.


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

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

Modified files:

Index: src/tests/fs/common/fstest_udf.c
diff -u src/tests/fs/common/fstest_udf.c:1.2 src/tests/fs/common/fstest_udf.c:1.3
--- src/tests/fs/common/fstest_udf.c:1.2	Sun Jun 30 15:05:49 2013
+++ src/tests/fs/common/fstest_udf.c	Sun Jun 30 15:42:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_udf.c,v 1.2 2013/06/30 15:05:49 martin Exp $	*/
+/*	$NetBSD: fstest_udf.c,v 1.3 2013/06/30 15:42:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -63,6 +63,10 @@ udf_fstest_newfs(const atf_tc_t *tc, voi
 	struct sigaction act, oact;
 
 	size /= 512;
+	/*
+	 * XXX newfs should be newfs_udf here!
+	 * But newfs_udf does not support plain file mode.
+	 */
 	snprintf(cmd, 1024, newfs -F -s %PRId64 %s /dev/null, size, image);
 	memset(act, 0, sizeof(act));
 	act.sa_handler = SIG_DFL;
@@ -83,6 +87,7 @@ udf_fstest_newfs(const atf_tc_t *tc, voi
 	snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.udf, num);
 	snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
 	args-ta_uargs.fspec = args-ta_devpath;
+	args-ta_uargs.version = UDFMNT_VERSION;
 
 	res = rump_pub_etfs_register(args-ta_devpath, image, RUMP_ETFS_BLK);
 	if (res != 0) {



CVS commit: src/tests/fs/common

2013-06-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Jun 26 19:29:24 UTC 2013

Modified Files:
src/tests/fs/common: Makefile h_fsmacros.h
Added Files:
src/tests/fs/common: fstest_udf.c

Log Message:
Add UDF as one of the filesytems to test. Might help understand why rump is
misbehaving on it.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/fs/common/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/fstest_udf.c
cvs rdiff -u -r1.37 -r1.38 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.10 src/tests/fs/common/Makefile:1.11
--- src/tests/fs/common/Makefile:1.10	Tue Mar  5 19:58:33 2013
+++ src/tests/fs/common/Makefile	Wed Jun 26 19:29:24 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2013/03/05 19:58:33 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2013/06/26 19:29:24 reinoud Exp $
 #
 
 .include bsd.own.mk
@@ -6,7 +6,7 @@
 LIB=	vfstest
 SRCS=	fstest_ext2fs.c fstest_ffs.c fstest_lfs.c fstest_msdosfs.c	\
 	fstest_nfs.c fstest_puffs.c fstest_rumpfs.c fstest_sysvbfs.c	\
-	fstest_tmpfs.c fstest_v7fs.c
+	fstest_tmpfs.c fstest_udf.c fstest_v7fs.c
 
 .if (${MKZFS} != no)
 SRCS+=	fstest_zfs.c

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.37 src/tests/fs/common/h_fsmacros.h:1.38
--- src/tests/fs/common/h_fsmacros.h:1.37	Sat Mar 16 05:24:59 2013
+++ src/tests/fs/common/h_fsmacros.h	Wed Jun 26 19:29:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.37 2013/03/16 05:24:59 jmmv Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.38 2013/06/26 19:29:24 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -61,6 +61,7 @@ FSPROTOS(puffs);
 FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
+FSPROTOS(udf);
 FSPROTOS(v7fs);
 FSPROTOS(zfs);
 
@@ -175,6 +176,7 @@ do {	\
   ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc)\
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc)\
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)\
+  ATF_TC_FSADD(udf,MOUNT_UDF,func,desc)\
   ATF_TC_FSADD(v7fs,MOUNT_V7FS,func,desc)
 
 #define ATF_TP_FSAPPLY_NOZFS(func)	\
@@ -189,6 +191,7 @@ do {	\
   ATF_TP_FSADD(rumpfs,func);		\
   ATF_TP_FSADD(sysvbfs,func);		\
   ATF_TP_FSADD(tmpfs,func);		\
+  ATF_TP_FSADD(udf,func);		\
   ATF_TP_FSADD(v7fs,func);
 
 /* XXX: this will not scale */
@@ -228,6 +231,7 @@ do {	\
   ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen)\
   ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen)			\
   ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen)			\
+  ATF_TC_FSADD_RO(udf,MOUNT_UDF,func,desc,gen)			\
   ATF_TC_FSADD_RO(v7fs,MOUNT_V7FS,func,desc,gen)
 
 #define ATF_TP_FSAPPLY_RO(func)		\
@@ -238,6 +242,7 @@ do {	\
   ATF_TP_FSADD(nfs,func);		\
   ATF_TP_FSADD(nfsro,func);		\
   ATF_TP_FSADD(sysvbfs,func);		\
+  ATF_TP_FSADD(udf,func);		\
   ATF_TP_FSADD(v7fs,func);
 
 #define ATF_FSAPPLY(func,desc)		\
@@ -286,6 +291,8 @@ atf_check_fstype(const atf_tc_t *tc, con
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), sysvbfs) == 0)
 #define FSTYPE_TMPFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), tmpfs) == 0)
+#define FSTYPE_UDF(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), udf) == 0)
 #define FSTYPE_V7FS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), v7fs) == 0)
 #define FSTYPE_ZFS(tc)\

Added files:

Index: src/tests/fs/common/fstest_udf.c
diff -u /dev/null src/tests/fs/common/fstest_udf.c:1.1
--- /dev/null	Wed Jun 26 19:29:24 2013
+++ src/tests/fs/common/fstest_udf.c	Wed Jun 26 19:29:24 2013
@@ -0,0 +1,149 @@
+/*	$NetBSD: fstest_udf.c,v 1.1 2013/06/26 19:29:24 reinoud Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nicolas Joly.
+ *
+ * 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 

CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Mark the zfs tests as requiring root.

This is wrong.  The zfs tests already use rump so they should not require
root.  However, I've already spent much more time than I wanted trying to
figure out why that's the case without much luck.  If you can find why,
just remove this hack.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.36 src/tests/fs/common/h_fsmacros.h:1.37
--- src/tests/fs/common/h_fsmacros.h:1.36	Mon Aug 20 16:39:46 2012
+++ src/tests/fs/common/h_fsmacros.h	Sat Mar 16 05:24:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.36 2012/08/20 16:39:46 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.37 2013/03/16 05:24:59 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -109,6 +109,10 @@ do {	\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
 		atf_tc_set_md_var(tc, X-fs.type, #fs);		\
 		atf_tc_set_md_var(tc, X-fs.mntname, type);		\
+		if (strcmp(#fs, zfs) == 0) {\
+			/* This should not be necessary. */		\
+			atf_tc_set_md_var(tc, require.user, root);	\
+		}			\
 	}\
 	void *fs##func##tmp;		\
 	\
@@ -131,6 +135,10 @@ do {	\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
 		atf_tc_set_md_var(tc, X-fs.type, #_fs_);		\
 		atf_tc_set_md_var(tc, X-fs.mntname, _type_);		\
+		if (strcmp(#_fs_, zfs) == 0) {			\
+			/* This should not be necessary. */		\
+			atf_tc_set_md_var(tc, require.user, root);	\
+		}			\
 	}\
 	void *_fs_##_func_##tmp;	\
 	\



CVS commit: src/tests/fs/common/nfsrpc

2013-03-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  5 16:54:08 UTC 2013

Modified Files:
src/tests/fs/common/nfsrpc: svc.c

Log Message:
use the proper fd_set.
XXX: Instead of making a copy of the libc rpc files here we should re-use the
files from libc, and use macros to provide the extra functionality needed here.
SoC project?


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/nfsrpc/svc.c

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

Modified files:

Index: src/tests/fs/common/nfsrpc/svc.c
diff -u src/tests/fs/common/nfsrpc/svc.c:1.5 src/tests/fs/common/nfsrpc/svc.c:1.6
--- src/tests/fs/common/nfsrpc/svc.c:1.5	Tue Mar  5 00:39:54 2013
+++ src/tests/fs/common/nfsrpc/svc.c	Tue Mar  5 11:54:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $	*/
+/*	$NetBSD: svc.c,v 1.6 2013/03/05 16:54:08 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro;
 static char *sccsid = @(#)svc.c	2.4 88/08/11 4.0 RPCSRC;
 #else
-__RCSID($NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $);
+__RCSID($NetBSD: svc.c,v 1.6 2013/03/05 16:54:08 christos Exp $);
 #endif
 #endif
 
@@ -204,7 +204,7 @@ xprt_register(SVCXPRT *xprt)
 		goto out;
 	}
 	__svc_xports[sock] = xprt;
-	FD_SET(sock, svc_fdset);
+	FD_SET(sock, get_fdset());
 	*get_fdsetmax() = max(*get_fdsetmax(), sock);
 	rwlock_unlock(svc_fd_lock);
 	return (TRUE);



CVS commit: src/tests/fs/common/nfsrpc

2013-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  5 05:39:54 UTC 2013

Modified Files:
src/tests/fs/common/nfsrpc: svc.c

Log Message:
catch up with libc.


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

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

Modified files:

Index: src/tests/fs/common/nfsrpc/svc.c
diff -u src/tests/fs/common/nfsrpc/svc.c:1.4 src/tests/fs/common/nfsrpc/svc.c:1.5
--- src/tests/fs/common/nfsrpc/svc.c:1.4	Thu Sep 23 05:38:14 2010
+++ src/tests/fs/common/nfsrpc/svc.c	Tue Mar  5 00:39:54 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc.c,v 1.4 2010/09/23 09:38:14 he Exp $	*/
+/*	$NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro;
 static char *sccsid = @(#)svc.c	2.4 88/08/11 4.0 RPCSRC;
 #else
-__RCSID($NetBSD: svc.c,v 1.4 2010/09/23 09:38:14 he Exp $);
+__RCSID($NetBSD: svc.c,v 1.5 2013/03/05 05:39:54 christos Exp $);
 #endif
 #endif
 
@@ -180,9 +180,8 @@ get_fdsetmax()
 /*
  * Activate a transport handle.
  */
-void
-xprt_register(xprt)
-	SVCXPRT *xprt;
+bool_t
+xprt_register(SVCXPRT *xprt)
 {
 	int sock;
 
@@ -194,18 +193,25 @@ xprt_register(xprt)
 	if (__svc_xports == NULL) {
 		__svc_xports = mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
 		if (__svc_xports == NULL) {
-			warn(xprt_register);
+			warn(%s: out of memory, __func__);
 			goto out;
 		}
 		memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
 	}
-	if (sock  FD_SETSIZE) {
-		__svc_xports[sock] = xprt;
-		FD_SET(sock, get_fdset());
-		*get_fdsetmax() = max(*get_fdsetmax(), sock);
-	}
+	if (sock = FD_SETSIZE) {
+		warnx(%s: socket descriptor %d too large for setsize %u,
+		__func__, sock, (unsigned)FD_SETSIZE);
+		goto out;
+	}
+	__svc_xports[sock] = xprt;
+	FD_SET(sock, svc_fdset);
+	*get_fdsetmax() = max(*get_fdsetmax(), sock);
+	rwlock_unlock(svc_fd_lock);
+	return (TRUE);
+
 out:
 	rwlock_unlock(svc_fd_lock);
+	return (FALSE);
 }
 
 void



CVS commit: src/tests/fs/common

2012-08-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 20 16:39:46 UTC 2012

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Add a vfstest zfs attachment.  This is a compile-time option,
default off, due the large numbers of failing tests (some of them
look like quite trivial failures).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.35 src/tests/fs/common/h_fsmacros.h:1.36
--- src/tests/fs/common/h_fsmacros.h:1.35	Thu Aug 11 10:52:12 2011
+++ src/tests/fs/common/h_fsmacros.h	Mon Aug 20 16:39:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.35 2011/08/11 10:52:12 uch Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.36 2012/08/20 16:39:46 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@ FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
 FSPROTOS(v7fs);
+FSPROTOS(zfs);
 
 #ifndef FSTEST_IMGNAME
 #define FSTEST_IMGNAME image.fs
@@ -154,7 +155,7 @@ do {	\
 #define ATF_TP_FSADD(fs,func)		\
   ATF_TP_ADD_TC(tp,fs##_##func)
 
-#define ATF_TC_FSAPPLY(func,desc)	\
+#define ATF_TC_FSAPPLY_NOZFS(func,desc)	\
   ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc)\
   ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc)	\
   ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc)\
@@ -168,7 +169,7 @@ do {	\
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)\
   ATF_TC_FSADD(v7fs,MOUNT_V7FS,func,desc)
 
-#define ATF_TP_FSAPPLY(func)		\
+#define ATF_TP_FSAPPLY_NOZFS(func)	\
   ATF_TP_FSADD(ext2fs,func);		\
   ATF_TP_FSADD(ffs,func);		\
   ATF_TP_FSADD(ffslog,func);		\
@@ -182,6 +183,24 @@ do {	\
   ATF_TP_FSADD(tmpfs,func);		\
   ATF_TP_FSADD(v7fs,func);
 
+/* XXX: this will not scale */
+#ifdef WANT_ZFS_TESTS
+#define ATF_TC_FSAPPLY(func,desc)	\
+  ATF_TC_FSAPPLY_NOZFS(func,desc)	\
+  ATF_TC_FSADD(zfs,MOUNT_ZFS,func,desc)
+#define ATF_TP_FSAPPLY(func)		\
+  ATF_TP_FSAPPLY_NOZFS(func)		\
+  ATF_TP_FSADD(zfs,func);
+
+#else /* !WANT_ZFS_TESTS */
+
+#define ATF_TC_FSAPPLY(func,desc)	\
+  ATF_TC_FSAPPLY_NOZFS(func,desc)
+#define ATF_TP_FSAPPLY(func)		\
+  ATF_TP_FSAPPLY_NOZFS(func)
+
+#endif /* WANT_ZFS_TESTS */
+
 /*
  * Same as above, but generate a file system image first and perform
  * tests for a r/o mount.
@@ -261,6 +280,8 @@ atf_check_fstype(const atf_tc_t *tc, con
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), tmpfs) == 0)
 #define FSTYPE_V7FS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), v7fs) == 0)
+#define FSTYPE_ZFS(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), zfs) == 0)
 
 #define FSTEST_ENTER()			\
 	if (rump_sys_chdir(FSTEST_MNTNAME) == -1)			\



CVS commit: src/tests/fs/common

2012-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  5 02:03:05 UTC 2012

Modified Files:
src/tests/fs/common: fstest_ffs.c

Log Message:
Fix ffs_fstest_delfs's error branch for rump_pub_etfs_remove.

rump_pub_etfs_remove returns an error code, rather than setting errno
and returning -1.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/fstest_ffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_ffs.c
diff -u src/tests/fs/common/fstest_ffs.c:1.5 src/tests/fs/common/fstest_ffs.c:1.6
--- src/tests/fs/common/fstest_ffs.c:1.5	Sun Jun 26 13:06:00 2011
+++ src/tests/fs/common/fstest_ffs.c	Sun Aug  5 02:03:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_ffs.c,v 1.5 2011/06/26 13:06:00 christos Exp $	*/
+/*	$NetBSD: fstest_ffs.c,v 1.6 2012/08/05 02:03:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -104,8 +104,10 @@ ffs_fstest_delfs(const atf_tc_t *tc, voi
 	struct ffstestargs *args = buf;
 
 	res = rump_pub_etfs_remove(args-ta_devpath);
-	if (res != 0)
-		return res;
+	if (res != 0) {
+		errno = res;
+		return -1;
+	}
 
 	res = unlink(args-ta_imgpath);
 	if (res != 0)



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: fstest_msdosfs.c

Log Message:
Initialise permissions mask to a sensible value (0755).
While here convert leading spaces to tabs.


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

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

Modified files:

Index: src/tests/fs/common/fstest_msdosfs.c
diff -u src/tests/fs/common/fstest_msdosfs.c:1.2 src/tests/fs/common/fstest_msdosfs.c:1.3
--- src/tests/fs/common/fstest_msdosfs.c:1.2	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/common/fstest_msdosfs.c	Mon Mar 26 15:10:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_msdosfs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: fstest_msdosfs.c,v 1.3 2012/03/26 15:10:26 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -75,9 +75,10 @@ msdosfs_fstest_newfs(const atf_tc_t *tc,
 	if (args == NULL)
 		return -1;
 
-snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.msdosfs, num);
-snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
-args-ta_uargs.fspec = args-ta_devpath;
+	snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.msdosfs, num);
+	snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
+	args-ta_uargs.fspec = args-ta_devpath;
+	args-ta_uargs.mask = 0755;
 
 	res = rump_pub_etfs_register(args-ta_devpath, image, RUMP_ETFS_BLK);
 	if (res != 0) {



CVS commit: src/tests/fs/common/nfsrpc

2011-06-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jun 29 02:36:13 UTC 2011

Modified Files:
src/tests/fs/common/nfsrpc: Makefile.inc

Log Message:
apply some -fno-strict-aliasing

XXX -- someone please fix this properly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/nfsrpc/Makefile.inc

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

Modified files:

Index: src/tests/fs/common/nfsrpc/Makefile.inc
diff -u src/tests/fs/common/nfsrpc/Makefile.inc:1.2 src/tests/fs/common/nfsrpc/Makefile.inc:1.3
--- src/tests/fs/common/nfsrpc/Makefile.inc:1.2	Tue Aug  3 17:24:45 2010
+++ src/tests/fs/common/nfsrpc/Makefile.inc	Wed Jun 29 02:36:13 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.2 2010/08/03 17:24:45 drochner Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2011/06/29 02:36:13 mrg Exp $
 #
 
 # libc rpc using rump syscalls
@@ -8,3 +8,6 @@
 
 CPPFLAGS+=	-DPORTMAP -D_REENTRANT -DRUMP_SYS_NETWORKING
 CPPFLAGS+=	-DDEBUG -DLIBWRAP
+
+# XXX
+CPPFLAGS.clnt_dg.c+=	-fno-strict-aliasing



CVS commit: src/tests/fs/common

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 13:06:00 UTC 2011

Modified Files:
src/tests/fs/common: fstest_ffs.c

Log Message:
ggr, how many of those I will need to fix. Fallout from the bogus inclusion
of signal.h in rump_syscallargs.h.


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

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

Modified files:

Index: src/tests/fs/common/fstest_ffs.c
diff -u src/tests/fs/common/fstest_ffs.c:1.4 src/tests/fs/common/fstest_ffs.c:1.5
--- src/tests/fs/common/fstest_ffs.c:1.4	Thu Jan 13 07:55:19 2011
+++ src/tests/fs/common/fstest_ffs.c	Sun Jun 26 09:06:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_ffs.c,v 1.4 2011/01/13 12:55:19 pooka Exp $	*/
+/*	$NetBSD: fstest_ffs.c,v 1.5 2011/06/26 13:06:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include signal.h
 
 #include ufs/ufs/ufsmount.h
 



CVS commit: src/tests/fs/common

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 16:50:16 UTC 2011

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Remove unnecessary (and broken) cleanup routines.

The cleanup routines were being used to kill the rump process and to delete
the temporary image file.  These are things automatically done by atf-run,
but it looks like this code was added here to workaround a previous bug in
the atf-run code.

Note that, in the existing form, the cleanup routines segfault (haven't
spent the time to track down why).  atf-run does not care about this
(although it should), buy Kyua does.

As a side effect, this has a teeny-tiny performance speedup in the execution
of the tests including this file.

OKed by njoly@.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.33 src/tests/fs/common/h_fsmacros.h:1.34
--- src/tests/fs/common/h_fsmacros.h:1.33	Sat Mar  5 20:56:28 2011
+++ src/tests/fs/common/h_fsmacros.h	Tue Mar 22 16:50:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.33 2011/03/05 20:56:28 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.34 2011/03/22 16:50:16 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 } while (/*CONSTCOND*/0);
 
 #define ATF_TC_FSADD(fs,type,func,desc)	\
-	ATF_TC_WITH_CLEANUP(fs##_##func);\
+	ATF_TC(fs##_##func);		\
 	ATF_TC_HEAD(fs##_##func,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
@@ -120,18 +120,10 @@
 			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
 			atf_tc_fail_errno(unmount failed);		\
 		}			\
-	}\
-	\
-	ATF_TC_CLEANUP(fs##_##func,tc)	\
-	{\
-		if (!atf_check_fstype(tc, #fs))\
-			return;		\
-		if (fs##_fstest_delfs(tc, fs##func##tmp) != 0)		\
-			atf_tc_fail_errno(delfs failed);		\
 	}
 
 #define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_)		\
-	ATF_TC_WITH_CLEANUP(_fs_##_##_func_);\
+	ATF_TC(_fs_##_##_func_);	\
 	ATF_TC_HEAD(_fs_##_##_func_,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
@@ -156,14 +148,6 @@
 			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
 			atf_tc_fail_errno(unmount failed);		\
 		}			\
-	}\
-	\
-	ATF_TC_CLEANUP(_fs_##_##_func_,tc)\
-	{\
-		if (!atf_check_fstype(tc, #_fs_))			\
-			return;		\
-		if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0)	\
-			atf_tc_fail_errno(delfs failed);		\
 	}
 
 #define ATF_TP_FSADD(fs,func)		\



CVS commit: src/tests/fs/common

2011-03-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Mar  5 20:56:28 UTC 2011

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Put p2k_ffs back there -- i can't repeat any problems in my qemu/anita
runs.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.32 src/tests/fs/common/h_fsmacros.h:1.33
--- src/tests/fs/common/h_fsmacros.h:1.32	Fri Jan  7 19:54:48 2011
+++ src/tests/fs/common/h_fsmacros.h	Sat Mar  5 20:56:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.32 2011/01/07 19:54:48 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.33 2011/03/05 20:56:28 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -177,6 +177,7 @@
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc)\
   ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc)	\
   ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc)\
+  ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc)\
   ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc)\
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc)\
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
@@ -189,6 +190,7 @@
   ATF_TP_FSADD(msdosfs,func);		\
   ATF_TP_FSADD(nfs,func);		\
   ATF_TP_FSADD(puffs,func);		\
+  ATF_TP_FSADD(p2k_ffs,func);		\
   ATF_TP_FSADD(rumpfs,func);		\
   ATF_TP_FSADD(sysvbfs,func);		\
   ATF_TP_FSADD(tmpfs,func);



CVS commit: src/tests/fs/common

2011-02-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Feb 28 21:03:15 UTC 2011

Modified Files:
src/tests/fs/common: fstest_nfs.c

Log Message:
bump nfdsargv[]�size belatedly (and add a few extra for needs of future bugs)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/common/fstest_nfs.c

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

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.6 src/tests/fs/common/fstest_nfs.c:1.7
--- src/tests/fs/common/fstest_nfs.c:1.6	Thu Feb 10 16:35:01 2011
+++ src/tests/fs/common/fstest_nfs.c	Mon Feb 28 21:03:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.6 2011/02/10 16:35:01 njoly Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.7 2011/02/28 21:03:15 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
 	const char *image, off_t size, void *fspriv)
 {
 	const char *srcdir;
-	char *nfsdargv[7];
+	char *nfsdargv[16];
 	char nfsdpath[MAXPATHLEN];
 	char imagepath[MAXPATHLEN];
 	char ethername[MAXPATHLEN], ethername_ro[MAXPATHLEN];



CVS commit: src/tests/fs/common

2011-02-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Feb 28 21:08:13 UTC 2011

Modified Files:
src/tests/fs/common: fstest_nfs.c

Log Message:
g/c unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/common/fstest_nfs.c

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

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.7 src/tests/fs/common/fstest_nfs.c:1.8
--- src/tests/fs/common/fstest_nfs.c:1.7	Mon Feb 28 21:03:15 2011
+++ src/tests/fs/common/fstest_nfs.c	Mon Feb 28 21:08:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.7 2011/02/28 21:03:15 pooka Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.8 2011/02/28 21:08:13 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,9 +66,6 @@
 	atf_tc_fail(child died);
 }
 
-struct nfstestargs *theargs;
-
-
 /* fork rump nfsd, configure interface */
 static int
 donewfs(const atf_tc_t *tc, void **argp,



CVS commit: src/tests/fs/common

2011-02-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Feb 28 21:08:46 UTC 2011

Modified Files:
src/tests/fs/common: fstest_nfs.c

Log Message:
g/c use of unused variable too


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/common/fstest_nfs.c

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

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.8 src/tests/fs/common/fstest_nfs.c:1.9
--- src/tests/fs/common/fstest_nfs.c:1.8	Mon Feb 28 21:08:13 2011
+++ src/tests/fs/common/fstest_nfs.c	Mon Feb 28 21:08:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.8 2011/02/28 21:08:13 pooka Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.9 2011/02/28 21:08:46 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -153,7 +153,6 @@
 	strcpy(args-ta_ethername, ethername);
 
 	*argp = args;
-	theargs = args;
 
 	return 0;
 }



CVS commit: src/tests/fs/common

2011-02-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Feb 12 18:13:46 UTC 2011

Modified Files:
src/tests/fs/common: snapshot.c

Log Message:
Test the right fd after rump_sys_open().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/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/common/snapshot.c
diff -u src/tests/fs/common/snapshot.c:1.5 src/tests/fs/common/snapshot.c:1.6
--- src/tests/fs/common/snapshot.c:1.5	Sun Nov  7 17:51:17 2010
+++ src/tests/fs/common/snapshot.c	Sat Feb 12 18:13:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapshot.c,v 1.5 2010/11/07 17:51:17 jmmv Exp $	*/
+/*	$NetBSD: snapshot.c,v 1.6 2011/02/12 18:13:46 bouyer Exp $	*/
 
 #include sys/types.h
 #include sys/ioctl.h
@@ -65,7 +65,7 @@
 		atf_tc_fail_errno(write fail);
 
 	fssfd = rump_sys_open(/dev/rfss0, O_RDWR);
-	if (fd == -1)
+	if (fssfd == -1)
 		atf_tc_fail_errno(cannot open fss);
 	makefile(BAKNAME);
 	memset(fss, 0, sizeof(fss));



CVS commit: src/tests/fs/common

2011-02-10 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Feb 10 16:35:01 UTC 2011

Modified Files:
src/tests/fs/common: fstest_nfs.c fstest_puffs.c

Log Message:
Do initialise allocated file system args structures for puffs and nfs
(fix some puffs tests failures with MALLOC_OPTIONS=J).
While here, detect and report args allocation failure.

ok from pooka.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/fstest_nfs.c
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/common/fstest_puffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.5 src/tests/fs/common/fstest_nfs.c:1.6
--- src/tests/fs/common/fstest_nfs.c:1.5	Fri Dec 31 18:11:27 2010
+++ src/tests/fs/common/fstest_nfs.c	Thu Feb 10 16:35:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.5 2010/12/31 18:11:27 pooka Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.6 2011/02/10 16:35:01 njoly Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -149,6 +149,9 @@
 	 * the mountpath available here.
 	 */
 	args = malloc(sizeof(*args));
+	if (args == NULL)
+		return errno;
+	memset(args, 0, sizeof(*args));
 	args-ta_childpid = childpid;
 	strcpy(args-ta_ethername, ethername);
 

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.9 src/tests/fs/common/fstest_puffs.c:1.10
--- src/tests/fs/common/fstest_puffs.c:1.9	Fri Jan  7 11:50:37 2011
+++ src/tests/fs/common/fstest_puffs.c	Thu Feb 10 16:35:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.9 2011/01/07 11:50:37 pooka Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.10 2011/02/10 16:35:01 njoly Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -260,6 +260,7 @@
 	args = malloc(sizeof(*args));
 	if (args == NULL)
 		return errno;
+	memset(args, 0, sizeof(*args));
 
 	pflags = args-pta_pflags;
 



CVS commit: src/tests/fs/common

2011-01-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan 13 12:55:19 UTC 2011

Modified Files:
src/tests/fs/common: fstest_ffs.c

Log Message:
wrap system() in SIG_DFL so that child-bearing fs tests (puffs,
nfs) don't go cuckoo when the process executed by system() takes a
backstage left.


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

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

Modified files:

Index: src/tests/fs/common/fstest_ffs.c
diff -u src/tests/fs/common/fstest_ffs.c:1.3 src/tests/fs/common/fstest_ffs.c:1.4
--- src/tests/fs/common/fstest_ffs.c:1.3	Fri Jan  7 11:52:59 2011
+++ src/tests/fs/common/fstest_ffs.c	Thu Jan 13 12:55:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_ffs.c,v 1.3 2011/01/07 11:52:59 pooka Exp $	*/
+/*	$NetBSD: fstest_ffs.c,v 1.4 2011/01/13 12:55:19 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -59,10 +59,15 @@
 	int res;
 	static unsigned int num = 0;
 	struct ffstestargs *args;
+	struct sigaction act, oact;
 
 	size /= 512;
 	snprintf(cmd, 1024, newfs -F -s %PRId64 %s /dev/null, size, image);
+	memset(act, 0, sizeof(act));
+	act.sa_handler = SIG_DFL;
+	sigaction(SIGCHLD, act, oact);
 	res = system(cmd);
+	sigaction(SIGCHLD, oact, NULL);
 	if (res != 0)
 		return res;
 



CVS commit: src/tests/fs/common

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 10:45:46 UTC 2011

Modified Files:
src/tests/fs/common: fstest_puffs.c h_fsmacros.h

Log Message:
Add a puffs-p2k-ffs file system type to automated tests.  Inspired
by the file handle problem in p2k.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/common/fstest_puffs.c
cvs rdiff -u -r1.24 -r1.25 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.7 src/tests/fs/common/fstest_puffs.c:1.8
--- src/tests/fs/common/fstest_puffs.c:1.7	Wed Dec 29 22:56:59 2010
+++ src/tests/fs/common/fstest_puffs.c	Fri Jan  7 10:45:45 2011
@@ -1,7 +1,7 @@
-/*	$NetBSD: fstest_puffs.c,v 1.7 2010/12/29 22:56:59 yamt Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.8 2011/01/07 10:45:45 pooka Exp $	*/
 
 /*
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -242,14 +242,11 @@
 struct puffstestargs *theargs; /* XXX */
 
 /* XXX: we don't support size */
-int
-puffs_fstest_newfs(const atf_tc_t *tc, void **argp,
-	const char *image, off_t size, void *fspriv)
+static int
+donewfs(const atf_tc_t *tc, void **argp,
+	const char *image, off_t size, void *fspriv, char **theargv)
 {
 	struct puffstestargs *args;
-	char dtfs_path[MAXPATHLEN];
-	char *dtfsargv[6];
-	char **theargv;
 	pid_t childpid;
 	int *pflags;
 	char comfd[16];
@@ -266,24 +263,6 @@
 
 	pflags = args-pta_pflags;
 
-	/* build dtfs exec path from atf test dir */
-	sprintf(dtfs_path, %s/../puffs/h_dtfs/h_dtfs,
-	atf_tc_get_config_var(tc, srcdir));
-
-	if (fspriv) {
-		theargv = fspriv;
-		theargv[0] = dtfs_path;
-	} else {
-		dtfsargv[0] = dtfs_path;
-		dtfsargv[1] = __UNCONST(-i);
-		dtfsargv[2] = __UNCONST(-s);
-		dtfsargv[3] = __UNCONST(dtfs);
-		dtfsargv[4] = __UNCONST(fictional);
-		dtfsargv[5] = NULL;
-
-		theargv = dtfsargv;
-	}
-
 	/* Create sucketpair for communication with the real file server */
 	if (socketpair(PF_LOCAL, SOCK_STREAM, 0, sv) == -1)
 		return errno;
@@ -343,6 +322,59 @@
 }
 
 int
+puffs_fstest_newfs(const atf_tc_t *tc, void **argp,
+	const char *image, off_t size, void *fspriv)
+{
+	char dtfs_path[MAXPATHLEN];
+	char *dtfsargv[6];
+	char **theargv;
+
+	/* build dtfs exec path from atf test dir */
+	sprintf(dtfs_path, %s/../puffs/h_dtfs/h_dtfs,
+	atf_tc_get_config_var(tc, srcdir));
+
+	if (fspriv) {
+		theargv = fspriv;
+		theargv[0] = dtfs_path;
+	} else {
+		dtfsargv[0] = dtfs_path;
+		dtfsargv[1] = __UNCONST(-i);
+		dtfsargv[2] = __UNCONST(-s);
+		dtfsargv[3] = __UNCONST(dtfs);
+		dtfsargv[4] = __UNCONST(fictional);
+		dtfsargv[5] = NULL;
+
+		theargv = dtfsargv;
+	}
+
+	return donewfs(tc, argp, image, size, fspriv, theargv);
+}
+
+int
+p2k_ffs_fstest_newfs(const atf_tc_t *tc, void **argp,
+	const char *image, off_t size, void *fspriv)
+{
+	char *rumpffs_argv[5];
+	int rv;
+
+	rump_init();
+	if ((rv = ffs_fstest_newfs(tc, argp, image, size, fspriv)) != 0)
+		return rv;
+	if (mkdir(p2kffsfake, 0777) == -1)
+		return errno;
+
+	setenv(P2K_NODETACH, 1, 1);
+	rumpffs_argv[0] = __UNCONST(rump_ffs);
+	rumpffs_argv[1] = __UNCONST(image);
+	rumpffs_argv[2] = __UNCONST(p2kffsfake); /* NOTUSED */
+	rumpffs_argv[3] = NULL;
+
+	if ((rv = donewfs(tc, argp, image, size, fspriv, rumpffs_argv)) != 0)
+		ffs_fstest_delfs(tc, argp);
+	return rv;
+}
+
+int
 puffs_fstest_mount(const atf_tc_t *tc, void *arg, const char *path, int flags)
 {
 	struct puffstestargs *pargs = arg;
@@ -374,6 +406,7 @@
 
 	return 0;
 }
+__strong_alias(p2k_ffs_fstest_mount,puffs_fstest_mount);
 
 int
 puffs_fstest_delfs(const atf_tc_t *tc, void *arg)
@@ -384,6 +417,13 @@
 }
 
 int
+p2k_ffs_fstest_delfs(const atf_tc_t *tc, void *arg)
+{
+
+	return ffs_fstest_delfs(tc, arg);
+}
+
+int
 puffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
 	struct puffstestargs *pargs = theargs;
@@ -410,5 +450,8 @@
 	usleep(500);
 	wait(status);
 
+	rmdir(p2kffsfake);
+
 	return 0;
 }
+__strong_alias(p2k_ffs_fstest_unmount,puffs_fstest_unmount);

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.24 src/tests/fs/common/h_fsmacros.h:1.25
--- src/tests/fs/common/h_fsmacros.h:1.24	Fri Dec 31 18:16:41 2010
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 10:45:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.24 2010/12/31 18:16:41 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.25 2011/01/07 10:45:45 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -55,6 +55,7 @@
 FSPROTOS(msdosfs);
 FSPROTOS(nfs);
 FSPROTOS(nfsro);
+FSPROTOS(p2k_ffs);
 FSPROTOS(puffs);
 FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
@@ -171,6 +172,7 @@
   

CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Use our internal name instead of MOUNT_FOO to identify file system
since otherwise we now run into dupes (e.g. nfs and nfsro, puffs
and p2k_ffs).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.25 src/tests/fs/common/h_fsmacros.h:1.26
--- src/tests/fs/common/h_fsmacros.h:1.25	Fri Jan  7 10:45:45 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 11:36:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.25 2011/01/07 10:45:45 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.26 2011/01/07 11:36:27 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
 	ATF_TC_HEAD(_fs_##_##_func_,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
-		atf_tc_set_md_var(tc, X-fs.type, _type_);		\
+		atf_tc_set_md_var(tc, X-fs.type, #_fs_);		\
 	}\
 	void *_fs_##_func_##tmp;	\
 	\
@@ -240,23 +240,27 @@
 }
 
 #define FSTYPE_EXT2FS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_EXT2FS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), ext2fs) == 0)
 #define FSTYPE_FFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_FFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), ffs) == 0)
 #define FSTYPE_LFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_LFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), lfs) == 0)
 #define FSTYPE_MSDOS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_MSDOS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), msdosfs) == 0)
 #define FSTYPE_NFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_NFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), nfs) == 0)
+#define FSTYPE_NFSRO(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), nfsro) == 0)
+#define FSTYPE_P2K_FFS(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), p2k_ffs) == 0)
 #define FSTYPE_PUFFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_PUFFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), puffs) == 0)
 #define FSTYPE_RUMPFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_RUMPFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), rumpfs) == 0)
 #define FSTYPE_SYSVBFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_SYSVBFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), sysvbfs) == 0)
 #define FSTYPE_TMPFS(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_TMPFS) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), tmpfs) == 0)
 
 #define FSTEST_ENTER()			\
 	if (rump_sys_chdir(FSTEST_MNTNAME) == -1)			\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
adjust another place where X-fs.type is set


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

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.26 src/tests/fs/common/h_fsmacros.h:1.27
--- src/tests/fs/common/h_fsmacros.h:1.26	Fri Jan  7 11:36:27 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 11:41:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.26 2011/01/07 11:36:27 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.27 2011/01/07 11:41:40 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
 	ATF_TC_HEAD(fs##_##func,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
-		atf_tc_set_md_var(tc, X-fs.type, type);		\
+		atf_tc_set_md_var(tc, X-fs.type, #fs);		\
 	}\
 	void *fs##func##tmp;		\
 	\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
Don't panic if unnecessary dir already exists.
(helpful when running the test without atf-run)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/common/fstest_puffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.8 src/tests/fs/common/fstest_puffs.c:1.9
--- src/tests/fs/common/fstest_puffs.c:1.8	Fri Jan  7 10:45:45 2011
+++ src/tests/fs/common/fstest_puffs.c	Fri Jan  7 11:50:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.8 2011/01/07 10:45:45 pooka Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.9 2011/01/07 11:50:37 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -360,7 +360,7 @@
 	rump_init();
 	if ((rv = ffs_fstest_newfs(tc, argp, image, size, fspriv)) != 0)
 		return rv;
-	if (mkdir(p2kffsfake, 0777) == -1)
+	if (mkdir(p2kffsfake, 0777) == -1  errno != EEXIST)
 		return errno;
 
 	setenv(P2K_NODETACH, 1, 1);



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: fstest_ffs.c h_fsmacros.h

Log Message:
add another fstype for ffs -o log


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/fstest_ffs.c
cvs rdiff -u -r1.27 -r1.28 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/fstest_ffs.c
diff -u src/tests/fs/common/fstest_ffs.c:1.2 src/tests/fs/common/fstest_ffs.c:1.3
--- src/tests/fs/common/fstest_ffs.c:1.2	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/common/fstest_ffs.c	Fri Jan  7 11:52:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_ffs.c,v 1.2 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: fstest_ffs.c,v 1.3 2011/01/07 11:52:59 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -89,6 +89,7 @@
 
 	return 0;
 }
+__strong_alias(ffslog_fstest_newfs,ffs_fstest_newfs);
 
 int
 ffs_fstest_delfs(const atf_tc_t *tc, void *buf)
@@ -108,6 +109,7 @@
 
 	return 0;
 }
+__strong_alias(ffslog_fstest_delfs,ffs_fstest_delfs);
 
 int
 ffs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
@@ -125,6 +127,13 @@
 }
 
 int
+ffslog_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
+{
+
+	return ffs_fstest_mount(tc, buf, path, flags | MNT_LOG);
+}
+
+int
 ffs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
 	int res;
@@ -136,3 +145,4 @@
 	res = rump_sys_rmdir(path);
 	return res;
 }
+__strong_alias(ffslog_fstest_unmount,ffs_fstest_unmount);

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.27 src/tests/fs/common/h_fsmacros.h:1.28
--- src/tests/fs/common/h_fsmacros.h:1.27	Fri Jan  7 11:41:40 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 11:52:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.27 2011/01/07 11:41:40 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.28 2011/01/07 11:52:59 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -51,6 +51,7 @@
 
 FSPROTOS(ext2fs);
 FSPROTOS(ffs);
+FSPROTOS(ffslog);
 FSPROTOS(lfs);
 FSPROTOS(msdosfs);
 FSPROTOS(nfs);
@@ -169,6 +170,7 @@
 #define ATF_TC_FSAPPLY(func,desc)	\
   ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc)\
   ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc)	\
+  ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc)\
   ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc)	\
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc)\
   ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc)	\
@@ -181,6 +183,7 @@
 #define ATF_TP_FSAPPLY(func)		\
   ATF_TP_FSADD(ext2fs,func);		\
   ATF_TP_FSADD(ffs,func);		\
+  ATF_TP_FSADD(ffslog,func);		\
   ATF_TP_FSADD(lfs,func);		\
   ATF_TP_FSADD(msdosfs,func);		\
   ATF_TP_FSADD(nfs,func);		\
@@ -204,6 +207,7 @@
 #define ATF_TC_FSAPPLY_RO(func,desc,gen)\
   ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen)			\
   ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen)\
+  ATF_TC_FSADD_RO(ffslog,MOUNT_FFS,func,desc,gen)			\
   ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen)			\
   ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen)\
   ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen)			\
@@ -212,6 +216,7 @@
 #define ATF_TP_FSAPPLY_RO(func)		\
   ATF_TP_FSADD(ext2fs,func);		\
   ATF_TP_FSADD(ffs,func);		\
+  ATF_TP_FSADD(ffslog,func);		\
   ATF_TP_FSADD(msdosfs,func);		\
   ATF_TP_FSADD(nfs,func);		\
   ATF_TP_FSADD(nfsro,func);		\
@@ -243,6 +248,8 @@
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), ext2fs) == 0)
 #define FSTYPE_FFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), ffs) == 0)
+#define FSTYPE_FFSLOG(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), ffs) == 0)
 #define FSTYPE_LFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), lfs) == 0)
 #define FSTYPE_MSDOS(tc)\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
antipasto


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.28 src/tests/fs/common/h_fsmacros.h:1.29
--- src/tests/fs/common/h_fsmacros.h:1.28	Fri Jan  7 11:52:59 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 11:58:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.28 2011/01/07 11:52:59 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.29 2011/01/07 11:58:21 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -249,7 +249,7 @@
 #define FSTYPE_FFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), ffs) == 0)
 #define FSTYPE_FFSLOG(tc)\
-(strcmp(atf_tc_get_md_var(tc, X-fs.type), ffs) == 0)
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), ffslog) == 0)
 #define FSTYPE_LFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), lfs) == 0)
 #define FSTYPE_MSDOS(tc)\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Set an extra xvar indicating MOUNT_FOO


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.29 src/tests/fs/common/h_fsmacros.h:1.30
--- src/tests/fs/common/h_fsmacros.h:1.29	Fri Jan  7 11:58:21 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 12:00:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.29 2011/01/07 11:58:21 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.30 2011/01/07 12:00:34 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -106,6 +106,7 @@
 	{\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
 		atf_tc_set_md_var(tc, X-fs.type, #fs);		\
+		atf_tc_set_md_var(tc, X-fs.mntname, type);		\
 	}\
 	void *fs##func##tmp;		\
 	\
@@ -135,6 +136,7 @@
 	{\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
 		atf_tc_set_md_var(tc, X-fs.type, #_fs_);		\
+		atf_tc_set_md_var(tc, X-fs.mntname, _type_);		\
 	}\
 	void *_fs_##_func_##tmp;	\
 	\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Adjust atf_check_type() to make it work again.
Do we need tests for the tests? ;)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.30 src/tests/fs/common/h_fsmacros.h:1.31
--- src/tests/fs/common/h_fsmacros.h:1.30	Fri Jan  7 12:00:34 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 12:16:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.30 2011/01/07 12:00:34 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.31 2011/01/07 12:16:17 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -112,7 +112,7 @@
 	\
 	ATF_TC_BODY(fs##_##func,tc)	\
 	{\
-		if (!atf_check_fstype(tc, type))			\
+		if (!atf_check_fstype(tc, #fs))\
 			atf_tc_skip(filesystem not selected);		\
 		FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp);		\
 		func(tc,FSTEST_MNTNAME);\
@@ -124,7 +124,7 @@
 	\
 	ATF_TC_CLEANUP(fs##_##func,tc)	\
 	{\
-		if (!atf_check_fstype(tc, type))			\
+		if (!atf_check_fstype(tc, #fs))\
 			return;		\
 		if (fs##_fstest_delfs(tc, fs##func##tmp) != 0)		\
 			atf_tc_fail_errno(delfs failed);		\
@@ -142,7 +142,7 @@
 	\
 	ATF_TC_BODY(_fs_##_##_func_,tc)	\
 	{\
-		if (!atf_check_fstype(tc, _type_))			\
+		if (!atf_check_fstype(tc, #_fs_))			\
 			atf_tc_skip(filesystem not selected);		\
 		FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp);		\
 		_gen_(tc,FSTEST_MNTNAME);\
@@ -160,7 +160,7 @@
 	\
 	ATF_TC_CLEANUP(_fs_##_##_func_,tc)\
 	{\
-		if (!atf_check_fstype(tc, _type_))			\
+		if (!atf_check_fstype(tc, #_fs_))			\
 			return;		\
 		if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0)	\
 			atf_tc_fail_errno(delfs failed);		\



CVS commit: src/tests/fs/common

2011-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan  7 19:54:48 UTC 2011

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Apparently the atf in the qemu runs doesn't like p2k_ffs and hangs
completely.  Remove it for until I have a chance to debug what's
going on.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.31 src/tests/fs/common/h_fsmacros.h:1.32
--- src/tests/fs/common/h_fsmacros.h:1.31	Fri Jan  7 12:16:17 2011
+++ src/tests/fs/common/h_fsmacros.h	Fri Jan  7 19:54:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.31 2011/01/07 12:16:17 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.32 2011/01/07 19:54:48 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -176,7 +176,6 @@
   ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc)	\
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc)\
   ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc)	\
-  ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc)\
   ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc)\
   ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc)\
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc)\
@@ -189,7 +188,6 @@
   ATF_TP_FSADD(lfs,func);		\
   ATF_TP_FSADD(msdosfs,func);		\
   ATF_TP_FSADD(nfs,func);		\
-  ATF_TP_FSADD(p2k_ffs,func);		\
   ATF_TP_FSADD(puffs,func);		\
   ATF_TP_FSADD(rumpfs,func);		\
   ATF_TP_FSADD(sysvbfs,func);		\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Sprinkle some KNF.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.22 src/tests/fs/common/h_fsmacros.h:1.23
--- src/tests/fs/common/h_fsmacros.h:1.22	Thu Nov 11 17:39:29 2010
+++ src/tests/fs/common/h_fsmacros.h	Fri Dec 31 18:12:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.22 2010/11/11 17:39:29 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.23 2010/12/31 18:12:51 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -97,77 +97,80 @@
 		atf_tc_fail_errno(delfs failed);			\
 } while (/*CONSTCOND*/0);
 
-#define ATF_TC_FSADD(fs,type,func,desc) \
-  ATF_TC_WITH_CLEANUP(fs##_##func); \
-  ATF_TC_HEAD(fs##_##func,tc) \
-  { \
-atf_tc_set_md_var(tc, descr, type  test for  desc); \
-atf_tc_set_md_var(tc, X-fs.type, type); \
-  } \
-  void *fs##func##tmp; \
-  ATF_TC_BODY(fs##_##func,tc) \
-  { \
-if (!atf_check_fstype(tc, type)) \
-  atf_tc_skip(filesystem not selected); \
-FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp); \
-func(tc,FSTEST_MNTNAME); \
-if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) { \
-  rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
-  atf_tc_fail_errno(unmount failed); \
-} \
-  } \
-  ATF_TC_CLEANUP(fs##_##func,tc) \
-  { \
-if (!atf_check_fstype(tc, type)) \
-  return; \
-if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \
-  atf_tc_fail_errno(delfs failed); \
-  }
+#define ATF_TC_FSADD(fs,type,func,desc)	\
+	ATF_TC_WITH_CLEANUP(fs##_##func);\
+	ATF_TC_HEAD(fs##_##func,tc)	\
+	{\
+		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
+		atf_tc_set_md_var(tc, X-fs.type, type);		\
+	}\
+	void *fs##func##tmp;		\
+	\
+	ATF_TC_BODY(fs##_##func,tc)	\
+	{\
+		if (!atf_check_fstype(tc, type))			\
+			atf_tc_skip(filesystem not selected);		\
+		FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp);		\
+		func(tc,FSTEST_MNTNAME);\
+		if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {	\
+			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
+			atf_tc_fail_errno(unmount failed);		\
+		}			\
+	}\
+	\
+	ATF_TC_CLEANUP(fs##_##func,tc)	\
+	{\
+		if (!atf_check_fstype(tc, type))			\
+			return;		\
+		if (fs##_fstest_delfs(tc, fs##func##tmp) != 0)		\
+			atf_tc_fail_errno(delfs failed);		\
+	}
 
-#define ATF_TP_FSADD(fs,func) \
+#define ATF_TP_FSADD(fs,func)		\
   ATF_TP_ADD_TC(tp,fs##_##func)
 
-#define ATF_TC_FSAPPLY(func,desc) \
-  ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \
-  ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
-  ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
-  ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
-  ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
-  ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
-  ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
-  ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
+#define ATF_TC_FSAPPLY(func,desc)	\
+  ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc)\
+  ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc)	\
+  ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc)	\
+  ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc)\
+  ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc)	\
+  ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc)\
+  ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc)\
+  ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc)\
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
 
-#define ATF_TP_FSAPPLY(func) \
-  ATF_TP_FSADD(ext2fs,func); \
-  ATF_TP_FSADD(ffs,func); \
-  ATF_TP_FSADD(lfs,func); \
-  ATF_TP_FSADD(msdosfs,func); \
-  ATF_TP_FSADD(nfs,func); \
-  ATF_TP_FSADD(puffs,func); \
-  ATF_TP_FSADD(rumpfs,func); \
-  ATF_TP_FSADD(sysvbfs,func); \
+#define ATF_TP_FSAPPLY(func)		\
+  ATF_TP_FSADD(ext2fs,func);		\
+  ATF_TP_FSADD(ffs,func);		\
+  ATF_TP_FSADD(lfs,func);		\
+  ATF_TP_FSADD(msdosfs,func);		\
+  ATF_TP_FSADD(nfs,func);		\
+  ATF_TP_FSADD(puffs,func);		\
+  ATF_TP_FSADD(rumpfs,func);		\
+  ATF_TP_FSADD(sysvbfs,func);		\
   ATF_TP_FSADD(tmpfs,func);
 
-#define ATF_FSAPPLY(func,desc) \
-  ATF_TC_FSAPPLY(func,desc); \
-  ATF_TP_ADD_TCS(tp) \
-  { \
-ATF_TP_FSAPPLY(func); \
-return atf_no_error(); \
-  }
+#define ATF_FSAPPLY(func,desc)		\
+	ATF_TC_FSAPPLY(func,desc);	\
+	ATF_TP_ADD_TCS(tp)		\
+	{\
+		ATF_TP_FSAPPLY(func);	\
+		return atf_no_error();	\
+	}
 
 static __inline bool
 atf_check_fstype(const atf_tc_t *tc, const char *fs)
 {
-  const char *fstype;
+	const char *fstype;
+
+	if (!atf_tc_has_config_var(tc, fstype))
+		return true;
 
-  if (!atf_tc_has_config_var(tc, fstype))
-return true;
-  fstype = 

CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Introduce r/o tests.  They do two mounts: the first one is r/w and
runs a generator which primes the fs.  The second one is r/o and
does the actual testing.  Also, introduce a nfsro fstype which does
a clientside r/w mount for a r/o server export.

requested by yamt

(one nfsro test currently fails with EROFS vs. EACCES.  Hopefully
someone else can debate the correct errno)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.23 src/tests/fs/common/h_fsmacros.h:1.24
--- src/tests/fs/common/h_fsmacros.h:1.23	Fri Dec 31 18:12:51 2010
+++ src/tests/fs/common/h_fsmacros.h	Fri Dec 31 18:16:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.23 2010/12/31 18:12:51 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.24 2010/12/31 18:16:41 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -54,6 +54,7 @@
 FSPROTOS(lfs);
 FSPROTOS(msdosfs);
 FSPROTOS(nfs);
+FSPROTOS(nfsro);
 FSPROTOS(puffs);
 FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
@@ -126,6 +127,41 @@
 			atf_tc_fail_errno(delfs failed);		\
 	}
 
+#define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_)		\
+	ATF_TC_WITH_CLEANUP(_fs_##_##_func_);\
+	ATF_TC_HEAD(_fs_##_##_func_,tc)	\
+	{\
+		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
+		atf_tc_set_md_var(tc, X-fs.type, _type_);		\
+	}\
+	void *_fs_##_func_##tmp;	\
+	\
+	ATF_TC_BODY(_fs_##_##_func_,tc)	\
+	{\
+		if (!atf_check_fstype(tc, _type_))			\
+			atf_tc_skip(filesystem not selected);		\
+		FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp);		\
+		_gen_(tc,FSTEST_MNTNAME);\
+		if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0)	\
+			atf_tc_fail_errno(unmount r/w failed);	\
+		if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp,		\
+		FSTEST_MNTNAME, MNT_RDONLY) != 0)			\
+		atf_tc_fail_errno(mount ro failed);			\
+		_func_(tc,FSTEST_MNTNAME);\
+		if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {\
+			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
+			atf_tc_fail_errno(unmount failed);		\
+		}			\
+	}\
+	\
+	ATF_TC_CLEANUP(_fs_##_##_func_,tc)\
+	{\
+		if (!atf_check_fstype(tc, _type_))			\
+			return;		\
+		if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0)	\
+			atf_tc_fail_errno(delfs failed);		\
+	}
+
 #define ATF_TP_FSADD(fs,func)		\
   ATF_TP_ADD_TC(tp,fs##_##func)
 
@@ -151,6 +187,33 @@
   ATF_TP_FSADD(sysvbfs,func);		\
   ATF_TP_FSADD(tmpfs,func);
 
+/*
+ * Same as above, but generate a file system image first and perform
+ * tests for a r/o mount.
+ *
+ * Missing the following file systems:
+ *   + lfs (fstest_lfs routines cannot handle remount.  FIXME!)
+ *   + tmpfs (memory backend)
+ *   + rumpfs (memory backend)
+ *   + puffs (memory backend, but could be run in theory)
+ */
+
+#define ATF_TC_FSAPPLY_RO(func,desc,gen)\
+  ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen)			\
+  ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen)\
+  ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen)			\
+  ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen)\
+  ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen)			\
+  ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen)
+
+#define ATF_TP_FSAPPLY_RO(func)		\
+  ATF_TP_FSADD(ext2fs,func);		\
+  ATF_TP_FSADD(ffs,func);		\
+  ATF_TP_FSADD(msdosfs,func);		\
+  ATF_TP_FSADD(nfs,func);		\
+  ATF_TP_FSADD(nfsro,func);		\
+  ATF_TP_FSADD(sysvbfs,func);
+
 #define ATF_FSAPPLY(func,desc)		\
 	ATF_TC_FSAPPLY(func,desc);	\
 	ATF_TP_ADD_TCS(tp)		\



CVS commit: src/tests/fs/common

2010-12-29 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 29 22:56:59 UTC 2010

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
don't assume atomic read/write on socketpair.  puffs_kargs at least is
too large to assume atomic read/write.  this makes some tests including
fs/puffs/t_basic pass on my environment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/common/fstest_puffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.6 src/tests/fs/common/fstest_puffs.c:1.7
--- src/tests/fs/common/fstest_puffs.c:1.6	Mon Nov  1 16:27:07 2010
+++ src/tests/fs/common/fstest_puffs.c	Wed Dec 29 22:56:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.6 2010/11/01 16:27:07 pooka Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.7 2010/12/29 22:56:59 yamt Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -55,6 +55,44 @@
 
 static bool mayquit = false;
 
+static ssize_t
+xread(int fd, void *vp, size_t n)
+{
+	size_t left;
+
+	left = n;
+	do {
+		ssize_t ssz;
+
+		ssz = read(fd, vp, left);
+		if (ssz == -1) {
+			return ssz;
+		}
+		left -= ssz;
+		vp = (char *)vp + ssz;
+	} while (left  0);
+	return n;
+}
+
+static ssize_t
+xwrite(int fd, const void *vp, size_t n)
+{
+	size_t left;
+
+	left = n;
+	do {
+		ssize_t ssz;
+
+		ssz = write(fd, vp, left);
+		if (ssz == -1) {
+			return ssz;
+		}
+		left -= ssz;
+		vp = (const char *)vp + ssz;
+	} while (left  0);
+	return n;
+}
+
 /*
  * Threads which shovel data between comfd and /dev/puffs.
  * (cannot use polling since fd's are in different namespaces)
@@ -102,7 +140,7 @@
 		}
 
 		n = phdr-pth_framelen;
-		if (write(comfd, buf, n) != n) {
+		if (xwrite(comfd, buf, n) != n) {
 			fprintf(stderr, readshovel write %zd / %d\n, n, errno);
 			break;
 		}
@@ -143,7 +181,7 @@
 		toread = sizeof(struct putter_hdr);
 		assert(toread  BUFSIZE);
 		do {
-			n = read(comfd, buf+off, toread);
+			n = xread(comfd, buf+off, toread);
 			if (n = 0) {
 fprintf(stderr, writeshovel read %zd / %d\n,
 n, errno);
@@ -269,30 +307,30 @@
 	}
 
 	/* read args */
-	if ((n = read(sv[1], len, sizeof(len))) != sizeof(len))
+	if ((n = xread(sv[1], len, sizeof(len))) != sizeof(len))
 		err(1, mp 1 %zd, n);
 	if (len  MAXPATHLEN)
 		err(1, mntpath  MAXPATHLEN);
-	if ((size_t)read(sv[1], args-pta_dir, len) != len)
+	if ((size_t)xread(sv[1], args-pta_dir, len) != len)
 		err(1, mp 2);
-	if (read(sv[1], len, sizeof(len)) != sizeof(len))
+	if (xread(sv[1], len, sizeof(len)) != sizeof(len))
 		err(1, fn 1);
 	if (len  MAXPATHLEN)
 		err(1, devpath  MAXPATHLEN);
-	if ((size_t)read(sv[1], args-pta_dev, len) != len)
+	if ((size_t)xread(sv[1], args-pta_dev, len) != len)
 		err(1, fn 2);
-	if (read(sv[1], mntflags, sizeof(mntflags)) != sizeof(mntflags))
+	if (xread(sv[1], mntflags, sizeof(mntflags)) != sizeof(mntflags))
 		err(1, mntflags);
-	if (read(sv[1], args-pta_pargslen, sizeof(args-pta_pargslen))
+	if (xread(sv[1], args-pta_pargslen, sizeof(args-pta_pargslen))
 	!= sizeof(args-pta_pargslen))
 		err(1, puffstest_args len);
 	args-pta_pargs = malloc(args-pta_pargslen);
 	if (args-pta_pargs == NULL)
 		err(1, malloc);
-	if (read(sv[1], args-pta_pargs, args-pta_pargslen)
+	if (xread(sv[1], args-pta_pargs, args-pta_pargslen)
 	!= (ssize_t)args-pta_pargslen)
 		err(1, puffstest_args);
-	if (read(sv[1], pflags, sizeof(*pflags)) != sizeof(*pflags))
+	if (xread(sv[1], pflags, sizeof(*pflags)) != sizeof(*pflags))
 		err(1, pflags);
 
 	args-pta_childpid = childpid;



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: Makefile h_fsmacros.h
Added Files:
src/tests/fs/common: fstest_rumpfs.c

Log Message:
Add rumpfs to list of file systems to be autotested.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/fstest_rumpfs.c
cvs rdiff -u -r1.21 -r1.22 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.5 src/tests/fs/common/Makefile:1.6
--- src/tests/fs/common/Makefile:1.5	Tue Aug  3 17:24:45 2010
+++ src/tests/fs/common/Makefile	Thu Nov 11 17:39:29 2010
@@ -1,11 +1,12 @@
-#	$NetBSD: Makefile,v 1.5 2010/08/03 17:24:45 drochner Exp $
+#	$NetBSD: Makefile,v 1.6 2010/11/11 17:39:29 pooka Exp $
 #
 
 .include bsd.own.mk
 
 LIB=	vfstest
 SRCS=	fstest_ext2fs.c fstest_ffs.c fstest_lfs.c fstest_msdosfs.c	\
-	fstest_nfs.c fstest_puffs.c fstest_sysvbfs.c fstest_tmpfs.c
+	fstest_nfs.c fstest_puffs.c fstest_rumpfs.c fstest_sysvbfs.c	\
+	fstest_tmpfs.c
 
 WARNS=	3
 

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.21 src/tests/fs/common/h_fsmacros.h:1.22
--- src/tests/fs/common/h_fsmacros.h:1.21	Sun Nov  7 17:51:17 2010
+++ src/tests/fs/common/h_fsmacros.h	Thu Nov 11 17:39:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.21 2010/11/07 17:51:17 jmmv Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.22 2010/11/11 17:39:29 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -55,6 +55,7 @@
 FSPROTOS(msdosfs);
 FSPROTOS(nfs);
 FSPROTOS(puffs);
+FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
 
@@ -133,6 +134,7 @@
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
   ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
   ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
+  ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
 
@@ -143,6 +145,7 @@
   ATF_TP_FSADD(msdosfs,func); \
   ATF_TP_FSADD(nfs,func); \
   ATF_TP_FSADD(puffs,func); \
+  ATF_TP_FSADD(rumpfs,func); \
   ATF_TP_FSADD(sysvbfs,func); \
   ATF_TP_FSADD(tmpfs,func);
 
@@ -179,6 +182,8 @@
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_NFS) == 0)
 #define FSTYPE_PUFFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_PUFFS) == 0)
+#define FSTYPE_RUMPFS(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_RUMPFS) == 0)
 #define FSTYPE_SYSVBFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_SYSVBFS) == 0)
 #define FSTYPE_TMPFS(tc)\

Added files:

Index: src/tests/fs/common/fstest_rumpfs.c
diff -u /dev/null src/tests/fs/common/fstest_rumpfs.c:1.1
--- /dev/null	Thu Nov 11 17:39:29 2010
+++ src/tests/fs/common/fstest_rumpfs.c	Thu Nov 11 17:39:29 2010
@@ -0,0 +1,83 @@
+/*	$NetBSD: fstest_rumpfs.c,v 1.1 2010/11/11 17:39:29 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nicolas Joly.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/mount.h
+#include sys/stat.h
+
+#include atf-c.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include h_fsmacros.h
+
+int
+rumpfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
+off_t size, void *fspriv)
+{
+
+	return rump_init();
+}
+
+int
+rumpfs_fstest_delfs(const atf_tc_t *tc, 

CVS commit: src/tests/fs/common

2010-11-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Nov  1 16:27:08 UTC 2010

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
Make the shovel threads resilient to file server exit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/common/fstest_puffs.c

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.5 src/tests/fs/common/fstest_puffs.c:1.6
--- src/tests/fs/common/fstest_puffs.c:1.5	Sun Oct 31 22:33:16 2010
+++ src/tests/fs/common/fstest_puffs.c	Mon Nov  1 16:27:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.5 2010/10/31 22:33:16 pgoyette Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.6 2010/11/01 16:27:07 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@
 #define BUFSIZE (128*1024)
 #define DTFS_DUMP -o,dump
 
+static bool mayquit = false;
+
 /*
  * Threads which shovel data between comfd and /dev/puffs.
  * (cannot use polling since fd's are in different namespaces)
@@ -64,6 +66,7 @@
 	struct puffs_req *preq;
 	struct puffstestargs *args = arg;
 	char buf[BUFSIZE];
+	ssize_t n;
 	int comfd, puffsfd;
 
 	comfd = args-pta_servfd;
@@ -75,8 +78,6 @@
 	rump_pub_lwproc_newlwp(1);
 
 	for (;;) {
-		ssize_t n;
-
 		n = rump_sys_read(puffsfd, buf, sizeof(*phdr));
 		if (n = 0) {
 			fprintf(stderr, readshovel r1 %zd / %d\n, n, errno);
@@ -107,7 +108,9 @@
 		}
 	}
 
-	abort();
+	if (n != 0  mayquit == false)
+		abort();
+	return NULL;
 }
 
 static void *
@@ -115,8 +118,10 @@
 {
 	struct puffstestargs *args = arg;
 	struct putter_hdr *phdr;
+	struct puffs_req *preq;
 	char buf[BUFSIZE];
 	size_t toread;
+	ssize_t n;
 	int comfd, puffsfd;
 
 	rump_pub_lwproc_newlwp(1);
@@ -125,10 +130,10 @@
 	puffsfd = args-pta_rumpfd;
 
 	phdr = (struct putter_hdr *)buf;
+	preq = (void *)buf;
 
 	for (;;) {
 		uint64_t off;
-		ssize_t n;
 
 		/*
 		 * Need to write everything to the kernel in one chunk,
@@ -142,7 +147,7 @@
 			if (n = 0) {
 fprintf(stderr, writeshovel read %zd / %d\n,
 n, errno);
-break;
+goto out;
 			}
 			off += n;
 			if (off = sizeof(struct putter_hdr))
@@ -151,6 +156,13 @@
 toread = off - sizeof(struct putter_hdr);
 		} while (toread);
 
+		if (__predict_false(
+		PUFFSOP_OPCLASS(preq-preq_opclass) == PUFFSOP_VFS
+		 preq-preq_optype == PUFFS_VFS_UNMOUNT)) {
+			if (preq-preq_rv == 0)
+mayquit = true;
+		}
+
 		n = rump_sys_write(puffsfd, buf, phdr-pth_framelen);
 		if ((size_t)n != phdr-pth_framelen) {
 			fprintf(stderr, writeshovel wr %zd / %d\n, n, errno);
@@ -158,7 +170,10 @@
 		}
 	}
 
-	abort();
+ out:
+	if (n != 0)
+		abort();
+	return NULL;
 }
 
 static void



CVS commit: src/tests/fs/common

2010-10-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Oct 31 22:05:35 UTC 2010

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
Since rump implicit threads now bind to proc1 instead of proc0, we
need our shovel threads bound to proc1 instead of proc0 in order
to have access to the same set of descriptors as the implicit thread
which opens the fd in the rump kernel.

Also, sprinkle some printfs and make failure more dramatic.

fixes the puffs tests.  pointed out by pgoyette.


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

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.3 src/tests/fs/common/fstest_puffs.c:1.4
--- src/tests/fs/common/fstest_puffs.c:1.3	Wed Sep  1 19:41:27 2010
+++ src/tests/fs/common/fstest_puffs.c	Sun Oct 31 22:05:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.3 2010/09/01 19:41:27 pooka Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.4 2010/10/31 22:05:35 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -72,20 +72,24 @@
 	phdr = (void *)buf;
 	preq = (void *)buf;
 
-	rump_pub_lwproc_newlwp(0);
+	rump_pub_lwproc_newlwp(1);
 
 	for (;;) {
 		ssize_t n;
 
 		n = rump_sys_read(puffsfd, buf, sizeof(*phdr));
-		if (n = 0)
+		if (n = 0) {
+			fprintf(stderr, readshovel r1 %d / %d\n, n, errno);
 			break;
+		}
 
 		assert(phdr-pth_framelen  BUFSIZE);
 		n = rump_sys_read(puffsfd, buf+sizeof(*phdr), 
 		phdr-pth_framelen - sizeof(*phdr));
-		if (n = 0)
+		if (n = 0) {
+			fprintf(stderr, readshovel r2 %d / %d\n, n, errno);
 			break;
+		}
 
 		/* Analyze request */
 		if (PUFFSOP_OPCLASS(preq-preq_opclass) == PUFFSOP_VFS) {
@@ -97,11 +101,13 @@
 		}
 
 		n = phdr-pth_framelen;
-		if (write(comfd, buf, n) != n)
+		if (write(comfd, buf, n) != n) {
+			fprintf(stderr, readshovel write %d / %d\n, n, errno);
 			break;
+		}
 	}
 
-	return NULL;
+	abort();
 }
 
 static void *
@@ -113,7 +119,7 @@
 	size_t toread;
 	int comfd, puffsfd;
 
-	rump_pub_lwproc_newlwp(0);
+	rump_pub_lwproc_newlwp(1);
 
 	comfd = args-pta_servfd;
 	puffsfd = args-pta_rumpfd;
@@ -134,6 +140,8 @@
 		do {
 			n = read(comfd, buf+off, toread);
 			if (n = 0) {
+fprintf(stderr, writeshovel read %d / %d\n,
+n, errno);
 break;
 			}
 			off += n;
@@ -144,11 +152,13 @@
 		} while (toread);
 
 		n = rump_sys_write(puffsfd, buf, phdr-pth_framelen);
-		if ((size_t)n != phdr-pth_framelen)
+		if ((size_t)n != phdr-pth_framelen) {
+			fprintf(stderr, writeshovel wr %d / %d\n, n, errno);
 			break;
+		}
 	}
 
-	return NULL;
+	abort();
 }
 
 static void



CVS commit: src/tests/fs/common

2010-10-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Oct 31 22:33:16 UTC 2010

Modified Files:
src/tests/fs/common: fstest_puffs.c

Log Message:
Fix format strings so it builds on amd64


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

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

Modified files:

Index: src/tests/fs/common/fstest_puffs.c
diff -u src/tests/fs/common/fstest_puffs.c:1.4 src/tests/fs/common/fstest_puffs.c:1.5
--- src/tests/fs/common/fstest_puffs.c:1.4	Sun Oct 31 22:05:35 2010
+++ src/tests/fs/common/fstest_puffs.c	Sun Oct 31 22:33:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_puffs.c,v 1.4 2010/10/31 22:05:35 pooka Exp $	*/
+/*	$NetBSD: fstest_puffs.c,v 1.5 2010/10/31 22:33:16 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
 
 		n = rump_sys_read(puffsfd, buf, sizeof(*phdr));
 		if (n = 0) {
-			fprintf(stderr, readshovel r1 %d / %d\n, n, errno);
+			fprintf(stderr, readshovel r1 %zd / %d\n, n, errno);
 			break;
 		}
 
@@ -87,7 +87,7 @@
 		n = rump_sys_read(puffsfd, buf+sizeof(*phdr), 
 		phdr-pth_framelen - sizeof(*phdr));
 		if (n = 0) {
-			fprintf(stderr, readshovel r2 %d / %d\n, n, errno);
+			fprintf(stderr, readshovel r2 %zd / %d\n, n, errno);
 			break;
 		}
 
@@ -102,7 +102,7 @@
 
 		n = phdr-pth_framelen;
 		if (write(comfd, buf, n) != n) {
-			fprintf(stderr, readshovel write %d / %d\n, n, errno);
+			fprintf(stderr, readshovel write %zd / %d\n, n, errno);
 			break;
 		}
 	}
@@ -140,7 +140,7 @@
 		do {
 			n = read(comfd, buf+off, toread);
 			if (n = 0) {
-fprintf(stderr, writeshovel read %d / %d\n,
+fprintf(stderr, writeshovel read %zd / %d\n,
 n, errno);
 break;
 			}
@@ -153,7 +153,7 @@
 
 		n = rump_sys_write(puffsfd, buf, phdr-pth_framelen);
 		if ((size_t)n != phdr-pth_framelen) {
-			fprintf(stderr, writeshovel wr %d / %d\n, n, errno);
+			fprintf(stderr, writeshovel wr %zd / %d\n, n, errno);
 			break;
 		}
 	}



CVS commit: src/tests/fs/common/nfsrpc

2010-09-23 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Thu Sep 23 09:38:14 UTC 2010

Modified Files:
src/tests/fs/common/nfsrpc: clnt_bcast.c namespace.h rpc_generic.c
rpcb_clnt.c svc.c svc_dg.c svc_vc.c

Log Message:
Do symbol renaming for these bits as well, so that we don't get
link-time errors caused by conflicts with normal user-space libraries
when we link statically.

The tests still pass for i386 after this set of changes, and this now
builds for sun2 (after a few more changes).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/nfsrpc/clnt_bcast.c \
src/tests/fs/common/nfsrpc/namespace.h \
src/tests/fs/common/nfsrpc/rpc_generic.c \
src/tests/fs/common/nfsrpc/rpcb_clnt.c \
src/tests/fs/common/nfsrpc/svc_dg.c
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/common/nfsrpc/svc.c
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/nfsrpc/svc_vc.c

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

Modified files:

Index: src/tests/fs/common/nfsrpc/clnt_bcast.c
diff -u src/tests/fs/common/nfsrpc/clnt_bcast.c:1.1 src/tests/fs/common/nfsrpc/clnt_bcast.c:1.2
--- src/tests/fs/common/nfsrpc/clnt_bcast.c:1.1	Mon Jul 26 15:56:45 2010
+++ src/tests/fs/common/nfsrpc/clnt_bcast.c	Thu Sep 23 09:38:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: clnt_bcast.c,v 1.1 2010/07/26 15:56:45 pooka Exp $	*/
+/*	$NetBSD: clnt_bcast.c,v 1.2 2010/09/23 09:38:14 he Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro;
 #else
-__RCSID($NetBSD: clnt_bcast.c,v 1.1 2010/07/26 15:56:45 pooka Exp $);
+__RCSID($NetBSD: clnt_bcast.c,v 1.2 2010/09/23 09:38:14 he Exp $);
 #endif
 #endif
 
@@ -113,6 +113,11 @@
  * also here it will get two responses ... inefficient and clumsy.
  */
 
+#ifdef __weak_alias
+__weak_alias(rpc_broadcast_exp,_rpc_broadcast_exp)
+__weak_alias(rpc_broadcast,_rpc_broadcast)
+#endif
+
 struct broadif {
 	int index;
 	struct sockaddr_storage broadaddr;
Index: src/tests/fs/common/nfsrpc/namespace.h
diff -u src/tests/fs/common/nfsrpc/namespace.h:1.1 src/tests/fs/common/nfsrpc/namespace.h:1.2
--- src/tests/fs/common/nfsrpc/namespace.h:1.1	Mon Jul 26 15:56:45 2010
+++ src/tests/fs/common/nfsrpc/namespace.h	Thu Sep 23 09:38:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.1 2010/07/26 15:56:45 pooka Exp $	*/
+/*	$NetBSD: namespace.h,v 1.2 2010/09/23 09:38:14 he Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -52,4 +52,40 @@
 #define svcraw_lock		__rpc_svcraw_lock
 #define xprtlist_lock		__rpc_xprtlist_lock
 
+/* NFS server stuff */
+#define svc_dg_create		_svc_dg_create
+
+#define rpc_broadcast		_rpc_broadcast
+#define rpc_broadcast_exp	_rpc_broadcast_exp
+
+#define svc_fd_create		_svc_fd_create
+#define svc_vc_create		_svc_vc_create
+#define svc_getreq  _svc_getreq
+#define svc_getreqset   _svc_getreqset
+#define svc_getreq_common   _svc_getreq_common
+#define svc_register_svc_register
+#define svc_reg _svc_reg
+#define svc_unreg   _svc_unreg
+#define svc_sendreply   _svc_sendreply
+#define svc_unregister  _svc_unregister
+#define svcerr_auth _svcerr_auth
+#define svcerr_decode   _svcerr_decode
+#define svcerr_noproc   _svcerr_noproc
+#define svcerr_noprog   _svcerr_noprog
+#define svcerr_progvers _svcerr_progvers
+#define svcerr_systemerr_svcerr_systemerr
+#define svcerr_weakauth _svcerr_weakauth
+#define xprt_register   _xprt_register
+#define xprt_unregister _xprt_unregister
+#define rpc_control _rpc_control
+
+#define taddr2uaddr		_taddr2uaddr
+#define uaddr2taddr		_uaddr2taddr
+
+#define rpcb_set		_rpcb_set
+#define rpcb_unset		_rpcb_unset
+#define rpcb_getmaps		_rpcb_getmaps
+#define rpcb_taddr2uaddr	_rpcb_taddr2uaddr
+#define rpcb_uaddr2taddr	_rpcb_uaddr2taddr
+
 #endif /* _NAMESPACE_H_ */
Index: src/tests/fs/common/nfsrpc/rpc_generic.c
diff -u src/tests/fs/common/nfsrpc/rpc_generic.c:1.1 src/tests/fs/common/nfsrpc/rpc_generic.c:1.2
--- src/tests/fs/common/nfsrpc/rpc_generic.c:1.1	Mon Jul 26 15:56:45 2010
+++ src/tests/fs/common/nfsrpc/rpc_generic.c	Thu Sep 23 09:38:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_generic.c,v 1.1 2010/07/26 15:56:45 pooka Exp $	*/
+/*	$NetBSD: rpc_generic.c,v 1.2 2010/09/23 09:38:14 he Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: rpc_generic.c,v 1.1 2010/07/26 15:56:45 pooka Exp $);
+__RCSID($NetBSD: rpc_generic.c,v 1.2 2010/09/23 09:38:14 he Exp $);
 #endif
 
 #include namespace.h
@@ -69,6 +69,11 @@
 #include rump/rump.h
 #include rump/rump_syscalls.h
 
+#ifdef __weak_alias
+__weak_alias(taddr2uaddr,_taddr2uaddr)

CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
include some necessary headers to fix build


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.19 src/tests/fs/common/h_fsmacros.h:1.20
--- src/tests/fs/common/h_fsmacros.h:1.19	Wed Aug 25 18:16:06 2010
+++ src/tests/fs/common/h_fsmacros.h	Thu Aug 26 08:19:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.19 2010/08/25 18:16:06 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.20 2010/08/26 08:19:18 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -38,6 +38,10 @@
 #include puffsdump.h
 #include string.h
 
+#include rump/rump.h
+
+#include ../../h_macros.h
+
 #define FSPROTOS(_fs_)			\
 int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *,	\
 			off_t, void *);	\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
allow overriding of defaults


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.17 src/tests/fs/common/h_fsmacros.h:1.18
--- src/tests/fs/common/h_fsmacros.h:1.17	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/common/h_fsmacros.h	Mon Aug  9 19:32:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.17 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.18 2010/08/09 19:32:26 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -54,9 +54,15 @@
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
 
+#ifndef FSTEST_IMGNAME
 #define FSTEST_IMGNAME image.fs
+#endif
+#ifndef FSTEST_IMGSIZE
 #define FSTEST_IMGSIZE (1 * 512)
+#endif
+#ifndef FSTEST_MNTNAME
 #define FSTEST_MNTNAME /mnt
+#endif
 
 #define FSTEST_CONSTRUCTOR(_tc_, _fs_, _args_)\
 do {	\



CVS commit: src/tests/fs/common

2010-07-30 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 30 10:23:26 UTC 2010

Modified Files:
src/tests/fs/common: fstest_nfs.c

Log Message:
Wait for child (rumpnfsd) to die before declaring unmount successful.
(yes, should be in delfs, but delfs doesn't work due to the cleanup hassle)


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

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

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.1 src/tests/fs/common/fstest_nfs.c:1.2
--- src/tests/fs/common/fstest_nfs.c:1.1	Thu Jul 29 14:15:47 2010
+++ src/tests/fs/common/fstest_nfs.c	Fri Jul 30 10:23:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.1 2010/07/29 14:15:47 pooka Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.2 2010/07/30 10:23:26 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -196,6 +196,7 @@
 nfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
 	struct nfstestargs *args = theargs;
+	int status;
 
 	if (rump_sys_unmount(path, flags) == -1) {
 		return errno;
@@ -212,9 +213,11 @@
 	 * to send some unmount RPCs, leading to sticky situations.
 	 */
 	kill(args-ta_childpid, SIGKILL);
+	wait(status);
 
 	/* remove ethernet bus */
-	unlink(args-ta_ethername);
+	if (unlink(args-ta_ethername) == -1)
+		atf_tc_fail_errno(unlink ethername);
 
 	return 0;
 }



CVS commit: src/tests/fs/common

2010-07-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jul 29 14:15:47 UTC 2010

Modified Files:
src/tests/fs/common: Makefile
Added Files:
src/tests/fs/common: fstest_ext2fs.c fstest_ffs.c fstest_lfs.c
fstest_msdosfs.c fstest_nfs.c fstest_puffs.c fstest_sysvbfs.c
fstest_tmpfs.c
Removed Files:
src/tests/fs/common: ext2fs.c ffs.c lfs.c msdosfs.c nfs.c puffs.c
sysvbfs.c tmpfs.c

Log Message:
Rename xfs.c to fstest_xfs.c to avoid collisions with other
source files with the name xfs.c

ok njoly


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/Makefile
cvs rdiff -u -r1.5 -r0 src/tests/fs/common/ext2fs.c src/tests/fs/common/ffs.c \
src/tests/fs/common/msdosfs.c src/tests/fs/common/sysvbfs.c \
src/tests/fs/common/tmpfs.c
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/fstest_ext2fs.c \
src/tests/fs/common/fstest_ffs.c src/tests/fs/common/fstest_lfs.c \
src/tests/fs/common/fstest_msdosfs.c src/tests/fs/common/fstest_nfs.c \
src/tests/fs/common/fstest_puffs.c src/tests/fs/common/fstest_sysvbfs.c \
src/tests/fs/common/fstest_tmpfs.c
cvs rdiff -u -r1.7 -r0 src/tests/fs/common/lfs.c
cvs rdiff -u -r1.2 -r0 src/tests/fs/common/nfs.c
cvs rdiff -u -r1.4 -r0 src/tests/fs/common/puffs.c

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.2 src/tests/fs/common/Makefile:1.3
--- src/tests/fs/common/Makefile:1.2	Mon Jul 26 16:15:49 2010
+++ src/tests/fs/common/Makefile	Thu Jul 29 14:15:46 2010
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.2 2010/07/26 16:15:49 pooka Exp $
+#	$NetBSD: Makefile,v 1.3 2010/07/29 14:15:46 pooka Exp $
 #
 
 .include bsd.own.mk
 
 LIB=	vfstest
-SRCS=	ext2fs.c ffs.c lfs.c msdosfs.c nfs.c puffs.c sysvbfs.c tmpfs.c
+SRCS=	fstest_ext2fs.c fstest_ffs.c fstest_lfs.c fstest_msdosfs.c	\
+	fstest_nfs.c fstest_puffs.c fstest_sysvbfs.c fstest_tmpfs.c
 
 WARNS=	3
 

Added files:

Index: src/tests/fs/common/fstest_ext2fs.c
diff -u /dev/null src/tests/fs/common/fstest_ext2fs.c:1.1
--- /dev/null	Thu Jul 29 14:15:47 2010
+++ src/tests/fs/common/fstest_ext2fs.c	Thu Jul 29 14:15:46 2010
@@ -0,0 +1,139 @@
+/*	$NetBSD: fstest_ext2fs.c,v 1.1 2010/07/29 14:15:46 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nicolas Joly.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/mount.h
+#include sys/stat.h
+
+#include atf-c.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ufs/ufs/ufsmount.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include h_fsmacros.h
+
+struct ext2fstestargs {
+struct ufs_args ta_uargs;
+char ta_devpath[MAXPATHLEN];
+char ta_imgpath[MAXPATHLEN];
+};
+
+int
+ext2fs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
+off_t size)
+{
+	char cmd[1024];
+	int res;
+	static unsigned int num = 0;
+	struct ext2fstestargs *args;
+
+	size /= 512;
+	snprintf(cmd, 1024, newfs_ext2fs -F -s %PRId64 %s /dev/null,
+	size, image);
+	res = system(cmd);
+	if (res != 0)
+		return res;
+
+	res = rump_init();
+	if (res != 0)
+		return res;
+
+	args = calloc(1, sizeof(*args));
+	if (args == NULL)
+		return -1;
+
+	snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.ext2fs, num);
+	snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
+	args-ta_uargs.fspec = args-ta_devpath;
+
+	res = rump_pub_etfs_register(args-ta_devpath, image, RUMP_ETFS_BLK);
+	if (res != 0) {

CVS commit: src/tests/fs/common

2010-07-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jul 29 14:47:45 UTC 2010

Modified Files:
src/tests/fs/common: Makefile fstest_lfs.c

Log Message:
Include  use lfs megamaid.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/common/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/fstest_lfs.c

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.3 src/tests/fs/common/Makefile:1.4
--- src/tests/fs/common/Makefile:1.3	Thu Jul 29 14:15:46 2010
+++ src/tests/fs/common/Makefile	Thu Jul 29 14:47:44 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2010/07/29 14:15:46 pooka Exp $
+#	$NetBSD: Makefile,v 1.4 2010/07/29 14:47:44 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -20,4 +20,7 @@
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sbin/mount_nfs -I${NETBSDSRCDIR}/sbin/mount
 CPPFLAGS+=	-DMOUNT_NOMAIN -DMOUNTNFS_RETRYRPC=1
 
+.include ../../../libexec/lfs_cleanerd/Makefile.inc
+CPPFLAGS+=	-DUSE_RUMP -DLFS_CLEANER_AS_LIB
+
 .include bsd.lib.mk

Index: src/tests/fs/common/fstest_lfs.c
diff -u src/tests/fs/common/fstest_lfs.c:1.1 src/tests/fs/common/fstest_lfs.c:1.2
--- src/tests/fs/common/fstest_lfs.c:1.1	Thu Jul 29 14:15:46 2010
+++ src/tests/fs/common/fstest_lfs.c	Thu Jul 29 14:47:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_lfs.c,v 1.1 2010/07/29 14:15:46 pooka Exp $	*/
+/*	$NetBSD: fstest_lfs.c,v 1.2 2010/07/29 14:47:44 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
 #include sys/stat.h
 
 #include atf-c.h
+#include pthread.h
+#include semaphore.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -44,11 +46,18 @@
 #include rump/rump_syscalls.h
 
 #include h_fsmacros.h
+#include mount_lfs.h
+
+sem_t lfs_clearnerloop;
 
 struct lfstestargs {
 struct ufs_args ta_uargs;
+	pthread_t ta_cleanerthread;
+	sem_t ta_cleanerloop;
 char ta_devpath[MAXPATHLEN];
 char ta_imgpath[MAXPATHLEN];
+	char ta_mntpath[MAXPATHLEN];
+char ta_hostpath[MAXPATHLEN];
 };
 
 int
@@ -74,9 +83,11 @@
 	if (args == NULL)
 		return -1;
 
+	strcpy(args-ta_hostpath, image);
 	snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.lfs, num);
 	snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
 	args-ta_uargs.fspec = args-ta_devpath;
+	sem_init(args-ta_cleanerloop, 0, 0);
 
 	res = rump_pub_etfs_register(args-ta_devpath, image, RUMP_ETFS_BLK);
 	if (res != 0) {
@@ -104,18 +115,46 @@
 	if (res != 0)
 		return res;
 
+	pthread_join(args-ta_cleanerthread, NULL);
 	free(args);
 
 	return 0;
 }
 
+static void *
+cleaner(void *arg)
+{
+	char thepath[MAXPATHLEN];
+	struct lfstestargs *args = arg;
+	const char *the_argv[7];
+	char buf[64];
+
+	/* this inspired by the cleaner code.  fixme */
+	sprintf(thepath, /dev/r%s, args-ta_devpath+5);
+	rump_pub_etfs_register(thepath, args-ta_hostpath, RUMP_ETFS_CHR);
+	sprintf(buf, %p, args-ta_cleanerloop);
+
+	the_argv[0] = megamaid;
+	the_argv[1] = -D; /* don't fork()  detach */
+	the_argv[2] = -S;
+	the_argv[3] = buf;
+	the_argv[4] = args-ta_mntpath;
+	the_argv[5] = NULL;
+
+	/* xxxatf */
+	optind = 1;
+	opterr = 1;
+
+	lfs_cleaner_main(5, __UNCONST(the_argv));
+
+	return NULL;
+}
+
 int
 lfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
 {
-	int res;
 	struct lfstestargs *args = buf;
-
-	/* XXX: should start cleanerd */
+	int res;
 
 	res = rump_sys_mkdir(path, 0777);
 	if (res == -1)
@@ -123,7 +162,18 @@
 
 	res = rump_sys_mount(MOUNT_LFS, path, flags, args-ta_uargs,
 	sizeof(args-ta_uargs));
-	return res;
+	if (res == -1)
+		return res;
+
+	strcpy(args-ta_mntpath, path);
+	res = pthread_create(args-ta_cleanerthread, NULL, cleaner, args);
+	if (res)
+		return res;
+
+	/* wait for cleaner to initialize */
+	sem_wait(args-ta_cleanerloop);
+
+	return 0;
 }
 
 int
@@ -132,8 +182,9 @@
 	int res;
 
 	res = rump_sys_unmount(path, flags);
-	if (res == -1)
+	if (res == -1) {
 		return res;
+	}
 
 	res = rump_sys_rmdir(path);
 	return res;



CVS commit: src/tests/fs/common

2010-07-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jul 29 14:50:32 UTC 2010

Modified Files:
src/tests/fs/common: fstest_lfs.c

Log Message:
whitespace


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

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

Modified files:

Index: src/tests/fs/common/fstest_lfs.c
diff -u src/tests/fs/common/fstest_lfs.c:1.2 src/tests/fs/common/fstest_lfs.c:1.3
--- src/tests/fs/common/fstest_lfs.c:1.2	Thu Jul 29 14:47:44 2010
+++ src/tests/fs/common/fstest_lfs.c	Thu Jul 29 14:50:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_lfs.c,v 1.2 2010/07/29 14:47:44 pooka Exp $	*/
+/*	$NetBSD: fstest_lfs.c,v 1.3 2010/07/29 14:50:32 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -51,13 +51,13 @@
 sem_t lfs_clearnerloop;
 
 struct lfstestargs {
-struct ufs_args ta_uargs;
+	struct ufs_args ta_uargs;
 	pthread_t ta_cleanerthread;
 	sem_t ta_cleanerloop;
-char ta_devpath[MAXPATHLEN];
-char ta_imgpath[MAXPATHLEN];
+	char ta_devpath[MAXPATHLEN];
+	char ta_imgpath[MAXPATHLEN];
 	char ta_mntpath[MAXPATHLEN];
-char ta_hostpath[MAXPATHLEN];
+	char ta_hostpath[MAXPATHLEN];
 };
 
 int



CVS commit: src/tests/fs/common

2010-07-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 28 14:23:02 UTC 2010

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Add FSTEST_CONSTRUCTOR/FSTEST_DESTRUCTOR which create/mount the
file system with default params.  Make ATF_FS_APPLY use the
constructor (can't use the destructor due to the (useless) cleanup).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.14 src/tests/fs/common/h_fsmacros.h:1.15
--- src/tests/fs/common/h_fsmacros.h:1.14	Mon Jul 26 16:15:49 2010
+++ src/tests/fs/common/h_fsmacros.h	Wed Jul 28 14:23:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.14 2010/07/26 16:15:49 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.15 2010/07/28 14:23:02 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,6 +56,23 @@
 #define FSTEST_IMGSIZE (1 * 512)
 #define FSTEST_MNTNAME /mnt
 
+#define FSTEST_CONSTRUCTOR(_tc_, _fs_, _args_)\
+do {	\
+	if (_fs_##_fstest_newfs(_tc_, _args_,\
+	FSTEST_IMGNAME, FSTEST_IMGSIZE) != 0)			\
+		atf_tc_fail(newfs failed);\
+	if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0)	\
+		atf_tc_fail(mount failed);\
+} while (/*CONSTCOND*/0);
+
+#define FSTEST_DESTRUCTOR(_tc_, _fs_, _args_)\
+do {	\
+	if (_fs_##_fstest_unmount(_tc_, FSTEST_MNTNAME, 0) != 0)	\
+		atf_tc_fail(unmount failed);\
+	if (_fs_##_fstest_delfs(_tc_, _args_) != 0)			\
+		atf_tc_fail(delfs failed);\
+} while (/*CONSTCOND*/0);
+
 #define ATF_TC_FSADD(fs,type,func,desc) \
   ATF_TC_WITH_CLEANUP(fs##_##func); \
   ATF_TC_HEAD(fs##_##func,tc) \
@@ -69,10 +86,7 @@
   { \
 if (!atf_check_fstype(tc, type)) \
   atf_tc_skip(filesystem not selected); \
-if (fs##_fstest_newfs(tc, fs##func##tmp, FSTEST_IMGNAME, FSTEST_IMGSIZE) != 0) \
-  atf_tc_fail(newfs failed); \
-if (fs##_fstest_mount(tc, fs##func##tmp, FSTEST_MNTNAME, 0) != 0) \
-  atf_tc_fail(mount failed); \
+FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp); \
 func(tc,FSTEST_MNTNAME); \
 if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \
   atf_tc_fail(unmount failed); \



CVS commit: src/tests/fs/common

2010-07-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 28 15:16:50 UTC 2010

Modified Files:
src/tests/fs/common: h_fsmacros.h nfs.c

Log Message:
Move nfstestargs to header because I need them.  A more sweeping
action would be good here.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/nfs.c

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.15 src/tests/fs/common/h_fsmacros.h:1.16
--- src/tests/fs/common/h_fsmacros.h:1.15	Wed Jul 28 14:23:02 2010
+++ src/tests/fs/common/h_fsmacros.h	Wed Jul 28 15:16:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.15 2010/07/28 14:23:02 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.16 2010/07/28 15:16:50 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -160,4 +160,11 @@
 #define FSTYPE_TMPFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_TMPFS) == 0)
 
+
+/* file system args structures */
+struct nfstestargs {
+	pid_t ta_childpid;
+	char ta_ethername[MAXPATHLEN];
+};
+
 #endif /* __H_FSMACROS_H_ */

Index: src/tests/fs/common/nfs.c
diff -u src/tests/fs/common/nfs.c:1.1 src/tests/fs/common/nfs.c:1.2
--- src/tests/fs/common/nfs.c:1.1	Mon Jul 26 16:15:49 2010
+++ src/tests/fs/common/nfs.c	Wed Jul 28 15:16:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.1 2010/07/26 16:15:49 pooka Exp $	*/
+/*	$NetBSD: nfs.c,v 1.2 2010/07/28 15:16:50 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -57,11 +57,6 @@
 #define NETNETMASK 255.255.255.0
 #define EXPORTPATH /myexport
 
-struct nfstestargs {
-	pid_t ta_childpid;
-	char ta_ethername[MAXPATHLEN];
-};
-
 static void
 childfail(int status)
 {



CVS commit: src/tests/fs/common

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 16:15:50 UTC 2010

Modified Files:
src/tests/fs/common: Makefile h_fsmacros.h
Added Files:
src/tests/fs/common: nfs.c

Log Message:
Add NFS to the list of file systems exercised by the vfs tests.

How it works:
NFS tests fork and exec the nfs service from fs/nfs/nfsservice.
The child then:
  a) creates a FFS file system
  b) mounts it
  c) starts rpcbind
  d) starts mountd
  e) starts nfsd
  f) handles requests

The client, as expected, does the standard RPC regotiation and
calls mount(MOUNT_NFS).  It then proceeds to execute the test.

An individual test which executes everything described above and
does a few file operations on the NFS mount takes 0.16s wall time
on my laptop from start to finish.  This means it is feasible to
run hundreds of tests while still getting results in a timely
fashion.

Like in other networked tests, the two processes are connected via
the rump shmif which uses mmapped files as ethernet busses.  The
entire test suite can be executed by an unprivileged account.

As a side effect, these tests exercise also the kernel NFS server
in addition to the kernel NFS client.

While everything is currently targetted at executing the vfs tests,
there is no reason this could not be extended to exercise features
specific to NFS.  For example, the server can run through all
exportable file system types, permissions can be tested, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/Makefile
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/nfs.c

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.1 src/tests/fs/common/Makefile:1.2
--- src/tests/fs/common/Makefile:1.1	Mon Jul 19 16:09:08 2010
+++ src/tests/fs/common/Makefile	Mon Jul 26 16:15:49 2010
@@ -1,9 +1,22 @@
-#	$NetBSD: Makefile,v 1.1 2010/07/19 16:09:08 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2010/07/26 16:15:49 pooka Exp $
 #
 
+.include bsd.own.mk
+
 LIB=	vfstest
-SRCS=	ext2fs.c ffs.c lfs.c msdosfs.c puffs.c sysvbfs.c tmpfs.c
+SRCS=	ext2fs.c ffs.c lfs.c msdosfs.c nfs.c puffs.c sysvbfs.c tmpfs.c
+
+WARNS=	3
+
+.include nfsrpc/Makefile.inc
 
 LIBISPRIVATE=	# yup
 
+# NFS client stuff
+.PATH:	${NETBSDSRCDIR}/sbin/mount_nfs ${NETBSDSRCDIR}/sbin/mount
+SRCS+=	getnfsargs.c pathadj.c fattr.c mount_nfs.c
+
+CPPFLAGS+=	-I${NETBSDSRCDIR}/sbin/mount_nfs -I${NETBSDSRCDIR}/sbin/mount
+CPPFLAGS+=	-DMOUNT_NOMAIN -DMOUNTNFS_RETRYRPC=1
+
 .include bsd.lib.mk

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.13 src/tests/fs/common/h_fsmacros.h:1.14
--- src/tests/fs/common/h_fsmacros.h:1.13	Tue Jul 20 17:44:01 2010
+++ src/tests/fs/common/h_fsmacros.h	Mon Jul 26 16:15:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.13 2010/07/20 17:44:01 njoly Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.14 2010/07/26 16:15:49 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -47,6 +47,7 @@
 FSPROTOS(ffs);
 FSPROTOS(lfs);
 FSPROTOS(msdosfs);
+FSPROTOS(nfs);
 FSPROTOS(puffs);
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
@@ -92,6 +93,7 @@
   ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
   ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
+  ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
   ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
@@ -101,6 +103,7 @@
   ATF_TP_FSADD(ffs,func); \
   ATF_TP_FSADD(lfs,func); \
   ATF_TP_FSADD(msdosfs,func); \
+  ATF_TP_FSADD(nfs,func); \
   ATF_TP_FSADD(puffs,func); \
   ATF_TP_FSADD(sysvbfs,func); \
   ATF_TP_FSADD(tmpfs,func);
@@ -134,6 +137,8 @@
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_LFS) == 0)
 #define FSTYPE_MSDOS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_MSDOS) == 0)
+#define FSTYPE_NFS(tc)\
+(strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_NFS) == 0)
 #define FSTYPE_PUFFS(tc)\
 (strcmp(atf_tc_get_md_var(tc, X-fs.type), MOUNT_PUFFS) == 0)
 #define FSTYPE_SYSVBFS(tc)\

Added files:

Index: src/tests/fs/common/nfs.c
diff -u /dev/null src/tests/fs/common/nfs.c:1.1
--- /dev/null	Mon Jul 26 16:15:50 2010
+++ src/tests/fs/common/nfs.c	Mon Jul 26 16:15:49 2010
@@ -0,0 +1,225 @@
+/*	$NetBSD: nfs.c,v 1.1 2010/07/26 16:15:49 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ *
+ * 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 

CVS commit: src/tests/fs/common/nfsrpc

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 17:53:21 UTC 2010

Modified Files:
src/tests/fs/common/nfsrpc: svc.c

Log Message:
make unsignedness match


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

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

Modified files:

Index: src/tests/fs/common/nfsrpc/svc.c
diff -u src/tests/fs/common/nfsrpc/svc.c:1.1 src/tests/fs/common/nfsrpc/svc.c:1.2
--- src/tests/fs/common/nfsrpc/svc.c:1.1	Mon Jul 26 15:56:45 2010
+++ src/tests/fs/common/nfsrpc/svc.c	Mon Jul 26 17:53:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc.c,v 1.1 2010/07/26 15:56:45 pooka Exp $	*/
+/*	$NetBSD: svc.c,v 1.2 2010/07/26 17:53:21 pooka Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro;
 static char *sccsid = @(#)svc.c	2.4 88/08/11 4.0 RPCSRC;
 #else
-__RCSID($NetBSD: svc.c,v 1.1 2010/07/26 15:56:45 pooka Exp $);
+__RCSID($NetBSD: svc.c,v 1.2 2010/07/26 17:53:21 pooka Exp $);
 #endif
 #endif
 
@@ -673,7 +673,7 @@
 	fd_set *readfds;
 {
 	int bit, fd;
-	int32_t mask, *maskp;
+	uint32_t mask, *maskp;
 	int sock;
 
 	_DIAGASSERT(readfds != NULL);



CVS commit: src/tests/fs/common/nfsrpc

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 18:47:37 UTC 2010

Modified Files:
src/tests/fs/common/nfsrpc: svc_vc.c

Log Message:
retire unwieldy casts


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

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

Modified files:

Index: src/tests/fs/common/nfsrpc/svc_vc.c
diff -u src/tests/fs/common/nfsrpc/svc_vc.c:1.1 src/tests/fs/common/nfsrpc/svc_vc.c:1.2
--- src/tests/fs/common/nfsrpc/svc_vc.c:1.1	Mon Jul 26 15:56:45 2010
+++ src/tests/fs/common/nfsrpc/svc_vc.c	Mon Jul 26 18:47:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc_vc.c,v 1.1 2010/07/26 15:56:45 pooka Exp $	*/
+/*	$NetBSD: svc_vc.c,v 1.2 2010/07/26 18:47:36 pooka Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = @(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro;
 static char *sccsid = @(#)svc_tcp.c	2.2 88/08/01 4.0 RPCSRC;
 #else
-__RCSID($NetBSD: svc_vc.c,v 1.1 2010/07/26 15:56:45 pooka Exp $);
+__RCSID($NetBSD: svc_vc.c,v 1.2 2010/07/26 18:47:36 pooka Exp $);
 #endif
 #endif
 
@@ -365,10 +365,10 @@
 	cd-maxrec = r-maxrec;
 
 	if (cd-maxrec != 0) {
-		flags = rump_sys_fcntl(sock, F_GETFL, (void *)0);
+		flags = rump_sys_fcntl(sock, F_GETFL, 0);
 		if (flags  == -1)
 			goto out;
-		if (rump_sys_fcntl(sock, F_SETFL, (void *)(flags | O_NONBLOCK)) == -1)
+		if (rump_sys_fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1)
 			goto out;
 		if (cd-recvsize  cd-maxrec)
 			cd-recvsize = cd-maxrec;



CVS commit: src/tests/fs/common/nfsrpc

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 18:51:03 UTC 2010

Modified Files:
src/tests/fs/common/nfsrpc: svc.c

Log Message:
Add for-fun cast ... no, not really.  casting is never fun.
But now this code builds both on 5.0 and -current.


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

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

Modified files:

Index: src/tests/fs/common/nfsrpc/svc.c
diff -u src/tests/fs/common/nfsrpc/svc.c:1.2 src/tests/fs/common/nfsrpc/svc.c:1.3
--- src/tests/fs/common/nfsrpc/svc.c:1.2	Mon Jul 26 17:53:21 2010
+++ src/tests/fs/common/nfsrpc/svc.c	Mon Jul 26 18:51:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc.c,v 1.2 2010/07/26 17:53:21 pooka Exp $	*/
+/*	$NetBSD: svc.c,v 1.3 2010/07/26 18:51:02 pooka Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro;
 static char *sccsid = @(#)svc.c	2.4 88/08/11 4.0 RPCSRC;
 #else
-__RCSID($NetBSD: svc.c,v 1.2 2010/07/26 17:53:21 pooka Exp $);
+__RCSID($NetBSD: svc.c,v 1.3 2010/07/26 18:51:02 pooka Exp $);
 #endif
 #endif
 
@@ -678,7 +678,7 @@
 
 	_DIAGASSERT(readfds != NULL);
 
-	maskp = readfds-fds_bits;
+	maskp = (uint32_t *)readfds-fds_bits;
 	for (sock = 0; sock  FD_SETSIZE; sock += NFDBITS) {
 	for (mask = *maskp++; (bit = ffs(mask)) != 0;
 		mask ^= (1  (bit - 1))) {



CVS commit: src/tests/fs/common

2010-07-20 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Jul 20 17:44:01 UTC 2010

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Update ATF_TC_FSADD macro use ATF cleanup function. And call
xx_fstest_delfs() from here instead of test body.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.12 src/tests/fs/common/h_fsmacros.h:1.13
--- src/tests/fs/common/h_fsmacros.h:1.12	Mon Jul 19 16:21:22 2010
+++ src/tests/fs/common/h_fsmacros.h	Tue Jul 20 17:44:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.12 2010/07/19 16:21:22 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.13 2010/07/20 17:44:01 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,25 +56,31 @@
 #define FSTEST_MNTNAME /mnt
 
 #define ATF_TC_FSADD(fs,type,func,desc) \
-  ATF_TC(fs##_##func); \
+  ATF_TC_WITH_CLEANUP(fs##_##func); \
   ATF_TC_HEAD(fs##_##func,tc) \
   { \
 atf_tc_set_md_var(tc, descr, type  test for  desc); \
 atf_tc_set_md_var(tc, use.fs, true); \
 atf_tc_set_md_var(tc, X-fs.type, type); \
   } \
+  void *fs##func##tmp; \
   ATF_TC_BODY(fs##_##func,tc) \
   { \
-void *tmp; \
-atf_check_fstype(tc, type); \
-if (fs##_fstest_newfs(tc, tmp, FSTEST_IMGNAME, FSTEST_IMGSIZE) != 0) \
+if (!atf_check_fstype(tc, type)) \
+  atf_tc_skip(filesystem not selected); \
+if (fs##_fstest_newfs(tc, fs##func##tmp, FSTEST_IMGNAME, FSTEST_IMGSIZE) != 0) \
   atf_tc_fail(newfs failed); \
-if (fs##_fstest_mount(tc, tmp, FSTEST_MNTNAME, 0) != 0) \
+if (fs##_fstest_mount(tc, fs##func##tmp, FSTEST_MNTNAME, 0) != 0) \
   atf_tc_fail(mount failed); \
 func(tc,FSTEST_MNTNAME); \
 if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \
   atf_tc_fail(unmount failed); \
-if (fs##_fstest_delfs(tc, tmp) != 0) \
+  } \
+  ATF_TC_CLEANUP(fs##_##func,tc) \
+  { \
+if (!atf_check_fstype(tc, type)) \
+  return; \
+if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \
   atf_tc_fail(delfs failed); \
   }
 
@@ -107,17 +113,17 @@
 return atf_no_error(); \
   }
 
-static __inline void
+static __inline bool
 atf_check_fstype(const atf_tc_t *tc, const char *fs)
 {
   const char *fstype;
 
   if (!atf_tc_has_config_var(tc, fstype))
-return;
+return true;
   fstype = atf_tc_get_config_var(tc, fstype);
   if (strcmp(fstype, fs) == 0)
-return;
-  atf_tc_skip(filesystem not selected);
+return true;
+  return false;
 }
 
 #define FSTYPE_EXT2FS(tc)\



CVS commit: src/tests/fs/common

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

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
* namespace some macros under FSTEST
* inline atf_check_tc() since this is a header


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.11 src/tests/fs/common/h_fsmacros.h:1.12
--- src/tests/fs/common/h_fsmacros.h:1.11	Mon Jul 19 16:09:08 2010
+++ src/tests/fs/common/h_fsmacros.h	Mon Jul 19 16:21:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.11 2010/07/19 16:09:08 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.12 2010/07/19 16:21:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -51,9 +51,9 @@
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
 
-#define IMGNAME image.fs
-#define IMGSIZE (1 * 512)
-#define MNTNAME /mnt
+#define FSTEST_IMGNAME image.fs
+#define FSTEST_IMGSIZE (1 * 512)
+#define FSTEST_MNTNAME /mnt
 
 #define ATF_TC_FSADD(fs,type,func,desc) \
   ATF_TC(fs##_##func); \
@@ -67,12 +67,12 @@
   { \
 void *tmp; \
 atf_check_fstype(tc, type); \
-if (fs##_fstest_newfs(tc, tmp, IMGNAME, IMGSIZE) != 0) \
+if (fs##_fstest_newfs(tc, tmp, FSTEST_IMGNAME, FSTEST_IMGSIZE) != 0) \
   atf_tc_fail(newfs failed); \
-if (fs##_fstest_mount(tc, tmp, MNTNAME, 0) != 0) \
+if (fs##_fstest_mount(tc, tmp, FSTEST_MNTNAME, 0) != 0) \
   atf_tc_fail(mount failed); \
-func(tc,MNTNAME); \
-if (fs##_fstest_unmount(tc, MNTNAME, 0) != 0) \
+func(tc,FSTEST_MNTNAME); \
+if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \
   atf_tc_fail(unmount failed); \
 if (fs##_fstest_delfs(tc, tmp) != 0) \
   atf_tc_fail(delfs failed); \
@@ -107,7 +107,7 @@
 return atf_no_error(); \
   }
 
-static void
+static __inline void
 atf_check_fstype(const atf_tc_t *tc, const char *fs)
 {
   const char *fstype;



CVS commit: src/tests/fs/common

2010-07-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jul 13 16:48:15 UTC 2010

Modified Files:
src/tests/fs/common: h_fsmacros.h
Added Files:
src/tests/fs/common: puffs.c

Log Message:
Run puffs/dtfs as part of the vfs tests.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/puffs.c

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.9 src/tests/fs/common/h_fsmacros.h:1.10
--- src/tests/fs/common/h_fsmacros.h:1.9	Tue Jul 13 15:50:31 2010
+++ src/tests/fs/common/h_fsmacros.h	Tue Jul 13 16:48:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.9 2010/07/13 15:50:31 njoly Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.10 2010/07/13 16:48:15 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
 #include ffs.c
 #include lfs.c
 #include msdosfs.c
+#include puffs.c
 #include sysvbfs.c
 #include tmpfs.c
 
@@ -79,6 +80,7 @@
   ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
   ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
   ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
+  ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
   ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
 
@@ -87,6 +89,7 @@
   ATF_TP_FSADD(ffs,func); \
   ATF_TP_FSADD(lfs,func); \
   ATF_TP_FSADD(msdosfs,func); \
+  ATF_TP_FSADD(puffs,func); \
   ATF_TP_FSADD(sysvbfs,func); \
   ATF_TP_FSADD(tmpfs,func);
 

Added files:

Index: src/tests/fs/common/puffs.c
diff -u /dev/null src/tests/fs/common/puffs.c:1.1
--- /dev/null	Tue Jul 13 16:48:15 2010
+++ src/tests/fs/common/puffs.c	Tue Jul 13 16:48:15 2010
@@ -0,0 +1,363 @@
+/*	$NetBSD: puffs.c,v 1.1 2010/07/13 16:48:15 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ *
+ * 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 AUTHOR ``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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/types.h
+#include sys/mount.h
+#include sys/socket.h
+#include sys/statvfs.h
+#include sys/wait.h
+
+#include assert.h
+#include atf-c.h
+#include err.h
+#include errno.h
+#include fcntl.h
+#include pthread.h
+#include puffs.h
+#include puffsdump.h
+#include stdio.h
+#include unistd.h
+#include string.h
+#include stdlib.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+struct puffstestargs {
+	uint8_t			*pta_pargs;
+	size_t			pta_pargslen;
+
+	int			pta_pflags;
+	int			pta_servfd;
+	pid_t			pta_childpid;
+
+	char			pta_dev[MAXPATHLEN];
+	char			pta_dir[MAXPATHLEN];
+
+	int			pta_mntflags;
+};
+
+#define BUFSIZE (128*1024)
+#define DTFS_DUMP -o,dump
+
+struct thefds {
+	int rumpfd;
+	int servfd;
+};
+
+int vfs_toserv_ops[PUFFS_VFS_MAX];
+int vn_toserv_ops[PUFFS_VN_MAX];
+
+#ifdef PUFFSDUMP
+static void __unused
+dumpopcount(void)
+{
+	size_t i;
+
+	printf(VFS OPS:\n);
+	for (i = 0; i  MIN(puffsdump_vfsop_count, PUFFS_VFS_MAX); i++) {
+		printf(\t%s: %d\n,
+		puffsdump_vfsop_revmap[i], vfs_toserv_ops[i]);
+	}
+
+	printf(VN OPS:\n);
+	for (i = 0; i  MIN(puffsdump_vnop_count, PUFFS_VN_MAX); i++) {
+		printf(\t%s: %d\n,
+		puffsdump_vnop_revmap[i], vn_toserv_ops[i]);
+	}
+}
+#endif
+
+/*
+ * Threads which shovel data between comfd and /dev/puffs.
+ * (cannot use polling since fd's are in different namespaces)
+ */
+static void *
+readshovel(void *arg)
+{
+	struct putter_hdr *phdr;
+	struct puffs_req *preq;
+	struct thefds *fds = arg;
+	char buf[BUFSIZE];
+	int comfd, puffsfd;
+
+	comfd = fds-servfd;
+	puffsfd = fds-rumpfd;
+
+	phdr = (void *)buf;
+	preq = (void *)buf;
+
+	/* use static thread id */
+	rump_pub_lwp_alloc_and_switch(0, 10);
+
+	for (;;) {
+		ssize_t n;
+
+		n = 

CVS commit: src/tests/fs/common

2010-07-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jul 13 17:49:24 UTC 2010

Modified Files:
src/tests/fs/common: puffs.c

Log Message:
off_t - uint64_t to hopefully avoid some lp64 signedness whines.


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

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

Modified files:

Index: src/tests/fs/common/puffs.c
diff -u src/tests/fs/common/puffs.c:1.1 src/tests/fs/common/puffs.c:1.2
--- src/tests/fs/common/puffs.c:1.1	Tue Jul 13 16:48:15 2010
+++ src/tests/fs/common/puffs.c	Tue Jul 13 17:49:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.1 2010/07/13 16:48:15 pooka Exp $	*/
+/*	$NetBSD: puffs.c,v 1.2 2010/07/13 17:49:24 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -162,7 +162,7 @@
 	phdr = (struct putter_hdr *)buf;
 
 	for (;;) {
-		off_t off;
+		uint64_t off;
 		ssize_t n;
 
 		/*



CVS commit: src/tests/fs/common

2010-07-12 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Jul 12 21:37:47 UTC 2010

Modified Files:
src/tests/fs/common: ext2fs.c ffs.c h_fsmacros.h lfs.c msdosfs.c
sysvbfs.c tmpfs.c

Log Message:
Update filesystem helper functions namespace (from XXX_mount to
XXX_fstest_mount) to avoid conflicts with existing functions such as
puffs_mount.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/common/ext2fs.c \
src/tests/fs/common/ffs.c src/tests/fs/common/msdosfs.c \
src/tests/fs/common/sysvbfs.c src/tests/fs/common/tmpfs.c
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/common/lfs.c

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

Modified files:

Index: src/tests/fs/common/ext2fs.c
diff -u src/tests/fs/common/ext2fs.c:1.2 src/tests/fs/common/ext2fs.c:1.3
--- src/tests/fs/common/ext2fs.c:1.2	Mon Jul  5 14:53:03 2010
+++ src/tests/fs/common/ext2fs.c	Mon Jul 12 21:37:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
+/*	$NetBSD: ext2fs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 };
 
 static int
-ext2fs_newfs(void **buf, const char *image, off_t size)
+ext2fs_fstest_newfs(void **buf, const char *image, off_t size)
 {
 	char cmd[1024];
 	int res;
@@ -88,7 +88,7 @@
 }
 
 static int
-ext2fs_delfs(void *buf)
+ext2fs_fstest_delfs(void *buf)
 {
 	int res;
 	struct ext2fstestargs *args = buf;
@@ -107,7 +107,7 @@
 }
 
 static int
-ext2fs_mount(void *buf, const char *path, int flags)
+ext2fs_fstest_mount(void *buf, const char *path, int flags)
 {
 	int res;
 	struct ext2fstestargs *args = buf;
@@ -122,7 +122,7 @@
 }
 
 static int
-ext2fs_unmount(const char *path, int flags)
+ext2fs_fstest_unmount(const char *path, int flags)
 {
 	int res;
 
Index: src/tests/fs/common/ffs.c
diff -u src/tests/fs/common/ffs.c:1.2 src/tests/fs/common/ffs.c:1.3
--- src/tests/fs/common/ffs.c:1.2	Mon Jul  5 14:53:03 2010
+++ src/tests/fs/common/ffs.c	Mon Jul 12 21:37:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
+/*	$NetBSD: ffs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 };
 
 static int
-ffs_newfs(void **buf, const char *image, off_t size)
+ffs_fstest_newfs(void **buf, const char *image, off_t size)
 {
 	char cmd[1024];
 	int res;
@@ -87,7 +87,7 @@
 }
 
 static int
-ffs_delfs(void *buf)
+ffs_fstest_delfs(void *buf)
 {
 	int res;
 	struct ffstestargs *args = buf;
@@ -106,7 +106,7 @@
 }
 
 static int
-ffs_mount(void *buf, const char *path, int flags)
+ffs_fstest_mount(void *buf, const char *path, int flags)
 {
 	int res;
 	struct ffstestargs *args = buf;
@@ -121,7 +121,7 @@
 }
 
 static int
-ffs_unmount(const char *path, int flags)
+ffs_fstest_unmount(const char *path, int flags)
 {
 	int res;
 
Index: src/tests/fs/common/msdosfs.c
diff -u src/tests/fs/common/msdosfs.c:1.2 src/tests/fs/common/msdosfs.c:1.3
--- src/tests/fs/common/msdosfs.c:1.2	Mon Jul  5 14:53:03 2010
+++ src/tests/fs/common/msdosfs.c	Mon Jul 12 21:37:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
+/*	$NetBSD: msdosfs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 };
 
 static int
-msdosfs_newfs(void **buf, const char *image, off_t size)
+msdosfs_fstest_newfs(void **buf, const char *image, off_t size)
 {
 	char cmd[1024];
 	int res;
@@ -88,7 +88,7 @@
 }
 
 static int
-msdosfs_delfs(void *buf)
+msdosfs_fstest_delfs(void *buf)
 {
 	int res;
 	struct msdosfstestargs *args = buf;
@@ -107,7 +107,7 @@
 }
 
 static int
-msdosfs_mount(void *buf, const char *path, int flags)
+msdosfs_fstest_mount(void *buf, const char *path, int flags)
 {
 	int res;
 	struct msdosfstestargs *args = buf;
@@ -122,7 +122,7 @@
 }
 
 static int
-msdosfs_unmount(const char *path, int flags)
+msdosfs_fstest_unmount(const char *path, int flags)
 {
 	int res;
 
Index: src/tests/fs/common/sysvbfs.c
diff -u src/tests/fs/common/sysvbfs.c:1.2 src/tests/fs/common/sysvbfs.c:1.3
--- src/tests/fs/common/sysvbfs.c:1.2	Mon Jul  5 14:53:03 2010
+++ src/tests/fs/common/sysvbfs.c	Mon Jul 12 21:37:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
+/*	$NetBSD: sysvbfs.c,v 1.3 2010/07/12 21:37:47 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 };
 
 static int
-sysvbfs_newfs(void **buf, const char *image, off_t size)
+sysvbfs_fstest_newfs(void **buf, const char *image, off_t size)
 {
 	char cmd[1024];
 	int res;
@@ -88,7 +88,7 @@
 }
 
 static int
-sysvbfs_delfs(void *buf)
+sysvbfs_fstest_delfs(void *buf)
 {
 	int res;
 	struct sysvbfstestargs *args = buf;
@@ -107,7 +107,7 @@
 }
 
 static int
-sysvbfs_mount(void *buf, const char *path, int 

CVS commit: src/tests/fs/common

2010-07-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jul 11 11:25:22 UTC 2010

Modified Files:
src/tests/fs/common: lfs.c

Log Message:
Remove the lfs race condition hack now that it's properly in the
test instead of the fs-specific part.


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

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

Modified files:

Index: src/tests/fs/common/lfs.c
diff -u src/tests/fs/common/lfs.c:1.3 src/tests/fs/common/lfs.c:1.4
--- src/tests/fs/common/lfs.c:1.3	Fri Jul  9 14:16:05 2010
+++ src/tests/fs/common/lfs.c	Sun Jul 11 11:25:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.c,v 1.3 2010/07/09 14:16:05 njoly Exp $	*/
+/*	$NetBSD: lfs.c,v 1.4 2010/07/11 11:25:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -129,13 +129,6 @@
 {
 	int res;
 
-	/*
-	 * Rarely the test does not crash.  atf currently has no way of
-	 * saying just chill even if the test doesn't fail, so this
-	 * takes care of it.
-	 */
-	abort();
-
 	res = rump_sys_unmount(path, flags);
 	if (res == -1)
 		return res;



CVS commit: src/tests/fs/common

2010-07-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jul  8 13:30:53 UTC 2010

Modified Files:
src/tests/fs/common: lfs.c

Log Message:
fill in PR number now that we have one


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

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

Modified files:

Index: src/tests/fs/common/lfs.c
diff -u src/tests/fs/common/lfs.c:1.1 src/tests/fs/common/lfs.c:1.2
--- src/tests/fs/common/lfs.c:1.1	Thu Jul  8 13:21:02 2010
+++ src/tests/fs/common/lfs.c	Thu Jul  8 13:30:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.c,v 1.1 2010/07/08 13:21:02 pooka Exp $	*/
+/*	$NetBSD: lfs.c,v 1.2 2010/07/08 13:30:53 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
 	/*
 	 * XXX: this should be IN THE TEST, not here
 	 */
-	atf_tc_expect_signal(-1, i'll file a PR soon);
+	atf_tc_expect_signal(-1, PR kern/43582);
 
 	return 0;
 }



CVS commit: src/tests/fs/common

2010-07-05 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Jul  5 14:53:03 UTC 2010

Modified Files:
src/tests/fs/common: ext2fs.c ffs.c h_fsmacros.h msdosfs.c sysvbfs.c
tmpfs.c

Log Message:
Fix more copyrights, where i forgot to add my name.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/ext2fs.c \
src/tests/fs/common/ffs.c src/tests/fs/common/h_fsmacros.h \
src/tests/fs/common/msdosfs.c src/tests/fs/common/sysvbfs.c \
src/tests/fs/common/tmpfs.c

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

Modified files:

Index: src/tests/fs/common/ext2fs.c
diff -u src/tests/fs/common/ext2fs.c:1.1 src/tests/fs/common/ext2fs.c:1.2
--- src/tests/fs/common/ext2fs.c:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/ext2fs.c	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: ext2fs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: ext2fs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
Index: src/tests/fs/common/ffs.c
diff -u src/tests/fs/common/ffs.c:1.1 src/tests/fs/common/ffs.c:1.2
--- src/tests/fs/common/ffs.c:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/ffs.c	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: ffs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: ffs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.1 src/tests/fs/common/h_fsmacros.h:1.2
--- src/tests/fs/common/h_fsmacros.h:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/h_fsmacros.h	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: h_fsmacros.h,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
Index: src/tests/fs/common/msdosfs.c
diff -u src/tests/fs/common/msdosfs.c:1.1 src/tests/fs/common/msdosfs.c:1.2
--- src/tests/fs/common/msdosfs.c:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/msdosfs.c	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: msdosfs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: msdosfs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
Index: src/tests/fs/common/sysvbfs.c
diff -u src/tests/fs/common/sysvbfs.c:1.1 src/tests/fs/common/sysvbfs.c:1.2
--- src/tests/fs/common/sysvbfs.c:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/sysvbfs.c	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: sysvbfs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: sysvbfs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
Index: src/tests/fs/common/tmpfs.c
diff -u src/tests/fs/common/tmpfs.c:1.1 src/tests/fs/common/tmpfs.c:1.2
--- src/tests/fs/common/tmpfs.c:1.1	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/tmpfs.c	Mon Jul  5 14:53:03 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: tmpfs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+/*	$NetBSD: tmpfs.c,v 1.2 2010/07/05 14:53:03 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by 
+ * by Nicolas Joly.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions



CVS commit: src/tests/fs/common

2010-06-30 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Jun 30 20:39:39 UTC 2010

Added Files:
src/tests/fs/common: ext2fs.c ffs.c h_fsmacros.h msdosfs.c sysvbfs.c
tmpfs.c

Log Message:
Add helper code and macros to ease writing filesystem tests with rump.
Support currently limited to ext2fs, ffs, msdos, sysvbfs and tmpfs.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/ext2fs.c src/tests/fs/common/ffs.c \
src/tests/fs/common/h_fsmacros.h src/tests/fs/common/msdosfs.c \
src/tests/fs/common/sysvbfs.c src/tests/fs/common/tmpfs.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/common/ext2fs.c
diff -u /dev/null src/tests/fs/common/ext2fs.c:1.1
--- /dev/null	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/ext2fs.c	Wed Jun 30 20:39:39 2010
@@ -0,0 +1,135 @@
+/*	$NetBSD: ext2fs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/mount.h
+#include sys/stat.h
+
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ufs/ufs/ufsmount.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+struct ext2fstestargs {
+struct ufs_args ta_uargs;
+char ta_devpath[MAXPATHLEN];
+char ta_imgpath[MAXPATHLEN];
+};
+
+static int
+ext2fs_newfs(void **buf, const char *image, off_t size)
+{
+	char cmd[1024];
+	int res;
+	static unsigned int num = 0;
+	struct ext2fstestargs *args;
+
+	size /= 512;
+	snprintf(cmd, 1024, newfs_ext2fs -F -s %PRId64 %s /dev/null,
+	size, image);
+	res = system(cmd);
+	if (res != 0)
+		return res;
+
+	res = rump_init();
+	if (res != 0)
+		return res;
+
+	args = calloc(1, sizeof(*args));
+	if (args == NULL)
+		return -1;
+
+	snprintf(args-ta_devpath, MAXPATHLEN, /dev/device%d.ext2fs, num);
+	snprintf(args-ta_imgpath, MAXPATHLEN, %s, image);
+	args-ta_uargs.fspec = args-ta_devpath;
+
+	res = rump_pub_etfs_register(args-ta_devpath, image, RUMP_ETFS_BLK);
+	if (res != 0) {
+		free(args);
+		return res;
+	}
+
+	*buf = args;
+	num++;
+
+	return res;
+}
+
+static int
+ext2fs_delfs(void *buf)
+{
+	int res;
+	struct ext2fstestargs *args = buf;
+
+	res = rump_pub_etfs_remove(args-ta_devpath);
+	if (res != 0)
+		return res;
+
+	res = unlink(args-ta_imgpath);
+	if (res != 0)
+		return res;
+
+	free(args);
+
+	return 0;
+}
+
+static int
+ext2fs_mount(void *buf, const char *path, int flags)
+{
+	int res;
+	struct ext2fstestargs *args = buf;
+
+	res = rump_sys_mkdir(path, 0777);
+	if (res == -1)
+		return res;
+
+	res = rump_sys_mount(MOUNT_EXT2FS, path, flags, args-ta_uargs,
+	sizeof(args-ta_uargs));
+	return res;
+}
+
+static int
+ext2fs_unmount(const char *path, int flags)
+{
+	int res;
+
+	res = rump_sys_unmount(path, flags);
+	if (res == -1)
+		return res;
+
+	res = rump_sys_rmdir(path);
+	return res;
+}
Index: src/tests/fs/common/ffs.c
diff -u /dev/null src/tests/fs/common/ffs.c:1.1
--- /dev/null	Wed Jun 30 20:39:39 2010
+++ src/tests/fs/common/ffs.c	Wed Jun 30 20:39:39 2010
@@ -0,0 +1,134 @@
+/*	$NetBSD: ffs.c,v 1.1 2010/06/30 20:39:39 njoly Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of 

CVS commit: src/tests/fs/common

2010-04-16 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr 16 14:05:32 UTC 2010

Modified Files:
src/tests/fs/common: snapshot.c

Log Message:
Add the typical #ifdef USE_ATF stuff so I can debug the test if it
goes wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/common/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/common/snapshot.c
diff -u src/tests/fs/common/snapshot.c:1.1 src/tests/fs/common/snapshot.c:1.2
--- src/tests/fs/common/snapshot.c:1.1	Tue Apr 13 10:19:25 2010
+++ src/tests/fs/common/snapshot.c	Fri Apr 16 14:05:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapshot.c,v 1.1 2010/04/13 10:19:25 pooka Exp $	*/
+/*	$NetBSD: snapshot.c,v 1.2 2010/04/16 14:05:32 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/ioctl.h
@@ -13,12 +13,15 @@
 #include string.h
 #include unistd.h
 
+#define USE_ATF
+#ifdef USE_ATF
 ATF_TC_WITH_CLEANUP(snapshot);
 ATF_TC_HEAD(snapshot, tc)
 {
 
 	atf_tc_set_md_var(tc, descr, basic snapshot features);
 }
+#endif
 
 static void
 makefile(const char *path)
@@ -31,7 +34,11 @@
 	rump_sys_close(fd);
 }
 
+#ifdef USE_ATF
 ATF_TC_BODY(snapshot, tc)
+#else
+int main(int argc, char *argv[])
+#endif
 {
 	char buf[1024];
 	struct fss_set fss;
@@ -108,6 +115,7 @@
 	/* done for now */
 }
 
+#ifdef USE_ATF
 ATF_TC_CLEANUP(snapshot, tc)
 {
 
@@ -119,3 +127,4 @@
 	ATF_TP_ADD_TC(tp, snapshot);
 	return 0;
 }
+#endif