CVS commit: src/tests/sbin/resize_ffs

2020-03-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 15 11:17:59 UTC 2020

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Skip tests where the old or the new image size seem to not fit into
the working directory.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.16 src/tests/sbin/resize_ffs/common.sh:1.17
--- src/tests/sbin/resize_ffs/common.sh:1.16	Thu Mar 12 18:08:54 2020
+++ src/tests/sbin/resize_ffs/common.sh	Sun Mar 15 11:17:59 2020
@@ -115,6 +115,12 @@ resize_ffs()
 	local fslevel=$5
 	local numdata=$6
 	local swap=$7
+	local avail=$( df -m . | awk '{if (int($4) > 0) print $4}' )
+	# convert MB size to blocks
+	avail=$(( $avail \* 2 \* 1024 ))
+	if [ $avail -lt $osize ] || [ $avail -lt $nsize ]; then
+		atf_skip "not enough free space in working directory"
+	fi
 	mkdir -p mnt
 	echo "bs is ${bs} numdata is ${numdata}"
 	echo "resizing fs with blocksize ${bs}"



CVS commit: src/tests/sbin/resize_ffs

2020-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 12 18:08:54 UTC 2020

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.15 src/tests/sbin/resize_ffs/common.sh:1.16
--- src/tests/sbin/resize_ffs/common.sh:1.15	Sun Oct  8 21:12:27 2017
+++ src/tests/sbin/resize_ffs/common.sh	Thu Mar 12 18:08:54 2020
@@ -140,7 +140,7 @@ resize_ffs()
 		then
 			atf_skip 'No PUFFS available in kernel'
 		else
-			aft_fail "rump_ffs mount failed: $(tail -r S.Err |
+			atf_fail "rump_ffs mount failed: $(tail -r S.Err |
 sed -e '/^$/d' -e p -e q )"
 		fi
 	fi



CVS commit: src/tests/sbin/resize_ffs

2017-10-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Oct  8 21:12:28 UTC 2017

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Make most of the resize_ffs tests skip if PUFFS is not configured
in the kernel.   (nb: for this purpose, a module that is configured
to autoload counts as configured in the kernel...)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.14 src/tests/sbin/resize_ffs/common.sh:1.15
--- src/tests/sbin/resize_ffs/common.sh:1.14	Sun Mar 29 19:37:02 2015
+++ src/tests/sbin/resize_ffs/common.sh	Sun Oct  8 21:12:27 2017
@@ -134,7 +134,17 @@ resize_ffs()
 	fi
 
 	# we're specifying relative paths, so rump_ffs warns - ignore.
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
+	if ! rump_ffs ${IMG} mnt >/dev/null 2>S.Err
+	then
+		if grep 'puffs_daemon: Operation not supported by device' S.Err >/dev/null
+		then
+			atf_skip 'No PUFFS available in kernel'
+		else
+			aft_fail "rump_ffs mount failed: $(tail -r S.Err |
+sed -e '/^$/d' -e p -e q )"
+		fi
+	fi
+
 	copy_multiple ${numdata}
 
 	if [ ${nsize} -lt ${osize} ]; then



CVS commit: src/tests/sbin/resize_ffs

2011-05-17 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue May 17 22:01:41 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Add require root user to test_case_xfail. Avoids reporting expected
failure for the wrong reason with unprivileged runs (puffs access
denied).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.11 src/tests/sbin/resize_ffs/common.sh:1.12
--- src/tests/sbin/resize_ffs/common.sh:1.11	Fri Mar  4 17:56:53 2011
+++ src/tests/sbin/resize_ffs/common.sh	Tue May 17 22:01:41 2011
@@ -44,6 +44,9 @@
 	local check_function="${1}"; shift
 
 	atf_test_case "${name}" cleanup
+	eval "${name}_head() { \
+		atf_set "require.user" "root" ; \
+	}"
 	eval "${name}_body() { \
 		atf_expect_fail "${reason}" ; \
 		${check_function} " "${@}" "; \



CVS commit: src/tests/sbin/resize_ffs

2011-03-04 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Mar  4 17:56:53 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Back out previous;  it's causing intermittent problems which I don't
fully understand yet.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.10 src/tests/sbin/resize_ffs/common.sh:1.11
--- src/tests/sbin/resize_ffs/common.sh:1.10	Thu Mar  3 16:25:15 2011
+++ src/tests/sbin/resize_ffs/common.sh	Fri Mar  4 17:56:53 2011
@@ -14,8 +14,6 @@
 	else
 		BYTESWAP=le
 	fi
-	rumpsrv="rump_server -lrumpvfs -lrumpfs_ffs -d key=/img,hostpath=${IMG},size=host"
-	export RUMP_SERVER=unix://sock
 }
 
 # test_case() taken from the tests/ipf/h_common.sh
@@ -27,13 +25,14 @@
 
 	atf_test_case "${name}" cleanup
 	eval "${name}_head() { \
-		atf_set "descr" "resize_ffs test" ; \
+		atf_set "require.user" "root" ; \
 	}"
 	eval "${name}_body() { \
 		${check_function} " "${@}" "; \
 	}"
 	eval "${name}_cleanup() { \
-		rump.halt
+		umount -f mnt  ; \
+		: reset error ; \
 	}"
 }
 
@@ -58,7 +57,7 @@
 # copy_data requires the mount already done;  makes one copy of the test data
 copy_data ()
 {
-	uudecode -p ${TDBASE64} | tar xzf - -C /rump/mnt -s/testdata/TD$1/
+	uudecode -p ${TDBASE64} | (cd mnt; tar xzf - -s/testdata/TD$1/)
 }
 
 copy_multiple ()
@@ -73,7 +72,7 @@
 # is to ensure data exists near the end of the fs under test.
 remove_data ()
 {
-	rm -rf /rump/mnt/TD$1
+	rm -rf mnt/TD$1
 }
 
 remove_multiple ()
@@ -88,8 +87,8 @@
 # generated md5 file doesn't need explicit cleanup thanks to ATF
 check_data ()
 {
-	atf_check -x -o file:${GOODMD5} \
-	"md5 /rump/mnt/TD$1/* | sed s,/rump/mnt/TD$1/,,"
+	(cd mnt/TD$1 && md5 *) > TD$1.md5
+	atf_check diff -u ${GOODMD5} TD$1.md5
 }
 
 # supply begin and end arguments
@@ -101,15 +100,6 @@
 	done
 }
 
-domount ()
-{
-	atf_check -s exit:0 -e ignore mount_ffs /img /rump/mnt
-}
-
-dounmount ()
-{
-	atf_check -s exit:0 umount -R /rump/mnt
-}
 
 resize_ffs()
 {
@@ -121,6 +111,7 @@
 	local fslevel=$5
 	local numdata=$6
 	local swap=$7
+	mkdir -p mnt
 	echo "bs is ${bs} numdata is ${numdata}"
 	echo "resizing fs with blocksize ${bs}"
 
@@ -139,12 +130,7 @@
 	fi
 
 	# we're specifying relative paths, so rump_ffs warns - ignore.
-	echo RUMP_SERVER is ${RUMP_SERVER}
-	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
-	export LD_PRELOAD=/usr/lib/librumphijack.so
-	mkdir /rump/mnt
-	domount
-
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	copy_multiple ${numdata}
 
 	if [ ${nsize} -lt ${osize} ]; then
@@ -155,20 +141,15 @@
 	remove_multiple ${remove}
 	fi
 
-	dounmount
-	rump.halt
-	unset LD_PRELOAD
+	umount mnt
 	atf_check -s exit:0 -o ignore resize_ffs -y -s ${nsize} ${IMG}
 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
-	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
-	export LD_PRELOAD=/usr/lib/librumphijack.so
-	mkdir /rump/mnt
-	domount
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	if [ ${nsize} -lt ${osize} ]; then
 	check_data_range $((remove + 1)) ${numdata}
 	else
 	# checking everything because we don't delete on grow
 	check_data_range 1 ${numdata}
 	fi
-	dounmount
+	umount mnt
 }



CVS commit: src/tests/sbin/resize_ffs

2011-03-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar  3 16:25:16 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Switch from using "rump_ffs" to mount the file system image to
using a rump_server to mount it in a rump kernel, and librumphijack.so
to enable accessing it from the test program.  Among other things,
this allows the tests to run as an unprivileged user.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.9 src/tests/sbin/resize_ffs/common.sh:1.10
--- src/tests/sbin/resize_ffs/common.sh:1.9	Wed Jan  5 18:13:54 2011
+++ src/tests/sbin/resize_ffs/common.sh	Thu Mar  3 16:25:15 2011
@@ -14,6 +14,8 @@
 	else
 		BYTESWAP=le
 	fi
+	rumpsrv="rump_server -lrumpvfs -lrumpfs_ffs -d key=/img,hostpath=${IMG},size=host"
+	export RUMP_SERVER=unix://sock
 }
 
 # test_case() taken from the tests/ipf/h_common.sh
@@ -25,14 +27,13 @@
 
 	atf_test_case "${name}" cleanup
 	eval "${name}_head() { \
-		atf_set "require.user" "root" ; \
+		atf_set "descr" "resize_ffs test" ; \
 	}"
 	eval "${name}_body() { \
 		${check_function} " "${@}" "; \
 	}"
 	eval "${name}_cleanup() { \
-		umount -f mnt  ; \
-		: reset error ; \
+		rump.halt
 	}"
 }
 
@@ -57,7 +58,7 @@
 # copy_data requires the mount already done;  makes one copy of the test data
 copy_data ()
 {
-	uudecode -p ${TDBASE64} | (cd mnt; tar xzf - -s/testdata/TD$1/)
+	uudecode -p ${TDBASE64} | tar xzf - -C /rump/mnt -s/testdata/TD$1/
 }
 
 copy_multiple ()
@@ -72,7 +73,7 @@
 # is to ensure data exists near the end of the fs under test.
 remove_data ()
 {
-	rm -rf mnt/TD$1
+	rm -rf /rump/mnt/TD$1
 }
 
 remove_multiple ()
@@ -87,8 +88,8 @@
 # generated md5 file doesn't need explicit cleanup thanks to ATF
 check_data ()
 {
-	(cd mnt/TD$1 && md5 *) > TD$1.md5
-	atf_check diff -u ${GOODMD5} TD$1.md5
+	atf_check -x -o file:${GOODMD5} \
+	"md5 /rump/mnt/TD$1/* | sed s,/rump/mnt/TD$1/,,"
 }
 
 # supply begin and end arguments
@@ -100,6 +101,15 @@
 	done
 }
 
+domount ()
+{
+	atf_check -s exit:0 -e ignore mount_ffs /img /rump/mnt
+}
+
+dounmount ()
+{
+	atf_check -s exit:0 umount -R /rump/mnt
+}
 
 resize_ffs()
 {
@@ -111,7 +121,6 @@
 	local fslevel=$5
 	local numdata=$6
 	local swap=$7
-	mkdir -p mnt
 	echo "bs is ${bs} numdata is ${numdata}"
 	echo "resizing fs with blocksize ${bs}"
 
@@ -130,7 +139,12 @@
 	fi
 
 	# we're specifying relative paths, so rump_ffs warns - ignore.
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
+	echo RUMP_SERVER is ${RUMP_SERVER}
+	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	mkdir /rump/mnt
+	domount
+
 	copy_multiple ${numdata}
 
 	if [ ${nsize} -lt ${osize} ]; then
@@ -141,15 +155,20 @@
 	remove_multiple ${remove}
 	fi
 
-	umount mnt
+	dounmount
+	rump.halt
+	unset LD_PRELOAD
 	atf_check -s exit:0 -o ignore resize_ffs -y -s ${nsize} ${IMG}
 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
+	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	mkdir /rump/mnt
+	domount
 	if [ ${nsize} -lt ${osize} ]; then
 	check_data_range $((remove + 1)) ${numdata}
 	else
 	# checking everything because we don't delete on grow
 	check_data_range 1 ${numdata}
 	fi
-	umount mnt
+	dounmount
 }



CVS commit: src/tests/sbin/resize_ffs

2011-01-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jan 11 00:50:02 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: t_grow.sh t_grow_swapped.sh

Log Message:
Copy a little less data in the ufs2, 4096-byte block test cases.
The file system was filling up instead of *almost* filling up, which
threw off the tests.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/sbin/resize_ffs/t_grow.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/resize_ffs/t_grow_swapped.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.7 src/tests/sbin/resize_ffs/t_grow.sh:1.8
--- src/tests/sbin/resize_ffs/t_grow.sh:1.7	Wed Jan  5 02:25:27 2011
+++ src/tests/sbin/resize_ffs/t_grow.sh	Tue Jan 11 00:50:02 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.7 2011/01/05 02:25:27 riz Exp $
+# $NetBSD: t_grow.sh,v 1.8 2011/01/11 00:50:02 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -96,22 +96,22 @@
 test_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29
 test_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28
 test_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25
-test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 41
+test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40
 test_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42
 test_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43
 test_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42
 test_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38
-test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 55
+test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53
 test_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56
 test_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58
 test_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56
 test_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51
-test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 82
+test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80
 test_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84
 test_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87
 test_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83
 test_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76
-test_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 109
+test_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107
 test_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111
 test_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115
 test_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111

Index: src/tests/sbin/resize_ffs/t_grow_swapped.sh
diff -u src/tests/sbin/resize_ffs/t_grow_swapped.sh:1.1 src/tests/sbin/resize_ffs/t_grow_swapped.sh:1.2
--- src/tests/sbin/resize_ffs/t_grow_swapped.sh:1.1	Wed Jan  5 02:25:27 2011
+++ src/tests/sbin/resize_ffs/t_grow_swapped.sh	Tue Jan 11 00:50:02 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow_swapped.sh,v 1.1 2011/01/05 02:25:27 riz Exp $
+# $NetBSD: t_grow_swapped.sh,v 1.2 2011/01/11 00:50:02 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -96,22 +96,22 @@
 test_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29 swap
 test_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28 swap
 test_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25 swap
-test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 41 swap
+test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40 swap
 test_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42 swap
 test_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43 swap
 test_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42 swap
 test_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38 swap
-test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 55 swap
+test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53 swap
 test_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56 swap
 test_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58 swap
 test_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56 swap
 test_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51 swap
-test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 82 swap
+test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80 swap
 test_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84 swap
 test_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87 swap
 test_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83 swap
 test_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76 swap
-test_case grow_64M_v2_4096 resiz

CVS commit: src/tests/sbin/resize_ffs

2011-01-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Jan  5 18:13:54 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Replace uses of 'jot' with 'seq'.  This is primarily to work around
a qemu-running-on-netbsd problem with FP which causes 'jot' to output
incorrect sequences, which were causing failures on one of the auto-testing
platforms.  While 'seq' also uses FP, it does not seem to be affected in
this particular usage

As a bonus, however, 'seq' is actually a better fit (the commandline is
more intuitive) for the way it is used in these tests.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.8 src/tests/sbin/resize_ffs/common.sh:1.9
--- src/tests/sbin/resize_ffs/common.sh:1.8	Wed Jan  5 18:05:32 2011
+++ src/tests/sbin/resize_ffs/common.sh	Wed Jan  5 18:13:54 2011
@@ -63,7 +63,7 @@
 copy_multiple ()
 {
 	local i
-	for i in $(jot $1); do
+	for i in $(seq $1); do
 		copy_data $i
 	done
 }
@@ -78,7 +78,7 @@
 remove_multiple ()
 {
 	local i
-	for i in $(jot $1); do
+	for i in $(seq $1); do
 		remove_data $i
 	done
 }
@@ -95,7 +95,7 @@
 check_data_range ()
 {
 	local i
-	for i in $(jot $(($2-$1+1)) $1); do
+	for i in $(seq $1 $2); do
 		check_data $i
 	done
 }



CVS commit: src/tests/sbin/resize_ffs

2011-01-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Jan  5 18:05:32 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Restore data integrity verification in the grow case which was
inadvertantly removed when refactoring occurred in a prior
revision.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.7 src/tests/sbin/resize_ffs/common.sh:1.8
--- src/tests/sbin/resize_ffs/common.sh:1.7	Wed Jan  5 03:04:13 2011
+++ src/tests/sbin/resize_ffs/common.sh	Wed Jan  5 18:05:32 2011
@@ -146,8 +146,10 @@
 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
 	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	if [ ${nsize} -lt ${osize} ]; then
-	# checking everything because we don't delete on grow
 	check_data_range $((remove + 1)) ${numdata}
+	else
+	# checking everything because we don't delete on grow
+	check_data_range 1 ${numdata}
 	fi
 	umount mnt
 }



CVS commit: src/tests/sbin/resize_ffs

2011-01-04 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Jan  5 03:04:13 UTC 2011

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
All of the generated tests require root, for rump_ffs.  Spotted by
nj...@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.6 src/tests/sbin/resize_ffs/common.sh:1.7
--- src/tests/sbin/resize_ffs/common.sh:1.6	Wed Jan  5 02:25:27 2011
+++ src/tests/sbin/resize_ffs/common.sh	Wed Jan  5 03:04:13 2011
@@ -24,6 +24,9 @@
 	local check_function="${1}"; shift
 
 	atf_test_case "${name}" cleanup
+	eval "${name}_head() { \
+		atf_set "require.user" "root" ; \
+	}"
 	eval "${name}_body() { \
 		${check_function} " "$...@}" "; \
 	}"



CVS commit: src/tests/sbin/resize_ffs

2010-12-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec 16 17:50:13 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_grow.sh t_shrink.sh

Log Message:
Reduce the number of tests run automatically, as they apparently go
quite slowly when run under qemu.

Also, change the switch variable from "RESIZE_FFS_BIG_TESTS" to
"RESIZE_FFS_ALL_TESTS", and only check if it's set or not.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/sbin/resize_ffs/t_grow.sh \
src/tests/sbin/resize_ffs/t_shrink.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.5 src/tests/sbin/resize_ffs/t_grow.sh:1.6
--- src/tests/sbin/resize_ffs/t_grow.sh:1.5	Thu Dec 16 17:16:07 2010
+++ src/tests/sbin/resize_ffs/t_grow.sh	Thu Dec 16 17:50:13 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.5 2010/12/16 17:16:07 riz Exp $
+# $NetBSD: t_grow.sh,v 1.6 2010/12/16 17:50:13 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -97,6 +97,7 @@
 	atf_add_test_case grow_16M_v1_16384
 	atf_add_test_case grow_16M_v1_32768
 	atf_add_test_case grow_16M_v1_65536
+if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
 	atf_add_test_case grow_24M_v1_4096
 	atf_add_test_case grow_24M_v1_8192
 	atf_add_test_case grow_24M_v1_16384
@@ -107,7 +108,6 @@
 	atf_add_test_case grow_32M_v1_16384
 	atf_add_test_case grow_32M_v1_32768
 	atf_add_test_case grow_32M_v1_65536
-if [ "X${RESIZE_FFS_BIG_TESTS}" != "X" ]; then
 	atf_add_test_case grow_48M_v1_4096
 	atf_add_test_case grow_48M_v1_8192
 	atf_add_test_case grow_48M_v1_16384
Index: src/tests/sbin/resize_ffs/t_shrink.sh
diff -u src/tests/sbin/resize_ffs/t_shrink.sh:1.5 src/tests/sbin/resize_ffs/t_shrink.sh:1.6
--- src/tests/sbin/resize_ffs/t_shrink.sh:1.5	Thu Dec 16 17:16:07 2010
+++ src/tests/sbin/resize_ffs/t_shrink.sh	Thu Dec 16 17:50:13 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_shrink.sh,v 1.5 2010/12/16 17:16:07 riz Exp $
+# $NetBSD: t_shrink.sh,v 1.6 2010/12/16 17:50:13 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -91,12 +91,12 @@
 	atf_add_test_case shrink_24M_16M_v1_16384
 	atf_add_test_case shrink_24M_16M_v1_32768
 	atf_add_test_case shrink_24M_16M_v1_65536
+if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
 	atf_add_test_case shrink_32M_24M_v1_4096
 	atf_add_test_case shrink_32M_24M_v1_8192
 	atf_add_test_case shrink_32M_24M_v1_16384
 	atf_add_test_case shrink_32M_24M_v1_32768
 	atf_add_test_case shrink_32M_24M_v1_65536
-if [ "X${RESIZE_FFS_BIG_TESTS}" != "X" ]; then
 	atf_add_test_case shrink_48M_16M_v1_4096
 	atf_add_test_case shrink_48M_16M_v1_8192
 	atf_add_test_case shrink_48M_16M_v1_16384



CVS commit: src/tests/sbin/resize_ffs

2010-12-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec 16 17:16:07 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: common.sh t_grow.sh t_shrink.sh

Log Message:
Factor out more common code.  No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/resize_ffs/common.sh \
src/tests/sbin/resize_ffs/t_grow.sh src/tests/sbin/resize_ffs/t_shrink.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.4 src/tests/sbin/resize_ffs/common.sh:1.5
--- src/tests/sbin/resize_ffs/common.sh:1.4	Sat Dec 11 11:36:48 2010
+++ src/tests/sbin/resize_ffs/common.sh	Thu Dec 16 17:16:07 2010
@@ -96,3 +96,56 @@
 		check_data $i
 	done
 }
+
+
+resize_ffs()
+{
+	echo "in shrink_ffs:" $...@}
+	local bs=$1
+	local fragsz=$2
+	local osize=$3
+	local nsize=$4
+	local fslevel=$5
+	local numdata=$6
+	local swap=$7
+	mkdir -p mnt
+	echo "bs is ${bs} numdata is ${numdata}"
+	echo "shrinking fs with blocksize ${bs}"
+
+	# we want no more than 16K/inode to allow test files to copy.
+	local fpi=$((fragsz * 4))
+	local i
+	if [ $fpi -gt 16384 ]; then
+		i="-i 16384"
+	fi
+	if [ x$swap != x ]; then
+		newfs -B ${BYTESWAP} -O${fslevel} -b ${bs} -f ${fragsz} \
+			-s ${osize} ${i} -F ${IMG}
+	else
+		newfs -O${fslevel} -b ${bs} -f ${fragsz} -s ${osize} ${i} \
+			-F ${IMG}
+	fi
+
+	# we're specifying relative paths, so rump_ffs warns - ignore.
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
+	copy_multiple ${numdata}
+
+	if [ ${nsize} -lt ${osize} ]; then
+	# how much data to remove so fs can be shrunk
+	local remove=$((numdata-numdata*nsize/osize))
+	local dataleft=$((numdata-remove))
+	echo remove is $remove dataleft is $dataleft
+	remove_multiple ${remove}
+	fi
+
+	umount mnt
+	atf_check -s exit:0 -o ignore resize_ffs -y -s ${nsize} ${IMG}
+	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
+	if [ ${nsize} -lt ${osize} ]; then
+	# checking everything because we don't delete on grow
+	check_data_range $((remove + 1)) ${numdata}
+	fi
+	umount mnt
+	rm -f ${IMG}	# probably unnecessary
+}
Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.4 src/tests/sbin/resize_ffs/t_grow.sh:1.5
--- src/tests/sbin/resize_ffs/t_grow.sh:1.4	Sun Dec 12 22:50:42 2010
+++ src/tests/sbin/resize_ffs/t_grow.sh	Thu Dec 16 17:16:07 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.4 2010/12/12 22:50:42 riz Exp $
+# $NetBSD: t_grow.sh,v 1.5 2010/12/16 17:16:07 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,85 +28,45 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-grow_ffs()
-{
-	echo "in grow_ffs:" $...@}
-	local bs=$1
-	local fragsz=$2
-	local osize=$3
-	local nsize=$4
-	local fslevel=$5
-	local numdata=$6
-	local swap=$7
-	mkdir -p mnt
-	echo "bs is ${bs} numdata is ${numdata}"
-	echo "growing fs with blocksize ${bs}"
-
-	# we want no more than 16K/inode to allow test files to copy.
-	local fpi=$((fragsz * 4))
-	local i
-	if [ $fpi -gt 16384 ]; then
-		i="-i 16384"
-	fi
-	if [ x$swap != x ]; then
-		newfs -B ${BYTESWAP} -O${fslevel} -b ${bs} -f ${fragsz} \
-			-s ${osize} ${i} -F ${IMG}
-	else
-		newfs -O${fslevel} -b ${bs} -f ${fragsz} -s ${osize} ${i} \
-			-F ${IMG}
-	fi
-
-	# we're specifying relative paths, so rump_ffs warns - ignore.
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
-	copy_multiple ${numdata}
-	umount mnt
-	atf_check -s exit:0 resize_ffs -y -s ${nsize} ${IMG}
-	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
-	# checking everything because we don't delete on grow
-	check_data_range 1 ${numdata}
-	umount mnt
-	rm -f ${IMG}	# probably unnecessary
-}
 
-# grow_ffs params as follows:
-# grow_ffs blocksize fragsize fssize newfssize level numdata swap
+# resize_ffs params as follows:
+# resize_ffs blocksize fragsize fssize newfssize level numdata swap
 # where 'numdata' is the number of data directories to copy - this is
 # determined manually based on the maximum number that will fit in the
 # created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
 # If 'swap' is included, byteswap the fs
-test_case grow_16M_v1_4096 grow_ffs 4096 512 32768 131072 1 28
-test_case_xfail grow_16M_v1_4096_swapped "PR bin/44203" grow_ffs 4096 512 32768 131072 1 28 swap
-test_case_xfail grow_16M_v2_4096 "PR bin/44205" grow_ffs 4096 512 32768 131072 2 28
-test_case_xfail grow_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" grow_ffs 4096 512 32768 131072 2 28 swap
-test_case grow_16M_v1_8192 grow_ffs 8192 1024 32768 131072 1 28
-test_case grow_16M_v1_16384 grow_ffs 16384 2048 32768 131072 1 29
-test_case grow_16M_v1_32768 grow_ffs 32768 4096 32768 131072 1 28
-test_case grow_16M_v1_65536 grow_ffs 65536 

CVS commit: src/tests/sbin/resize_ffs

2010-12-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Dec 12 22:50:42 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_grow.sh t_shrink.sh

Log Message:
PR bin/44209 is now fixed, expect failure -> expect success.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/resize_ffs/t_grow.sh \
src/tests/sbin/resize_ffs/t_shrink.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.3 src/tests/sbin/resize_ffs/t_grow.sh:1.4
--- src/tests/sbin/resize_ffs/t_grow.sh:1.3	Sat Dec 11 11:31:27 2010
+++ src/tests/sbin/resize_ffs/t_grow.sh	Sun Dec 12 22:50:42 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.3 2010/12/11 11:31:27 pooka Exp $
+# $NetBSD: t_grow.sh,v 1.4 2010/12/12 22:50:42 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -97,12 +97,12 @@
 test_case grow_48M_v1_4096 grow_ffs 4096 512 98304 131072 1 82
 test_case grow_48M_v1_8192 grow_ffs 8192 1024 98304 131072 1 84
 test_case grow_48M_v1_16384 grow_ffs 16384 2048 98304 131072 1 87
-test_case_xfail grow_48M_v1_32768 "PR bin/44209" grow_ffs 32768 4096 98304 131072 1 83
+test_case grow_48M_v1_32768 grow_ffs 32768 4096 98304 131072 1 83
 test_case grow_48M_v1_65536 grow_ffs 65536 8192 98304 131072 1 76
 test_case grow_64M_v1_4096 grow_ffs 4096 512 131072 262144 1 109
 test_case grow_64M_v1_8192 grow_ffs 8192 1024 131072 262144 1 111
 test_case grow_64M_v1_16384 grow_ffs 16384 2048 131072 262144 1 115
-test_case_xfail grow_64M_v1_32768 "PR bin/44209" grow_ffs 32768 4096 131072 262144 1 111
+test_case grow_64M_v1_32768 grow_ffs 32768 4096 131072 262144 1 111
 test_case grow_64M_v1_65536 grow_ffs 65536 8192 131072 262144 1 101
 test_case_xfail grow_64M_v1_65536_swapped "PR bin/44203" grow_ffs 65536 8192 131072 262144 1 101 swap
 test_case_xfail grow_64M_v2_65536 "PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101
Index: src/tests/sbin/resize_ffs/t_shrink.sh
diff -u src/tests/sbin/resize_ffs/t_shrink.sh:1.3 src/tests/sbin/resize_ffs/t_shrink.sh:1.4
--- src/tests/sbin/resize_ffs/t_shrink.sh:1.3	Sat Dec 11 11:31:27 2010
+++ src/tests/sbin/resize_ffs/t_shrink.sh	Sun Dec 12 22:50:42 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_shrink.sh,v 1.3 2010/12/11 11:31:27 pooka Exp $
+# $NetBSD: t_shrink.sh,v 1.4 2010/12/12 22:50:42 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -98,12 +98,12 @@
 test_case shrink_48M_16M_v1_4096 shrink_ffs 4096 512 98304 32768 1 82
 test_case shrink_48M_16M_v1_8192 shrink_ffs 8192 1024 98304 32768 1 84
 test_case shrink_48M_16M_v1_16384 shrink_ffs 16384 2048 98304 32768 1 87
-test_case_xfail shrink_48M_16M_v1_32768 "PR bin/44209" shrink_ffs 32768 4096 98304 32768 1 83
+test_case shrink_48M_16M_v1_32768 shrink_ffs 32768 4096 98304 32768 1 83
 test_case shrink_48M_16M_v1_65536 shrink_ffs 65536 8192 98304 32768 1 76
 test_case shrink_64M_48M_v1_4096 shrink_ffs 4096 512 131072 98304 1 109
 test_case shrink_64M_48M_v1_8192 shrink_ffs 8192 1024 131072 98304 1 111
 test_case shrink_64M_48M_v1_16384 shrink_ffs 16384 2048 131072 98304 1 115
-test_case_xfail shrink_64M_48M_v1_32768 "PR bin/44209" shrink_ffs 32768 4096 131072 98304 1 111
+test_case shrink_64M_48M_v1_32768 shrink_ffs 32768 4096 131072 98304 1 111
 test_case shrink_64M_48M_v1_65536 shrink_ffs 65536 8192 131072 98304 1 101
 test_case_xfail shrink_64M_48M_v1_65536_swapped "PR bin/44203" shrink_ffs 65536 8192 131072 98304 1 101 swap
 test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" shrink_ffs 65536 8192 131072 98304 2 101



CVS commit: src/tests/sbin/resize_ffs

2010-12-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Dec 11 11:36:48 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Reset error from umount.  This squelches atf "cleanup should not
fail" warning if a test fails when the fs is not mounted.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.3 src/tests/sbin/resize_ffs/common.sh:1.4
--- src/tests/sbin/resize_ffs/common.sh:1.3	Sat Dec 11 11:31:27 2010
+++ src/tests/sbin/resize_ffs/common.sh	Sat Dec 11 11:36:48 2010
@@ -29,6 +29,7 @@
 	}"
 	eval "${name}_cleanup() { \
 		umount -f mnt  ; \
+		: reset error ; \
 	}"
 }
 
@@ -46,6 +47,7 @@
 	}"
 	eval "${name}_cleanup() { \
 		umount -f mnt  ; \
+		: reset error ; \
 	}"
 }
 



CVS commit: src/tests/sbin/resize_ffs

2010-12-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Dec 11 11:31:28 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: common.sh t_grow.sh t_shrink.sh

Log Message:
Can't use dynamic data in cleanup (it's run in a different process),
so get rid of $MNTPT and use the constant value the variable was
set to.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/resize_ffs/common.sh \
src/tests/sbin/resize_ffs/t_grow.sh src/tests/sbin/resize_ffs/t_shrink.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.2 src/tests/sbin/resize_ffs/common.sh:1.3
--- src/tests/sbin/resize_ffs/common.sh:1.2	Thu Dec  9 16:59:35 2010
+++ src/tests/sbin/resize_ffs/common.sh	Sat Dec 11 11:31:27 2010
@@ -8,7 +8,6 @@
 	IMG=fsimage
 	TDBASE64=$(atf_get_srcdir)/testdata.tar.gz.base64
 	GOODMD5=$(atf_get_srcdir)/testdata.md5
-	MNTPT=mnt
 	# set BYTESWAP to opposite-endian.
 	if [ $(sysctl -n hw.byteorder) = "1234" ]; then
 		BYTESWAP=be
@@ -29,7 +28,7 @@
 		${check_function} " "$...@}" "; \
 	}"
 	eval "${name}_cleanup() { \
-		umount -f ${MNTPT}  ; \
+		umount -f mnt  ; \
 	}"
 }
 
@@ -46,14 +45,14 @@
 		${check_function} " "$...@}" "; \
 	}"
 	eval "${name}_cleanup() { \
-		umount -f ${MNTPT}  ; \
+		umount -f mnt  ; \
 	}"
 }
 
 # copy_data requires the mount already done;  makes one copy of the test data
 copy_data ()
 {
-	uudecode -p ${TDBASE64} | (cd ${MNTPT}; tar xzf - -s/testdata/TD$1/)
+	uudecode -p ${TDBASE64} | (cd mnt; tar xzf - -s/testdata/TD$1/)
 }
 
 copy_multiple ()
@@ -68,7 +67,7 @@
 # is to ensure data exists near the end of the fs under test.
 remove_data ()
 {
-	rm -rf ${MNTPT}/TD$1
+	rm -rf mnt/TD$1
 }
 
 remove_multiple ()
@@ -83,7 +82,7 @@
 # generated md5 file doesn't need explicit cleanup thanks to ATF
 check_data ()
 {
-	(cd ${MNTPT}/TD$1 && md5 *) > TD$1.md5
+	(cd mnt/TD$1 && md5 *) > TD$1.md5
 	atf_check diff -u ${GOODMD5} TD$1.md5
 }
 
Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.2 src/tests/sbin/resize_ffs/t_grow.sh:1.3
--- src/tests/sbin/resize_ffs/t_grow.sh:1.2	Thu Dec  9 17:28:05 2010
+++ src/tests/sbin/resize_ffs/t_grow.sh	Sat Dec 11 11:31:27 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.2 2010/12/09 17:28:05 riz Exp $
+# $NetBSD: t_grow.sh,v 1.3 2010/12/11 11:31:27 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -38,7 +38,7 @@
 	local fslevel=$5
 	local numdata=$6
 	local swap=$7
-	mkdir -p ${MNTPT}
+	mkdir -p mnt
 	echo "bs is ${bs} numdata is ${numdata}"
 	echo "growing fs with blocksize ${bs}"
 
@@ -57,15 +57,15 @@
 	fi
 
 	# we're specifying relative paths, so rump_ffs warns - ignore.
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	copy_multiple ${numdata}
-	umount ${MNTPT}
+	umount mnt
 	atf_check -s exit:0 resize_ffs -y -s ${nsize} ${IMG}
 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	# checking everything because we don't delete on grow
 	check_data_range 1 ${numdata}
-	umount ${MNTPT}
+	umount mnt
 	rm -f ${IMG}	# probably unnecessary
 }
 
Index: src/tests/sbin/resize_ffs/t_shrink.sh
diff -u src/tests/sbin/resize_ffs/t_shrink.sh:1.2 src/tests/sbin/resize_ffs/t_shrink.sh:1.3
--- src/tests/sbin/resize_ffs/t_shrink.sh:1.2	Thu Dec  9 17:28:05 2010
+++ src/tests/sbin/resize_ffs/t_shrink.sh	Sat Dec 11 11:31:27 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_shrink.sh,v 1.2 2010/12/09 17:28:05 riz Exp $
+# $NetBSD: t_shrink.sh,v 1.3 2010/12/11 11:31:27 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -38,7 +38,7 @@
 	local fslevel=$5
 	local numdata=$6
 	local swap=$7
-	mkdir -p ${MNTPT}
+	mkdir -p mnt
 	echo "bs is ${bs} numdata is ${numdata}"
 	echo "shrinking fs with blocksize ${bs}"
 
@@ -57,7 +57,7 @@
 	fi
 
 	# we're specifying relative paths, so rump_ffs warns - ignore.
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	copy_multiple ${numdata}
 
 	# how much data to remove so fs can be shrunk
@@ -65,13 +65,13 @@
 	local dataleft=$((numdata-remove))
 	echo remove is $remove dataleft is $dataleft
 	remove_multiple ${remove}
-	umount ${MNTPT}
+	umount mnt
 	atf_check -s exit:0 resize_ffs -y -s ${nsize} ${IMG}
 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
-	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
+	atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
 	# checking everything because we don't delete on grow
 	check_data_range $((remove + 1)) ${numdata}
-	umount ${MNTPT}
+	umount mnt
 	rm -f ${IMG}	# probably unnecessary
 }
 



CVS commit: src/tests/sbin/resize_ffs

2010-12-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec  9 17:28:06 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_grow.sh t_shrink.sh

Log Message:
Wrap the bigger tests in RESIZE_FFS_BIG_TESTS, as the automated test
run seems to choke over a certain size.  (This will speed up the runs
as well)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/resize_ffs/t_grow.sh \
src/tests/sbin/resize_ffs/t_shrink.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_grow.sh
diff -u src/tests/sbin/resize_ffs/t_grow.sh:1.1 src/tests/sbin/resize_ffs/t_grow.sh:1.2
--- src/tests/sbin/resize_ffs/t_grow.sh:1.1	Thu Dec  9 05:19:02 2010
+++ src/tests/sbin/resize_ffs/t_grow.sh	Thu Dec  9 17:28:05 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_grow.sh,v 1.1 2010/12/09 05:19:02 riz Exp $
+# $NetBSD: t_grow.sh,v 1.2 2010/12/09 17:28:05 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -76,6 +76,9 @@
 # created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
 # If 'swap' is included, byteswap the fs
 test_case grow_16M_v1_4096 grow_ffs 4096 512 32768 131072 1 28
+test_case_xfail grow_16M_v1_4096_swapped "PR bin/44203" grow_ffs 4096 512 32768 131072 1 28 swap
+test_case_xfail grow_16M_v2_4096 "PR bin/44205" grow_ffs 4096 512 32768 131072 2 28
+test_case_xfail grow_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" grow_ffs 4096 512 32768 131072 2 28 swap
 test_case grow_16M_v1_8192 grow_ffs 8192 1024 32768 131072 1 28
 test_case grow_16M_v1_16384 grow_ffs 16384 2048 32768 131072 1 29
 test_case grow_16M_v1_32768 grow_ffs 32768 4096 32768 131072 1 28
@@ -103,7 +106,7 @@
 test_case grow_64M_v1_65536 grow_ffs 65536 8192 131072 262144 1 101
 test_case_xfail grow_64M_v1_65536_swapped "PR bin/44203" grow_ffs 65536 8192 131072 262144 1 101 swap
 test_case_xfail grow_64M_v2_65536 "PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101
-test_case_xfail grow_64M_v2_65536_swapped "PR bin/44203; PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101 swap
+test_case_xfail grow_64M_v2_65536_swapped "PR bin/44203, PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101 swap
 
 atf_test_case grow_ffsv1_partial_cg
 grow_ffsv1_partial_cg_head()
@@ -127,6 +130,9 @@
 {
 	setupvars
 	atf_add_test_case grow_16M_v1_4096
+	atf_add_test_case grow_16M_v1_4096_swapped
+	atf_add_test_case grow_16M_v2_4096
+	atf_add_test_case grow_16M_v2_4096_swapped
 	atf_add_test_case grow_16M_v1_8192
 	atf_add_test_case grow_16M_v1_16384
 	atf_add_test_case grow_16M_v1_32768
@@ -141,6 +147,7 @@
 	atf_add_test_case grow_32M_v1_16384
 	atf_add_test_case grow_32M_v1_32768
 	atf_add_test_case grow_32M_v1_65536
+if [ "X${RESIZE_FFS_BIG_TESTS}" != "X" ]; then
 	atf_add_test_case grow_48M_v1_4096
 	atf_add_test_case grow_48M_v1_8192
 	atf_add_test_case grow_48M_v1_16384
@@ -154,5 +161,6 @@
 	atf_add_test_case grow_64M_v1_65536_swapped
 	atf_add_test_case grow_64M_v2_65536
 	atf_add_test_case grow_64M_v2_65536_swapped
+fi
 	atf_add_test_case grow_ffsv1_partial_cg
 }
Index: src/tests/sbin/resize_ffs/t_shrink.sh
diff -u src/tests/sbin/resize_ffs/t_shrink.sh:1.1 src/tests/sbin/resize_ffs/t_shrink.sh:1.2
--- src/tests/sbin/resize_ffs/t_shrink.sh:1.1	Thu Dec  9 05:19:02 2010
+++ src/tests/sbin/resize_ffs/t_shrink.sh	Thu Dec  9 17:28:05 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_shrink.sh,v 1.1 2010/12/09 05:19:02 riz Exp $
+# $NetBSD: t_shrink.sh,v 1.2 2010/12/09 17:28:05 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -82,6 +82,9 @@
 # created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
 # If 'swap' is included, byteswap the fs
 test_case shrink_24M_16M_v1_4096 shrink_ffs 4096 512 49152 32768 1 41
+test_case_xfail shrink_24M_16M_v1_4096_swapped "PR bin/44203" shrink_ffs 4096 512 49152 32768 1 41 swap
+test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" shrink_ffs 4096 512 49152 32768 2 41 swap
+test_case_xfail shrink_24M_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" shrink_ffs 4096 512 49152 32768 2 41 swap
 test_case shrink_24M_16M_v1_8192 shrink_ffs 8192 1024 49152 32768 1 42
 test_case shrink_24M_16M_v1_16384 shrink_ffs 16384 2048 49152 32768 1 43
 test_case shrink_24M_16M_v1_32768 shrink_ffs 32768 4096 49152 32768 1 42
@@ -104,7 +107,7 @@
 test_case shrink_64M_48M_v1_65536 shrink_ffs 65536 8192 131072 98304 1 101
 test_case_xfail shrink_64M_48M_v1_65536_swapped "PR bin/44203" shrink_ffs 65536 8192 131072 98304 1 101 swap
 test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" shrink_ffs 65536 8192 131072 98304 2 101
-test_case_xfail shrink_64M_48M_v2_65536_swapped "PR bin/44203; PR bin/44205" shrink_ffs 65536 8192 131072 98304 2 101 swap
+test_case_xfail shrink_64M_48M_v2_65536_swapped "PR bin/44203, PR bin/44205" shrink_ffs 65536 8192 131072 98304 2 101 swap
 
 atf_test_case shrink_ffsv1_partial_cg
 shrink_ffsv1_partial_cg_head()
@@ -

CVS commit: src/tests/sbin/resize_ffs

2010-12-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec  9 16:59:35 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: common.sh

Log Message:
Remove accidentally-committed debug-assist code.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/resize_ffs/common.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/common.sh
diff -u src/tests/sbin/resize_ffs/common.sh:1.1 src/tests/sbin/resize_ffs/common.sh:1.2
--- src/tests/sbin/resize_ffs/common.sh:1.1	Thu Dec  9 05:19:02 2010
+++ src/tests/sbin/resize_ffs/common.sh	Thu Dec  9 16:59:35 2010
@@ -17,19 +17,6 @@
 	fi
 }
 
-# make sure to remove test_redo before committing
-test_redo ()
-{
-local fpi=$((${2} * 4))
-local i
-if [ $fpi -gt 16384 ]; then
-i="-i 16384"
-fi
-	sudo umount ${MNTPT}
-	newfs -O1 $i -b $1 -f $2 -s $3 -F ${IMG}
-	sudo rump_ffs ${IMG} ${MNTPT}
-}
-
 # test_case() taken from the tests/ipf/h_common.sh
 # Used to declare the atf goop for a test.
 test_case()
@@ -92,17 +79,6 @@
 	done
 }
 
-mount_test_fs_image ()
-{
-	rump_ffs ${IMG} ${MNTPT}
-}
-
-unmount_test_fs_image ()
-{
-	umount -f ${MNTPT}
-}
-
-
 # verify that the data in a particular directory is still OK
 # generated md5 file doesn't need explicit cleanup thanks to ATF
 check_data ()



CVS commit: src/tests/sbin/resize_ffs

2010-12-02 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Dec  3 05:23:46 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_resize_ffs.sh

Log Message:
Cause the tests to use plain files instead of vnd; for the kinds of
tests being done, vnd isn't needed and adds a potential resource
conflict issue on the system running the test.  As a bonus, the
tests run faster because less data is being shuffled around.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/resize_ffs/t_resize_ffs.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_resize_ffs.sh
diff -u src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.3 src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.4
--- src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.3	Fri Dec  3 04:10:36 2010
+++ src/tests/sbin/resize_ffs/t_resize_ffs.sh	Fri Dec  3 05:23:46 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_resize_ffs.sh,v 1.3 2010/12/03 04:10:36 riz Exp $
+# $NetBSD: t_resize_ffs.sh,v 1.4 2010/12/03 05:23:46 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,139 +33,75 @@
 
 # misc routines
 
-atf_test_case grow_ffsv1_partial_cg cleanup
+atf_test_case grow_ffsv1_partial_cg
 grow_ffsv1_partial_cg_head()
 {
 	atf_set "descr" "Checks successful ffsv1 growth by less" \
 			"than a cylinder group"
-	atf_set "require.user"	"root"
 }
 grow_ffsv1_partial_cg_body()
 {
-	cat >disktab 

CVS commit: src/tests/sbin/resize_ffs

2010-12-02 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Dec  3 04:10:36 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_resize_ffs.sh

Log Message:
Correct two function names:
   grow_ffsv1_64k() -> grow_ffsv1_64k_head()
   shrink_ffsv1_64k() -> shrink_ffsv1_64k_head()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/resize_ffs/t_resize_ffs.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_resize_ffs.sh
diff -u src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.2 src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.3
--- src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.2	Thu Dec  2 22:03:23 2010
+++ src/tests/sbin/resize_ffs/t_resize_ffs.sh	Fri Dec  3 04:10:36 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_resize_ffs.sh,v 1.2 2010/12/02 22:03:23 riz Exp $
+# $NetBSD: t_resize_ffs.sh,v 1.3 2010/12/03 04:10:36 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -68,7 +68,7 @@
 }
 
 atf_test_case grow_ffsv1_64k cleanup
-grow_ffsv1_64k()
+grow_ffsv1_64k_head()
 {
 	atf_set "descr" "Checks successful ffsv1 growth with 64k blocksize"
 	atf_set "require.user"	"root"
@@ -102,7 +102,7 @@
 }
 
 atf_test_case shrink_ffsv1_64k cleanup
-shrink_ffsv1_64k()
+shrink_ffsv1_64k_head()
 {
 	atf_set "descr" "Checks successful ffsv1 shrinkage with 64k blocksize"
 	atf_set "require.user"	"root"



CVS commit: src/tests/sbin/resize_ffs

2010-12-02 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec  2 22:03:23 UTC 2010

Modified Files:
src/tests/sbin/resize_ffs: t_resize_ffs.sh

Log Message:
Update existing test cases and add a couple more:

- PR bin/44177 is fixed
- test grow/shrink on a ffsv1 with 64k blocksize, which was broken until
  recently
- make sure the partial cylinder left over is big enough so it doesn't
  get thrown away now that resize_ffs properly uses the last cyl.

XXX TODO:  add tests which ensure data integrity.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/resize_ffs/t_resize_ffs.sh

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

Modified files:

Index: src/tests/sbin/resize_ffs/t_resize_ffs.sh
diff -u src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.1 src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.2
--- src/tests/sbin/resize_ffs/t_resize_ffs.sh:1.1	Tue Nov 30 23:17:27 2010
+++ src/tests/sbin/resize_ffs/t_resize_ffs.sh	Thu Dec  2 22:03:23 2010
@@ -1,4 +1,4 @@
-# $NetBSD: t_resize_ffs.sh,v 1.1 2010/11/30 23:17:27 riz Exp $
+# $NetBSD: t_resize_ffs.sh,v 1.2 2010/12/02 22:03:23 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,13 +33,14 @@
 
 # misc routines
 
-atf_test_case grow cleanup
-grow_head()
+atf_test_case grow_ffsv1_partial_cg cleanup
+grow_ffsv1_partial_cg_head()
 {
-	atf_set "descr" "Checks successful fs growth"
+	atf_set "descr" "Checks successful ffsv1 growth by less" \
+			"than a cylinder group"
 	atf_set "require.user"	"root"
 }
-grow_body()
+grow_ffsv1_partial_cg_body()
 {
 	cat >disktab