CVS commit: src/tests/fs/lfs

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 22:34:29 UTC 2020

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

Log Message:
Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/lfs/t_rfw.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/lfs/t_rfw.c
diff -u src/tests/fs/lfs/t_rfw.c:1.2 src/tests/fs/lfs/t_rfw.c:1.3
--- src/tests/fs/lfs/t_rfw.c:1.2	Sun Aug 23 16:03:54 2020
+++ src/tests/fs/lfs/t_rfw.c	Sun Aug 23 22:34:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rfw.c,v 1.2 2020/08/23 16:03:54 perseant Exp $	*/
+/*	$NetBSD: t_rfw.c,v 1.3 2020/08/23 22:34:29 riastradh Exp $	*/
 
 #include 
 #include 
@@ -264,7 +264,7 @@ int check_file(const char *filename, int
 	int fd, i;
 	struct stat statbuf;
 	unsigned char b;
-	
+
 	if (rump_sys_stat(filename, ) < 0) {
 		fprintf(stderr, "%s: stat failed\n", filename);
 		return 1;



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 22:34:29 UTC 2020

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

Log Message:
Nix trailing whitespace.


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

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



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Sun Aug 23 16:03:54 UTC 2020

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

Log Message:
Expand test to cover more failure cases.  Change from skipped to expect fail
in anticipation of working roll-forward code.


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

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



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Sun Aug 23 16:03:54 UTC 2020

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

Log Message:
Expand test to cover more failure cases.  Change from skipped to expect fail
in anticipation of working roll-forward code.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/lfs/t_rfw.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/lfs/t_rfw.c
diff -u src/tests/fs/lfs/t_rfw.c:1.1 src/tests/fs/lfs/t_rfw.c:1.2
--- src/tests/fs/lfs/t_rfw.c:1.1	Tue Aug 18 03:02:50 2020
+++ src/tests/fs/lfs/t_rfw.c	Sun Aug 23 16:03:54 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: t_rfw.c,v 1.1 2020/08/18 03:02:50 perseant Exp $	*/
+/*	$NetBSD: t_rfw.c,v 1.2 2020/08/23 16:03:54 perseant Exp $	*/
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -25,7 +25,6 @@
 
 /* Debugging conditions */
 /* #define FORCE_SUCCESS */ /* Don't actually revert, everything worked */
-/* #define FORCE_SYSCTL */ /* Don't check - necessary for FORCE_SUCCESS */
 
 /* Write a well-known byte pattern into a file, appending if it exists */
 int write_file(const char *, int);
@@ -33,6 +32,12 @@ int write_file(const char *, int);
 /* Check the byte pattern and size of the file */
 int check_file(const char *, int);
 
+/* Check the file system for consistency */
+int fsck(void);
+
+/* Actually run the test, differentiating the orphaned delete problem */
+void test(int);
+
 ATF_TC(rfw);
 ATF_TC_HEAD(rfw, tc)
 {
@@ -41,42 +46,39 @@ ATF_TC_HEAD(rfw, tc)
 	atf_tc_set_md_var(tc, "timeout", "20");
 }
 
+#define MAXLINE 132
+#define CHUNKSIZE 300
+
 #define IMGNAME "disk.img"
 #define FAKEBLK "/dev/blk"
 #define LOGFILE "newfs.log"
 #define SBLOCK0_COPY "sb0.dd"
 #define SBLOCK1_COPY "sb1.dd"
-#define MAXLINE 132
-#define CHUNKSIZE 300
+
+#define MP "/mp"
+#define UNCHANGED_CONTROL MP "/3-unchanged-control"
+#define TO_BE_DELETED MP "/4-to-be-deleted"
+#define TO_BE_APPENDEDMP "/5-to-be-appended"
+#define NEWLY_CREATED MP "/6-newly-created"
+
+long long sbaddr[2] = { -1, -1 };
+const char *sblock[2] = { SBLOCK0_COPY, SBLOCK1_COPY };
+
 ATF_TC_BODY(rfw, tc)
 {
 	struct ufs_args args;
 	FILE *pipe;
-#if (!defined FORCE_SUCCESS && !defined FORCE_SYSCTL)
-	int o_sysctl_rfw;
-	int n_sysctl_rfw;
-	int mib[3];
-	size_t len;
-#endif
 	char buf[MAXLINE];
-	long long sb0addr = -1, sb1addr = -1;
+	int i;
+
+	setvbuf(stdout, NULL, _IONBF, 0);
 
 	/*
 	 * Initialize.
 	 */
-#if (!defined FORCE_SUCCESS && !defined FORCE_SYSCTL)
-	/* Set sysctl to allow roll-forward */
-	fprintf(stderr, "* Set sysctl\n");
-	mib[0] = CTL_VFS;
-	mib[1] = 5; /* LFS */
-	mib[2] = LFS_DO_RFW;
-	len = sizeof(o_sysctl_rfw);
-	if (sysctl(mib, 3, _sysctl_rfw, ,
-		_sysctl_rfw, sizeof(n_sysctl_rfw)) < 0)
-		atf_tc_skip("roll-forward not enabled in kernel");
-#endif /* !FORCE_SUCCESS && !FORCE_SYSCTL */
+	atf_tc_expect_fail("roll-forward not yet implemented");
 
-	/* Create filesystem */
+	/* Create filesystem, note superblock locations */
 	fprintf(stderr, "* Create file system\n");
 	if (system("newfs_lfs -D -F -s 1 ./" IMGNAME " > " LOGFILE) == -1)
 		atf_tc_fail_errno("newfs failed");
@@ -84,20 +86,20 @@ ATF_TC_BODY(rfw, tc)
 	if (pipe == NULL)
 		atf_tc_fail_errno("newfs failed to execute");
 	while (fgets(buf, MAXLINE, pipe) != NULL) {
-		if (sscanf(buf, "%lld,%lld", , ) == 2)
+		if (sscanf(buf, "%lld,%lld", sbaddr, sbaddr + 1) == 2)
 			break;
 	}
 	while (fgets(buf, MAXLINE, pipe) != NULL)
 		;
 	fclose(pipe);
-	if (sb0addr < 0 || sb1addr < 0)
+	if (sbaddr[0] < 0 || sbaddr[1] < 0)
 		atf_tc_fail("superblock not found");
 	fprintf(stderr, "* Superblocks at %lld and %lld\n",
-		sb0addr, sb1addr);
+		sbaddr[0], sbaddr[1]);
 
 	/* Set up rump */
 	rump_init();
-	if (rump_sys_mkdir("/mp", 0777) == -1)
+	if (rump_sys_mkdir(MP, 0777) == -1)
 		atf_tc_fail_errno("cannot create mountpoint");
 	rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
 
@@ -107,61 +109,63 @@ ATF_TC_BODY(rfw, tc)
 	 */
 
 	/* Mount filesystem */
-	fprintf(stderr, "* Mount fs [1]\n");
+	fprintf(stderr, "* Mount fs [1, initial]\n");
 	memset(, 0, sizeof(args));
 	args.fspec = __UNCONST(FAKEBLK);
-	if (rump_sys_mount(MOUNT_LFS, "/mp", 0, , sizeof(args)) == -1)
+	if (rump_sys_mount(MOUNT_LFS, MP, 0, , sizeof(args)) == -1)
 		atf_tc_fail_errno("rump_sys_mount failed");
 
 	/* Payload */
 	fprintf(stderr, "* Initial payload\n");
-	write_file("/mp/to_be_deleted", CHUNKSIZE);
-	write_file("/mp/to_be_appended", CHUNKSIZE);
-
-	/* Unmount */
-	rump_sys_unmount("/mp", 0);
+	write_file(UNCHANGED_CONTROL, CHUNKSIZE);
+	write_file(TO_BE_DELETED, CHUNKSIZE);
+	write_file(TO_BE_APPENDED, CHUNKSIZE);
+	rump_sys_sync();
+	rump_sys_sync();
+	sleep(1); /* XXX yuck - but we need the superblocks dirty */
 
 	/* Make copies of superblocks */
-	sprintf(buf, "dd if=%s of=%s bs=512 iseek=%lld count=16 conv=sync",

CVS commit: src/tests/fs/lfs

2010-11-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Nov 15 21:29:39 UTC 2010

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

Log Message:
double the timeout for slow hosts (from 1 to 2 seconds)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/lfs/t_pr.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/lfs/t_pr.c
diff -u src/tests/fs/lfs/t_pr.c:1.4 src/tests/fs/lfs/t_pr.c:1.5
--- src/tests/fs/lfs/t_pr.c:1.4	Sun Nov  7 17:51:17 2010
+++ src/tests/fs/lfs/t_pr.c	Mon Nov 15 21:29:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pr.c,v 1.4 2010/11/07 17:51:17 jmmv Exp $	*/
+/*	$NetBSD: t_pr.c,v 1.5 2010/11/15 21:29:39 pooka Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -24,7 +24,7 @@
 {
 
 	atf_tc_set_md_var(tc, descr, mknod(2) hangs on LFS (PR kern/43503));
-	atf_tc_set_md_var(tc, timeout, 1);
+	atf_tc_set_md_var(tc, timeout, 2);
 }
 
 #define IMGNAME disk.img



CVS commit: src/tests/fs/lfs

2010-11-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Nov 15 21:29:39 UTC 2010

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

Log Message:
double the timeout for slow hosts (from 1 to 2 seconds)


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

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



CVS commit: src/tests/fs/lfs

2010-07-03 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Sat Jul  3 08:31:37 UTC 2010

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

Log Message:
Re-add PR number and expected failure condition (as a comment, because the
problem is resolved).  Per pooka's request.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/lfs/t_pr.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/lfs/t_pr.c
diff -u src/tests/fs/lfs/t_pr.c:1.2 src/tests/fs/lfs/t_pr.c:1.3
--- src/tests/fs/lfs/t_pr.c:1.2	Sat Jul  3 08:18:30 2010
+++ src/tests/fs/lfs/t_pr.c	Sat Jul  3 08:31:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pr.c,v 1.2 2010/07/03 08:18:30 jmmv Exp $	*/
+/*	$NetBSD: t_pr.c,v 1.3 2010/07/03 08:31:37 jmmv Exp $	*/
 
 #include sys/types.h
 #include sys/mount.h
@@ -48,6 +48,7 @@
 	if (rump_sys_mount(MOUNT_LFS, /mp, 0, args, sizeof(args)) == -1)
 		atf_tc_fail_errno(rump_sys_mount failed);
 
+	//atf_tc_expect_timeout(PR kern/43503);
 	if (rump_sys_mknod(/mp/node, S_IFCHR | 0777, 0) == -1)
 		atf_tc_fail_errno(mknod failed);
 }