Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/sbin/resize_ffs Factor out more common code. No funct...
details: https://anonhg.NetBSD.org/src/rev/1dbe8a622fcf
branches: trunk
changeset: 759784:1dbe8a622fcf
user: riz <riz%NetBSD.org@localhost>
date: Thu Dec 16 17:16:07 2010 +0000
description:
Factor out more common code. No functional changes intended.
diffstat:
tests/sbin/resize_ffs/common.sh | 53 ++++++++++++++++++
tests/sbin/resize_ffs/t_grow.sh | 108 +++++++++++--------------------------
tests/sbin/resize_ffs/t_shrink.sh | 104 ++++++++++--------------------------
3 files changed, 116 insertions(+), 149 deletions(-)
diffs (truncated from 312 to 300 lines):
diff -r 6d5636e28618 -r 1dbe8a622fcf tests/sbin/resize_ffs/common.sh
--- a/tests/sbin/resize_ffs/common.sh Thu Dec 16 17:07:44 2010 +0000
+++ b/tests/sbin/resize_ffs/common.sh Thu Dec 16 17:16:07 2010 +0000
@@ -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
+}
diff -r 6d5636e28618 -r 1dbe8a622fcf tests/sbin/resize_ffs/t_grow.sh
--- a/tests/sbin/resize_ffs/t_grow.sh Thu Dec 16 17:07:44 2010 +0000
+++ b/tests/sbin/resize_ffs/t_grow.sh Thu Dec 16 17:16:07 2010 +0000
@@ -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 8192 32768 131072 1 26
+test_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28
+test_case_xfail grow_16M_v1_4096_swapped "PR bin/44203" resize_ffs 4096 512 32768 131072 1 28 swap
+test_case_xfail grow_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 32768 131072 2 28
+test_case_xfail grow_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" resize_ffs 4096 512 32768 131072 2 28 swap
+test_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28
+test_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29
+test_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28
+test_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26
# these grow_24M grow a smaller amount; sometimes there's different issues
-test_case grow_24M_v1_4096 grow_ffs 4096 512 49152 65536 1 41
-test_case grow_24M_v1_8192 grow_ffs 8192 1024 49152 65536 1 42
-test_case grow_24M_v1_16384 grow_ffs 16384 2048 49152 65536 1 43
-test_case grow_24M_v1_32768 grow_ffs 32768 4096 49152 65536 1 42
-test_case grow_24M_v1_65536 grow_ffs 65536 8192 49152 65536 1 38
-test_case grow_32M_v1_4096 grow_ffs 4096 512 65536 131072 1 55
-test_case grow_32M_v1_8192 grow_ffs 8192 1024 65536 131072 1 56
-test_case grow_32M_v1_16384 grow_ffs 16384 2048 65536 131072 1 58
-test_case grow_32M_v1_32768 grow_ffs 32768 4096 65536 131072 1 56
-test_case grow_32M_v1_65536 grow_ffs 65536 8192 65536 131072 1 51
-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 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 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
-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 grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41
+test_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42
+test_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43
+test_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42
+test_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38
+test_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55
+test_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56
+test_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58
+test_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56
+test_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51
+test_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82
+test_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84
+test_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87
+test_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83
+test_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76
+test_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109
+test_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111
+test_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115
+test_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111
+test_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101
+test_case_xfail grow_64M_v1_65536_swapped "PR bin/44203" resize_ffs 65536 8192 131072 262144 1 101 swap
+test_case_xfail grow_64M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 262144 2 101
+test_case_xfail grow_64M_v2_65536_swapped "PR bin/44203, PR bin/44205" resize_ffs 65536 8192 131072 262144 2 101 swap
atf_test_case grow_ffsv1_partial_cg
grow_ffsv1_partial_cg_head()
diff -r 6d5636e28618 -r 1dbe8a622fcf tests/sbin/resize_ffs/t_shrink.sh
--- a/tests/sbin/resize_ffs/t_shrink.sh Thu Dec 16 17:07:44 2010 +0000
+++ b/tests/sbin/resize_ffs/t_shrink.sh Thu Dec 16 17:16:07 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_shrink.sh,v 1.4 2010/12/12 22:50:42 riz Exp $
+# $NetBSD: t_shrink.sh,v 1.5 2010/12/16 17:16:07 riz Exp $
#
# Copyright (c) 2010 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -28,86 +28,40 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-shrink_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}
-
- # 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}
- 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 $((remove + 1)) ${numdata}
- umount mnt
- rm -f ${IMG} # probably unnecessary
-}
-
-# shrink_ffs params as follows:
-# shrink_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 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
-test_case shrink_24M_16M_v1_65536 shrink_ffs 65536 8192 49152 32768 1 38
-test_case shrink_32M_24M_v1_4096 shrink_ffs 4096 512 65536 49152 1 55
-test_case shrink_32M_24M_v1_8192 shrink_ffs 8192 1024 65536 49152 1 56
-test_case shrink_32M_24M_v1_16384 shrink_ffs 16384 2048 65536 49152 1 58
-test_case shrink_32M_24M_v1_32768 shrink_ffs 32768 4096 65536 49152 1 56
-test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" shrink_ffs 65536 8192 65536 49152 1 51
+test_case shrink_24M_16M_v1_4096 resize_ffs 4096 512 49152 32768 1 41
+test_case_xfail shrink_24M_16M_v1_4096_swapped "PR bin/44203" resize_ffs 4096 512 49152 32768 1 41 swap
+test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 49152 32768 2 41 swap
+test_case_xfail shrink_24M_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" resize_ffs 4096 512 49152 32768 2 41 swap
+test_case shrink_24M_16M_v1_8192 resize_ffs 8192 1024 49152 32768 1 42
+test_case shrink_24M_16M_v1_16384 resize_ffs 16384 2048 49152 32768 1 43
+test_case shrink_24M_16M_v1_32768 resize_ffs 32768 4096 49152 32768 1 42
+test_case shrink_24M_16M_v1_65536 resize_ffs 65536 8192 49152 32768 1 38
+test_case shrink_32M_24M_v1_4096 resize_ffs 4096 512 65536 49152 1 55
+test_case shrink_32M_24M_v1_8192 resize_ffs 8192 1024 65536 49152 1 56
+test_case shrink_32M_24M_v1_16384 resize_ffs 16384 2048 65536 49152 1 58
+test_case shrink_32M_24M_v1_32768 resize_ffs 32768 4096 65536 49152 1 56
+test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 1 51
# 48M -> 16M is a bigger shrink, relatively
-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 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 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
-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 shrink_48M_16M_v1_4096 resize_ffs 4096 512 98304 32768 1 82
+test_case shrink_48M_16M_v1_8192 resize_ffs 8192 1024 98304 32768 1 84
+test_case shrink_48M_16M_v1_16384 resize_ffs 16384 2048 98304 32768 1 87
+test_case shrink_48M_16M_v1_32768 resize_ffs 32768 4096 98304 32768 1 83
- Prev by Date:
[src/trunk]: src/sys/dev/pci Enable ETHERCAP_VLAN_MTU in vr(4). Tested on VT...
- Next by Date:
[src/trunk]: src Document __dead, __pure, __constfunc, __noinline, __unused, ...
- Previous by Thread:
[src/trunk]: src/sys/dev/pci Enable ETHERCAP_VLAN_MTU in vr(4). Tested on VT...
- Next by Thread:
[src/trunk]: src Document __dead, __pure, __constfunc, __noinline, __unused, ...
- Indexes:
Home |
Main Index |
Thread Index |
Old Index