diff --git a/tests/sbin/resize_ffs/common.sh b/tests/sbin/resize_ffs/common.sh index e033ed24996a..d588251b0a1f 100644 --- a/tests/sbin/resize_ffs/common.sh +++ b/tests/sbin/resize_ffs/common.sh @@ -96,3 +96,56 @@ check_data_range () 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 --git a/tests/sbin/resize_ffs/t_grow.sh b/tests/sbin/resize_ffs/t_grow.sh index 5ce637168765..67c44c570f86 100644 --- a/tests/sbin/resize_ffs/t_grow.sh +++ b/tests/sbin/resize_ffs/t_grow.sh @@ -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 --git a/tests/sbin/resize_ffs/t_shrink.sh b/tests/sbin/resize_ffs/t_shrink.sh index 1d1ad7b0c5af..e4bddd67ca75 100644 --- a/tests/sbin/resize_ffs/t_shrink.sh +++ b/tests/sbin/resize_ffs/t_shrink.sh @@ -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 +test_case shrink_48M_16M_v1_65536 resize_ffs 65536 8192 98304 32768 1 76 +test_case shrink_64M_48M_v1_4096 resize_ffs 4096 512 131072 98304 1 109 +test_case shrink_64M_48M_v1_8192 resize_ffs 8192 1024 131072 98304 1 111 +test_case shrink_64M_48M_v1_16384 resize_ffs 16384 2048 131072 98304 1 115 +test_case shrink_64M_48M_v1_32768 resize_ffs 32768 4096 131072 98304 1 111 +test_case shrink_64M_48M_v1_65536 resize_ffs 65536 8192 131072 98304 1 101 +test_case_xfail shrink_64M_48M_v1_65536_swapped "PR bin/44203" resize_ffs 65536 8192 131072 98304 1 101 swap +test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101 +test_case_xfail shrink_64M_48M_v2_65536_swapped "PR bin/44203, PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101 swap atf_test_case shrink_ffsv1_partial_cg shrink_ffsv1_partial_cg_head()