t_grow.sh revision 272345
1272343Sngie# $NetBSD: t_grow.sh,v 1.8 2011/01/11 00:50:02 riz Exp $ 2272343Sngie# 3272343Sngie# Copyright (c) 2010 The NetBSD Foundation, Inc. 4272343Sngie# All rights reserved. 5272343Sngie# 6272343Sngie# This code is derived from software contributed to The NetBSD Foundation 7272343Sngie# by Jeffrey C. Rizzo. 8272343Sngie# 9272343Sngie# Redistribution and use in source and binary forms, with or without 10272343Sngie# modification, are permitted provided that the following conditions 11272343Sngie# are met: 12272343Sngie# 1. Redistributions of source code must retain the above copyright 13272343Sngie# notice, this list of conditions and the following disclaimer. 14272343Sngie# 2. Redistributions in binary form must reproduce the above copyright 15272343Sngie# notice, this list of conditions and the following disclaimer in the 16272343Sngie# documentation and/or other materials provided with the distribution. 17272343Sngie# 18272343Sngie# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19272343Sngie# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20272343Sngie# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21272343Sngie# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22272343Sngie# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23272343Sngie# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24272343Sngie# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25272343Sngie# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26272343Sngie# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27272343Sngie# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28272343Sngie# POSSIBILITY OF SUCH DAMAGE. 29272343Sngie# 30272343Sngie 31272343Sngie 32272343Sngie# resize_ffs params as follows: 33272343Sngie# resize_ffs blocksize fragsize fssize newfssize level numdata swap 34272343Sngie# where 'numdata' is the number of data directories to copy - this is 35272343Sngie# determined manually based on the maximum number that will fit in the 36272343Sngie# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs. 37272343Sngie# If 'swap' is included, byteswap the fs 38272343Sngie 39272343Sngie# v0 == newfs -O0 (4.3BSD layout, ffsv1 superblock) 40272343Sngietest_case grow_16M_v0_4096 resize_ffs 4096 512 32768 131072 0 28 41272343Sngietest_case grow_16M_v0_8192 resize_ffs 8192 1024 32768 131072 0 28 42272343Sngietest_case grow_16M_v0_16384 resize_ffs 16384 2048 32768 131072 0 29 43272343Sngietest_case grow_16M_v0_32768 resize_ffs 32768 4096 32768 131072 0 28 44272343Sngietest_case grow_16M_v0_65536 resize_ffs 65536 8192 32768 131072 0 26 45272343Sngie# these grow_24M grow a smaller amount; sometimes there's different issues 46272343Sngietest_case grow_24M_v0_4096 resize_ffs 4096 512 49152 65536 0 41 47272343Sngietest_case grow_24M_v0_8192 resize_ffs 8192 1024 49152 65536 0 42 48272343Sngietest_case grow_24M_v0_16384 resize_ffs 16384 2048 49152 65536 0 43 49272343Sngietest_case grow_24M_v0_32768 resize_ffs 32768 4096 49152 65536 0 42 50272343Sngietest_case grow_24M_v0_65536 resize_ffs 65536 8192 49152 65536 0 38 51272343Sngietest_case grow_32M_v0_4096 resize_ffs 4096 512 65536 131072 0 55 52272343Sngietest_case grow_32M_v0_8192 resize_ffs 8192 1024 65536 131072 0 56 53272343Sngietest_case grow_32M_v0_16384 resize_ffs 16384 2048 65536 131072 0 58 54272343Sngietest_case grow_32M_v0_32768 resize_ffs 32768 4096 65536 131072 0 56 55272343Sngietest_case grow_32M_v0_65536 resize_ffs 65536 8192 65536 131072 0 51 56272343Sngietest_case grow_48M_v0_4096 resize_ffs 4096 512 98304 131072 0 82 57272343Sngietest_case grow_48M_v0_8192 resize_ffs 8192 1024 98304 131072 0 84 58272343Sngietest_case grow_48M_v0_16384 resize_ffs 16384 2048 98304 131072 0 87 59272343Sngietest_case grow_48M_v0_32768 resize_ffs 32768 4096 98304 131072 0 83 60272343Sngietest_case grow_48M_v0_65536 resize_ffs 65536 8192 98304 131072 0 76 61272343Sngietest_case grow_64M_v0_4096 resize_ffs 4096 512 131072 262144 0 109 62272343Sngietest_case grow_64M_v0_8192 resize_ffs 8192 1024 131072 262144 0 111 63272343Sngietest_case grow_64M_v0_16384 resize_ffs 16384 2048 131072 262144 0 115 64272343Sngietest_case grow_64M_v0_32768 resize_ffs 32768 4096 131072 262144 0 111 65272343Sngietest_case grow_64M_v0_65536 resize_ffs 65536 8192 131072 262144 0 101 66272343Sngie 67272343Sngie# v1 == newfs -O1 (FFSv1, v2 superblock layout) 68272343Sngietest_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28 69272343Sngietest_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28 70272343Sngietest_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29 71272343Sngietest_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28 72272343Sngietest_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26 73272343Sngie# these grow_24M grow a smaller amount; sometimes there's different issues 74272343Sngietest_case grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41 75272343Sngietest_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42 76272343Sngietest_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43 77272343Sngietest_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42 78272343Sngietest_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38 79272343Sngietest_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55 80272343Sngietest_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56 81272343Sngietest_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58 82272343Sngietest_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56 83272343Sngietest_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51 84272343Sngietest_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82 85272343Sngietest_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84 86272343Sngietest_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87 87272343Sngietest_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83 88272343Sngietest_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76 89272343Sngietest_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109 90272343Sngietest_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111 91272343Sngietest_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115 92272343Sngietest_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111 93272343Sngietest_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101 94272343Sngietest_case grow_16M_v2_4096 resize_ffs 4096 512 32768 131072 2 26 95272343Sngietest_case grow_16M_v2_8192 resize_ffs 8192 1024 32768 131072 2 28 96272343Sngietest_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29 97272343Sngietest_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28 98272343Sngietest_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25 99272343Sngietest_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40 100272343Sngietest_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42 101272343Sngietest_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43 102272343Sngietest_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42 103272343Sngietest_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38 104272343Sngietest_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53 105272343Sngietest_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56 106272343Sngietest_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58 107272343Sngietest_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56 108272343Sngietest_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51 109272343Sngietest_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80 110272343Sngietest_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84 111272343Sngietest_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87 112272343Sngietest_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83 113272343Sngietest_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76 114272343Sngietest_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107 115272343Sngietest_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111 116272343Sngietest_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115 117272343Sngietest_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111 118272343Sngietest_case grow_64M_v2_65536 resize_ffs 65536 8192 131072 262144 2 101 119272343Sngie 120atf_test_case grow_ffsv1_partial_cg 121grow_ffsv1_partial_cg_head() 122{ 123 atf_set "descr" "Checks successful ffsv1 growth by less" \ 124 "than a cylinder group" 125} 126grow_ffsv1_partial_cg_body() 127{ 128 echo "***resize_ffs grow test" 129 130 # resize_ffs only supports ffsv1 at the moment 131 atf_check -o ignore -e ignore newfs -V1 -s 4000 -F ${IMG} 132 133 # size to grow to is chosen to cause partial cg 134 atf_check -s exit:0 -o ignore resize_ffs -y -s 5760 ${IMG} 135 atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG} 136} 137 138atf_init_test_cases() 139{ 140 setupvars 141 atf_add_test_case grow_16M_v0_8192 142 atf_add_test_case grow_16M_v1_16384 143 atf_add_test_case grow_16M_v2_32768 144if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then 145 atf_add_test_case grow_16M_v0_4096 146 atf_add_test_case grow_16M_v0_16384 147 atf_add_test_case grow_16M_v0_32768 148 atf_add_test_case grow_16M_v0_65536 149 atf_add_test_case grow_16M_v1_4096 150 atf_add_test_case grow_16M_v1_8192 151 atf_add_test_case grow_16M_v1_32768 152 atf_add_test_case grow_16M_v1_65536 153 atf_add_test_case grow_16M_v2_4096 154 atf_add_test_case grow_16M_v2_8192 155 atf_add_test_case grow_16M_v2_16384 156 atf_add_test_case grow_16M_v2_65536 157 atf_add_test_case grow_24M_v0_4096 158 atf_add_test_case grow_24M_v0_8192 159 atf_add_test_case grow_24M_v0_16384 160 atf_add_test_case grow_24M_v0_32768 161 atf_add_test_case grow_24M_v0_65536 162 atf_add_test_case grow_32M_v0_4096 163 atf_add_test_case grow_32M_v0_8192 164 atf_add_test_case grow_32M_v0_16384 165 atf_add_test_case grow_32M_v0_32768 166 atf_add_test_case grow_32M_v0_65536 167 atf_add_test_case grow_48M_v0_4096 168 atf_add_test_case grow_48M_v0_8192 169 atf_add_test_case grow_48M_v0_16384 170 atf_add_test_case grow_48M_v0_32768 171 atf_add_test_case grow_48M_v0_65536 172 atf_add_test_case grow_64M_v0_4096 173 atf_add_test_case grow_64M_v0_8192 174 atf_add_test_case grow_64M_v0_16384 175 atf_add_test_case grow_64M_v0_32768 176 atf_add_test_case grow_64M_v0_65536 177 178 atf_add_test_case grow_24M_v1_4096 179 atf_add_test_case grow_24M_v1_8192 180 atf_add_test_case grow_24M_v1_16384 181 atf_add_test_case grow_24M_v1_32768 182 atf_add_test_case grow_24M_v1_65536 183 atf_add_test_case grow_32M_v1_4096 184 atf_add_test_case grow_32M_v1_8192 185 atf_add_test_case grow_32M_v1_16384 186 atf_add_test_case grow_32M_v1_32768 187 atf_add_test_case grow_32M_v1_65536 188 atf_add_test_case grow_48M_v1_4096 189 atf_add_test_case grow_48M_v1_8192 190 atf_add_test_case grow_48M_v1_16384 191 atf_add_test_case grow_48M_v1_32768 192 atf_add_test_case grow_48M_v1_65536 193 atf_add_test_case grow_64M_v1_4096 194 atf_add_test_case grow_64M_v1_8192 195 atf_add_test_case grow_64M_v1_16384 196 atf_add_test_case grow_64M_v1_32768 197 atf_add_test_case grow_64M_v1_65536 198 199 atf_add_test_case grow_24M_v2_4096 200 atf_add_test_case grow_24M_v2_8192 201 atf_add_test_case grow_24M_v2_16384 202 atf_add_test_case grow_24M_v2_32768 203 atf_add_test_case grow_24M_v2_65536 204 atf_add_test_case grow_32M_v2_4096 205 atf_add_test_case grow_32M_v2_8192 206 atf_add_test_case grow_32M_v2_16384 207 atf_add_test_case grow_32M_v2_32768 208 atf_add_test_case grow_32M_v2_65536 209 atf_add_test_case grow_48M_v2_4096 210 atf_add_test_case grow_48M_v2_8192 211 atf_add_test_case grow_48M_v2_16384 212 atf_add_test_case grow_48M_v2_32768 213 atf_add_test_case grow_48M_v2_65536 214 atf_add_test_case grow_64M_v2_4096 215 atf_add_test_case grow_64M_v2_8192 216 atf_add_test_case grow_64M_v2_16384 217 atf_add_test_case grow_64M_v2_32768 218 atf_add_test_case grow_64M_v2_65536 219fi 220 atf_add_test_case grow_ffsv1_partial_cg 221} 222