Home | History | Annotate | Line # | Download | only in resize_ffs
t_grow.sh revision 1.2
      1  1.2  riz # $NetBSD: t_grow.sh,v 1.2 2010/12/09 17:28:05 riz Exp $
      2  1.1  riz #
      3  1.1  riz # Copyright (c) 2010 The NetBSD Foundation, Inc.
      4  1.1  riz # All rights reserved.
      5  1.1  riz #
      6  1.1  riz # This code is derived from software contributed to The NetBSD Foundation
      7  1.1  riz # by Jeffrey C. Rizzo.
      8  1.1  riz #
      9  1.1  riz # Redistribution and use in source and binary forms, with or without
     10  1.1  riz # modification, are permitted provided that the following conditions
     11  1.1  riz # are met:
     12  1.1  riz # 1. Redistributions of source code must retain the above copyright
     13  1.1  riz #    notice, this list of conditions and the following disclaimer.
     14  1.1  riz # 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  riz #    notice, this list of conditions and the following disclaimer in the
     16  1.1  riz #    documentation and/or other materials provided with the distribution.
     17  1.1  riz #
     18  1.1  riz # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  1.1  riz # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  1.1  riz # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  1.1  riz # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  1.1  riz # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  1.1  riz # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  1.1  riz # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  1.1  riz # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  1.1  riz # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  1.1  riz # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  1.1  riz # POSSIBILITY OF SUCH DAMAGE.
     29  1.1  riz #
     30  1.1  riz 
     31  1.1  riz grow_ffs()
     32  1.1  riz {
     33  1.1  riz 	echo "in grow_ffs:" ${@}
     34  1.1  riz 	local bs=$1
     35  1.1  riz 	local fragsz=$2
     36  1.1  riz 	local osize=$3
     37  1.1  riz 	local nsize=$4
     38  1.1  riz 	local fslevel=$5
     39  1.1  riz 	local numdata=$6
     40  1.1  riz 	local swap=$7
     41  1.1  riz 	mkdir -p ${MNTPT}
     42  1.1  riz 	echo "bs is ${bs} numdata is ${numdata}"
     43  1.1  riz 	echo "****growing fs with blocksize ${bs}"
     44  1.1  riz 
     45  1.1  riz 	# we want no more than 16K/inode to allow test files to copy.
     46  1.1  riz 	local fpi=$((fragsz * 4))
     47  1.1  riz 	local i
     48  1.1  riz 	if [ $fpi -gt 16384 ]; then
     49  1.1  riz 		i="-i 16384"
     50  1.1  riz 	fi
     51  1.1  riz 	if [ x$swap != x ]; then
     52  1.1  riz 		newfs -B ${BYTESWAP} -O${fslevel} -b ${bs} -f ${fragsz} \
     53  1.1  riz 			-s ${osize} ${i} -F ${IMG}
     54  1.1  riz 	else
     55  1.1  riz 		newfs -O${fslevel} -b ${bs} -f ${fragsz} -s ${osize} ${i} \
     56  1.1  riz 			-F ${IMG}
     57  1.1  riz 	fi
     58  1.1  riz 
     59  1.1  riz 	# we're specifying relative paths, so rump_ffs warns - ignore.
     60  1.1  riz 	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
     61  1.1  riz 	copy_multiple ${numdata}
     62  1.1  riz 	umount ${MNTPT}
     63  1.1  riz 	atf_check -s exit:0 resize_ffs -y -s ${nsize} ${IMG}
     64  1.1  riz 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
     65  1.1  riz 	atf_check -s exit:0 -e ignore rump_ffs ${IMG} ${MNTPT}
     66  1.1  riz 	# checking everything because we don't delete on grow
     67  1.1  riz 	check_data_range 1 ${numdata}
     68  1.1  riz 	umount ${MNTPT}
     69  1.1  riz 	rm -f ${IMG}	# probably unnecessary
     70  1.1  riz }
     71  1.1  riz 
     72  1.1  riz # grow_ffs params as follows:
     73  1.1  riz # grow_ffs blocksize fragsize fssize newfssize level numdata swap
     74  1.1  riz # where 'numdata' is the number of data directories to copy - this is
     75  1.1  riz # determined manually based on the maximum number that will fit in the
     76  1.1  riz # created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
     77  1.1  riz # If 'swap' is included, byteswap the fs
     78  1.1  riz test_case grow_16M_v1_4096 grow_ffs 4096 512 32768 131072 1 28
     79  1.2  riz test_case_xfail grow_16M_v1_4096_swapped "PR bin/44203" grow_ffs 4096 512 32768 131072 1 28 swap
     80  1.2  riz test_case_xfail grow_16M_v2_4096 "PR bin/44205" grow_ffs 4096 512 32768 131072 2 28
     81  1.2  riz test_case_xfail grow_16M_v2_4096_swapped "PR bin/44203, PR bin/44205" grow_ffs 4096 512 32768 131072 2 28 swap
     82  1.1  riz test_case grow_16M_v1_8192 grow_ffs 8192 1024 32768 131072 1 28
     83  1.1  riz test_case grow_16M_v1_16384 grow_ffs 16384 2048 32768 131072 1 29
     84  1.1  riz test_case grow_16M_v1_32768 grow_ffs 32768 4096 32768 131072 1 28
     85  1.1  riz test_case grow_16M_v1_65536 grow_ffs 65536 8192 32768 131072 1 26
     86  1.1  riz # these grow_24M grow a smaller amount; sometimes there's different issues
     87  1.1  riz test_case grow_24M_v1_4096 grow_ffs 4096 512 49152 65536 1 41
     88  1.1  riz test_case grow_24M_v1_8192 grow_ffs 8192 1024 49152 65536 1 42
     89  1.1  riz test_case grow_24M_v1_16384 grow_ffs 16384 2048 49152 65536 1 43
     90  1.1  riz test_case grow_24M_v1_32768 grow_ffs 32768 4096 49152 65536 1 42
     91  1.1  riz test_case grow_24M_v1_65536 grow_ffs 65536 8192 49152 65536 1 38
     92  1.1  riz test_case grow_32M_v1_4096 grow_ffs 4096 512 65536 131072 1 55
     93  1.1  riz test_case grow_32M_v1_8192 grow_ffs 8192 1024 65536 131072 1 56
     94  1.1  riz test_case grow_32M_v1_16384 grow_ffs 16384 2048 65536 131072 1 58
     95  1.1  riz test_case grow_32M_v1_32768 grow_ffs 32768 4096 65536 131072 1 56
     96  1.1  riz test_case grow_32M_v1_65536 grow_ffs 65536 8192 65536 131072 1 51
     97  1.1  riz test_case grow_48M_v1_4096 grow_ffs 4096 512 98304 131072 1 82
     98  1.1  riz test_case grow_48M_v1_8192 grow_ffs 8192 1024 98304 131072 1 84
     99  1.1  riz test_case grow_48M_v1_16384 grow_ffs 16384 2048 98304 131072 1 87
    100  1.1  riz test_case_xfail grow_48M_v1_32768 "PR bin/44209" grow_ffs 32768 4096 98304 131072 1 83
    101  1.1  riz test_case grow_48M_v1_65536 grow_ffs 65536 8192 98304 131072 1 76
    102  1.1  riz test_case grow_64M_v1_4096 grow_ffs 4096 512 131072 262144 1 109
    103  1.1  riz test_case grow_64M_v1_8192 grow_ffs 8192 1024 131072 262144 1 111
    104  1.1  riz test_case grow_64M_v1_16384 grow_ffs 16384 2048 131072 262144 1 115
    105  1.1  riz test_case_xfail grow_64M_v1_32768 "PR bin/44209" grow_ffs 32768 4096 131072 262144 1 111
    106  1.1  riz test_case grow_64M_v1_65536 grow_ffs 65536 8192 131072 262144 1 101
    107  1.1  riz test_case_xfail grow_64M_v1_65536_swapped "PR bin/44203" grow_ffs 65536 8192 131072 262144 1 101 swap
    108  1.1  riz test_case_xfail grow_64M_v2_65536 "PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101
    109  1.2  riz test_case_xfail grow_64M_v2_65536_swapped "PR bin/44203, PR bin/44205" grow_ffs 65536 8192 131072 262144 2 101 swap
    110  1.1  riz 
    111  1.1  riz atf_test_case grow_ffsv1_partial_cg
    112  1.1  riz grow_ffsv1_partial_cg_head()
    113  1.1  riz {
    114  1.1  riz 	atf_set "descr" "Checks successful ffsv1 growth by less" \
    115  1.1  riz 			"than a cylinder group"
    116  1.1  riz }
    117  1.1  riz grow_ffsv1_partial_cg_body()
    118  1.1  riz {
    119  1.1  riz 	echo "***resize_ffs grow test"
    120  1.1  riz 
    121  1.1  riz 	# resize_ffs only supports ffsv1 at the moment
    122  1.1  riz 	atf_check -o ignore -e ignore newfs -V1 -s 4000 -F ${IMG}
    123  1.1  riz 
    124  1.1  riz 	# size to grow to is chosen to cause partial cg
    125  1.1  riz 	atf_check -s exit:0 resize_ffs -y -s 5760 ${IMG}
    126  1.1  riz 	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
    127  1.1  riz }
    128  1.1  riz 
    129  1.1  riz atf_init_test_cases()
    130  1.1  riz {
    131  1.1  riz 	setupvars
    132  1.1  riz 	atf_add_test_case grow_16M_v1_4096
    133  1.2  riz 	atf_add_test_case grow_16M_v1_4096_swapped
    134  1.2  riz 	atf_add_test_case grow_16M_v2_4096
    135  1.2  riz 	atf_add_test_case grow_16M_v2_4096_swapped
    136  1.1  riz 	atf_add_test_case grow_16M_v1_8192
    137  1.1  riz 	atf_add_test_case grow_16M_v1_16384
    138  1.1  riz 	atf_add_test_case grow_16M_v1_32768
    139  1.1  riz 	atf_add_test_case grow_16M_v1_65536
    140  1.1  riz 	atf_add_test_case grow_24M_v1_4096
    141  1.1  riz 	atf_add_test_case grow_24M_v1_8192
    142  1.1  riz 	atf_add_test_case grow_24M_v1_16384
    143  1.1  riz 	atf_add_test_case grow_24M_v1_32768
    144  1.1  riz 	atf_add_test_case grow_24M_v1_65536
    145  1.1  riz 	atf_add_test_case grow_32M_v1_4096
    146  1.1  riz 	atf_add_test_case grow_32M_v1_8192
    147  1.1  riz 	atf_add_test_case grow_32M_v1_16384
    148  1.1  riz 	atf_add_test_case grow_32M_v1_32768
    149  1.1  riz 	atf_add_test_case grow_32M_v1_65536
    150  1.2  riz if [ "X${RESIZE_FFS_BIG_TESTS}" != "X" ]; then
    151  1.1  riz 	atf_add_test_case grow_48M_v1_4096
    152  1.1  riz 	atf_add_test_case grow_48M_v1_8192
    153  1.1  riz 	atf_add_test_case grow_48M_v1_16384
    154  1.1  riz 	atf_add_test_case grow_48M_v1_32768
    155  1.1  riz 	atf_add_test_case grow_48M_v1_65536
    156  1.1  riz 	atf_add_test_case grow_64M_v1_4096
    157  1.1  riz 	atf_add_test_case grow_64M_v1_8192
    158  1.1  riz 	atf_add_test_case grow_64M_v1_16384
    159  1.1  riz 	atf_add_test_case grow_64M_v1_32768
    160  1.1  riz 	atf_add_test_case grow_64M_v1_65536
    161  1.1  riz 	atf_add_test_case grow_64M_v1_65536_swapped
    162  1.1  riz 	atf_add_test_case grow_64M_v2_65536
    163  1.1  riz 	atf_add_test_case grow_64M_v2_65536_swapped
    164  1.2  riz fi
    165  1.1  riz 	atf_add_test_case grow_ffsv1_partial_cg
    166  1.1  riz }
    167