1*0a6a1f1dSLionel Sambuc# $NetBSD: t_grow.sh,v 1.9 2015/03/29 19:37:02 chopps Exp $ 211be35a1SLionel Sambuc# 311be35a1SLionel Sambuc# Copyright (c) 2010 The NetBSD Foundation, Inc. 411be35a1SLionel Sambuc# All rights reserved. 511be35a1SLionel Sambuc# 611be35a1SLionel Sambuc# This code is derived from software contributed to The NetBSD Foundation 711be35a1SLionel Sambuc# by Jeffrey C. Rizzo. 811be35a1SLionel Sambuc# 911be35a1SLionel Sambuc# Redistribution and use in source and binary forms, with or without 1011be35a1SLionel Sambuc# modification, are permitted provided that the following conditions 1111be35a1SLionel Sambuc# are met: 1211be35a1SLionel Sambuc# 1. Redistributions of source code must retain the above copyright 1311be35a1SLionel Sambuc# notice, this list of conditions and the following disclaimer. 1411be35a1SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright 1511be35a1SLionel Sambuc# notice, this list of conditions and the following disclaimer in the 1611be35a1SLionel Sambuc# documentation and/or other materials provided with the distribution. 1711be35a1SLionel Sambuc# 1811be35a1SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1911be35a1SLionel Sambuc# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2011be35a1SLionel Sambuc# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2111be35a1SLionel Sambuc# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2211be35a1SLionel Sambuc# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2311be35a1SLionel Sambuc# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2411be35a1SLionel Sambuc# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2511be35a1SLionel Sambuc# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2611be35a1SLionel Sambuc# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2711be35a1SLionel Sambuc# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2811be35a1SLionel Sambuc# POSSIBILITY OF SUCH DAMAGE. 2911be35a1SLionel Sambuc# 3011be35a1SLionel Sambuc 3111be35a1SLionel Sambuc 3211be35a1SLionel Sambuc# resize_ffs params as follows: 3311be35a1SLionel Sambuc# resize_ffs blocksize fragsize fssize newfssize level numdata swap 3411be35a1SLionel Sambuc# where 'numdata' is the number of data directories to copy - this is 3511be35a1SLionel Sambuc# determined manually based on the maximum number that will fit in the 3611be35a1SLionel Sambuc# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs. 3711be35a1SLionel Sambuc# If 'swap' is included, byteswap the fs 3811be35a1SLionel Sambuc 3911be35a1SLionel Sambuc# v0 == newfs -O0 (4.3BSD layout, ffsv1 superblock) 4011be35a1SLionel Sambuctest_case grow_16M_v0_4096 resize_ffs 4096 512 32768 131072 0 28 4111be35a1SLionel Sambuctest_case grow_16M_v0_8192 resize_ffs 8192 1024 32768 131072 0 28 4211be35a1SLionel Sambuctest_case grow_16M_v0_16384 resize_ffs 16384 2048 32768 131072 0 29 4311be35a1SLionel Sambuctest_case grow_16M_v0_32768 resize_ffs 32768 4096 32768 131072 0 28 4411be35a1SLionel Sambuctest_case grow_16M_v0_65536 resize_ffs 65536 8192 32768 131072 0 26 4511be35a1SLionel Sambuc# these grow_24M grow a smaller amount; sometimes there's different issues 4611be35a1SLionel Sambuctest_case grow_24M_v0_4096 resize_ffs 4096 512 49152 65536 0 41 4711be35a1SLionel Sambuctest_case grow_24M_v0_8192 resize_ffs 8192 1024 49152 65536 0 42 4811be35a1SLionel Sambuctest_case grow_24M_v0_16384 resize_ffs 16384 2048 49152 65536 0 43 4911be35a1SLionel Sambuctest_case grow_24M_v0_32768 resize_ffs 32768 4096 49152 65536 0 42 5011be35a1SLionel Sambuctest_case grow_24M_v0_65536 resize_ffs 65536 8192 49152 65536 0 38 5111be35a1SLionel Sambuctest_case grow_32M_v0_4096 resize_ffs 4096 512 65536 131072 0 55 5211be35a1SLionel Sambuctest_case grow_32M_v0_8192 resize_ffs 8192 1024 65536 131072 0 56 5311be35a1SLionel Sambuctest_case grow_32M_v0_16384 resize_ffs 16384 2048 65536 131072 0 58 5411be35a1SLionel Sambuctest_case grow_32M_v0_32768 resize_ffs 32768 4096 65536 131072 0 56 5511be35a1SLionel Sambuctest_case grow_32M_v0_65536 resize_ffs 65536 8192 65536 131072 0 51 5611be35a1SLionel Sambuctest_case grow_48M_v0_4096 resize_ffs 4096 512 98304 131072 0 82 5711be35a1SLionel Sambuctest_case grow_48M_v0_8192 resize_ffs 8192 1024 98304 131072 0 84 5811be35a1SLionel Sambuctest_case grow_48M_v0_16384 resize_ffs 16384 2048 98304 131072 0 87 5911be35a1SLionel Sambuctest_case grow_48M_v0_32768 resize_ffs 32768 4096 98304 131072 0 83 6011be35a1SLionel Sambuctest_case grow_48M_v0_65536 resize_ffs 65536 8192 98304 131072 0 76 6111be35a1SLionel Sambuctest_case grow_64M_v0_4096 resize_ffs 4096 512 131072 262144 0 109 6211be35a1SLionel Sambuctest_case grow_64M_v0_8192 resize_ffs 8192 1024 131072 262144 0 111 6311be35a1SLionel Sambuctest_case grow_64M_v0_16384 resize_ffs 16384 2048 131072 262144 0 115 6411be35a1SLionel Sambuctest_case grow_64M_v0_32768 resize_ffs 32768 4096 131072 262144 0 111 6511be35a1SLionel Sambuctest_case grow_64M_v0_65536 resize_ffs 65536 8192 131072 262144 0 101 6611be35a1SLionel Sambuc 6711be35a1SLionel Sambuc# v1 == newfs -O1 (FFSv1, v2 superblock layout) 6811be35a1SLionel Sambuctest_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28 6911be35a1SLionel Sambuctest_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28 7011be35a1SLionel Sambuctest_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29 7111be35a1SLionel Sambuctest_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28 7211be35a1SLionel Sambuctest_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26 7311be35a1SLionel Sambuc# these grow_24M grow a smaller amount; sometimes there's different issues 7411be35a1SLionel Sambuctest_case grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41 7511be35a1SLionel Sambuctest_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42 7611be35a1SLionel Sambuctest_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43 7711be35a1SLionel Sambuctest_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42 7811be35a1SLionel Sambuctest_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38 7911be35a1SLionel Sambuctest_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55 8011be35a1SLionel Sambuctest_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56 8111be35a1SLionel Sambuctest_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58 8211be35a1SLionel Sambuctest_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56 8311be35a1SLionel Sambuctest_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51 8411be35a1SLionel Sambuctest_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82 8511be35a1SLionel Sambuctest_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84 8611be35a1SLionel Sambuctest_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87 8711be35a1SLionel Sambuctest_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83 8811be35a1SLionel Sambuctest_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76 8911be35a1SLionel Sambuctest_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109 9011be35a1SLionel Sambuctest_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111 9111be35a1SLionel Sambuctest_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115 9211be35a1SLionel Sambuctest_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111 9311be35a1SLionel Sambuctest_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101 9411be35a1SLionel Sambuctest_case grow_16M_v2_4096 resize_ffs 4096 512 32768 131072 2 26 9511be35a1SLionel Sambuctest_case grow_16M_v2_8192 resize_ffs 8192 1024 32768 131072 2 28 9611be35a1SLionel Sambuctest_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29 9711be35a1SLionel Sambuctest_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28 9811be35a1SLionel Sambuctest_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25 9911be35a1SLionel Sambuctest_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40 10011be35a1SLionel Sambuctest_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42 10111be35a1SLionel Sambuctest_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43 10211be35a1SLionel Sambuctest_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42 10311be35a1SLionel Sambuctest_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38 10411be35a1SLionel Sambuctest_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53 10511be35a1SLionel Sambuctest_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56 10611be35a1SLionel Sambuctest_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58 10711be35a1SLionel Sambuctest_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56 10811be35a1SLionel Sambuctest_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51 10911be35a1SLionel Sambuctest_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80 11011be35a1SLionel Sambuctest_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84 11111be35a1SLionel Sambuctest_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87 11211be35a1SLionel Sambuctest_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83 11311be35a1SLionel Sambuctest_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76 11411be35a1SLionel Sambuctest_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107 11511be35a1SLionel Sambuctest_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111 11611be35a1SLionel Sambuctest_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115 11711be35a1SLionel Sambuctest_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111 11811be35a1SLionel Sambuctest_case grow_64M_v2_65536 resize_ffs 65536 8192 131072 262144 2 101 11911be35a1SLionel Sambuc 12011be35a1SLionel Sambucatf_test_case grow_ffsv1_partial_cg 12111be35a1SLionel Sambucgrow_ffsv1_partial_cg_head() 12211be35a1SLionel Sambuc{ 12311be35a1SLionel Sambuc atf_set "descr" "Checks successful ffsv1 growth by less" \ 12411be35a1SLionel Sambuc "than a cylinder group" 12511be35a1SLionel Sambuc} 12611be35a1SLionel Sambucgrow_ffsv1_partial_cg_body() 12711be35a1SLionel Sambuc{ 12811be35a1SLionel Sambuc echo "***resize_ffs grow test" 12911be35a1SLionel Sambuc 13011be35a1SLionel Sambuc # resize_ffs only supports ffsv1 at the moment 13111be35a1SLionel Sambuc atf_check -o ignore -e ignore newfs -V1 -s 4000 -F ${IMG} 13211be35a1SLionel Sambuc 13311be35a1SLionel Sambuc # size to grow to is chosen to cause partial cg 134*0a6a1f1dSLionel Sambuc atf_check -s exit:0 -o ignore resize_ffs -c -y -s 5760 ${IMG} 13511be35a1SLionel Sambuc atf_check -s exit:0 -o ignore resize_ffs -y -s 5760 ${IMG} 13611be35a1SLionel Sambuc atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG} 137*0a6a1f1dSLionel Sambuc atf_check -s exit:1 -o ignore resize_ffs -c -y -s 5760 ${IMG} 13811be35a1SLionel Sambuc} 13911be35a1SLionel Sambuc 14011be35a1SLionel Sambucatf_init_test_cases() 14111be35a1SLionel Sambuc{ 14211be35a1SLionel Sambuc setupvars 14311be35a1SLionel Sambuc atf_add_test_case grow_16M_v0_8192 14411be35a1SLionel Sambuc atf_add_test_case grow_16M_v1_16384 14511be35a1SLionel Sambuc atf_add_test_case grow_16M_v2_32768 14611be35a1SLionel Sambucif [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then 14711be35a1SLionel Sambuc atf_add_test_case grow_16M_v0_4096 14811be35a1SLionel Sambuc atf_add_test_case grow_16M_v0_16384 14911be35a1SLionel Sambuc atf_add_test_case grow_16M_v0_32768 15011be35a1SLionel Sambuc atf_add_test_case grow_16M_v0_65536 15111be35a1SLionel Sambuc atf_add_test_case grow_16M_v1_4096 15211be35a1SLionel Sambuc atf_add_test_case grow_16M_v1_8192 15311be35a1SLionel Sambuc atf_add_test_case grow_16M_v1_32768 15411be35a1SLionel Sambuc atf_add_test_case grow_16M_v1_65536 15511be35a1SLionel Sambuc atf_add_test_case grow_16M_v2_4096 15611be35a1SLionel Sambuc atf_add_test_case grow_16M_v2_8192 15711be35a1SLionel Sambuc atf_add_test_case grow_16M_v2_16384 15811be35a1SLionel Sambuc atf_add_test_case grow_16M_v2_65536 15911be35a1SLionel Sambuc atf_add_test_case grow_24M_v0_4096 16011be35a1SLionel Sambuc atf_add_test_case grow_24M_v0_8192 16111be35a1SLionel Sambuc atf_add_test_case grow_24M_v0_16384 16211be35a1SLionel Sambuc atf_add_test_case grow_24M_v0_32768 16311be35a1SLionel Sambuc atf_add_test_case grow_24M_v0_65536 16411be35a1SLionel Sambuc atf_add_test_case grow_32M_v0_4096 16511be35a1SLionel Sambuc atf_add_test_case grow_32M_v0_8192 16611be35a1SLionel Sambuc atf_add_test_case grow_32M_v0_16384 16711be35a1SLionel Sambuc atf_add_test_case grow_32M_v0_32768 16811be35a1SLionel Sambuc atf_add_test_case grow_32M_v0_65536 16911be35a1SLionel Sambuc atf_add_test_case grow_48M_v0_4096 17011be35a1SLionel Sambuc atf_add_test_case grow_48M_v0_8192 17111be35a1SLionel Sambuc atf_add_test_case grow_48M_v0_16384 17211be35a1SLionel Sambuc atf_add_test_case grow_48M_v0_32768 17311be35a1SLionel Sambuc atf_add_test_case grow_48M_v0_65536 17411be35a1SLionel Sambuc atf_add_test_case grow_64M_v0_4096 17511be35a1SLionel Sambuc atf_add_test_case grow_64M_v0_8192 17611be35a1SLionel Sambuc atf_add_test_case grow_64M_v0_16384 17711be35a1SLionel Sambuc atf_add_test_case grow_64M_v0_32768 17811be35a1SLionel Sambuc atf_add_test_case grow_64M_v0_65536 17911be35a1SLionel Sambuc 18011be35a1SLionel Sambuc atf_add_test_case grow_24M_v1_4096 18111be35a1SLionel Sambuc atf_add_test_case grow_24M_v1_8192 18211be35a1SLionel Sambuc atf_add_test_case grow_24M_v1_16384 18311be35a1SLionel Sambuc atf_add_test_case grow_24M_v1_32768 18411be35a1SLionel Sambuc atf_add_test_case grow_24M_v1_65536 18511be35a1SLionel Sambuc atf_add_test_case grow_32M_v1_4096 18611be35a1SLionel Sambuc atf_add_test_case grow_32M_v1_8192 18711be35a1SLionel Sambuc atf_add_test_case grow_32M_v1_16384 18811be35a1SLionel Sambuc atf_add_test_case grow_32M_v1_32768 18911be35a1SLionel Sambuc atf_add_test_case grow_32M_v1_65536 19011be35a1SLionel Sambuc atf_add_test_case grow_48M_v1_4096 19111be35a1SLionel Sambuc atf_add_test_case grow_48M_v1_8192 19211be35a1SLionel Sambuc atf_add_test_case grow_48M_v1_16384 19311be35a1SLionel Sambuc atf_add_test_case grow_48M_v1_32768 19411be35a1SLionel Sambuc atf_add_test_case grow_48M_v1_65536 19511be35a1SLionel Sambuc atf_add_test_case grow_64M_v1_4096 19611be35a1SLionel Sambuc atf_add_test_case grow_64M_v1_8192 19711be35a1SLionel Sambuc atf_add_test_case grow_64M_v1_16384 19811be35a1SLionel Sambuc atf_add_test_case grow_64M_v1_32768 19911be35a1SLionel Sambuc atf_add_test_case grow_64M_v1_65536 20011be35a1SLionel Sambuc 20111be35a1SLionel Sambuc atf_add_test_case grow_24M_v2_4096 20211be35a1SLionel Sambuc atf_add_test_case grow_24M_v2_8192 20311be35a1SLionel Sambuc atf_add_test_case grow_24M_v2_16384 20411be35a1SLionel Sambuc atf_add_test_case grow_24M_v2_32768 20511be35a1SLionel Sambuc atf_add_test_case grow_24M_v2_65536 20611be35a1SLionel Sambuc atf_add_test_case grow_32M_v2_4096 20711be35a1SLionel Sambuc atf_add_test_case grow_32M_v2_8192 20811be35a1SLionel Sambuc atf_add_test_case grow_32M_v2_16384 20911be35a1SLionel Sambuc atf_add_test_case grow_32M_v2_32768 21011be35a1SLionel Sambuc atf_add_test_case grow_32M_v2_65536 21111be35a1SLionel Sambuc atf_add_test_case grow_48M_v2_4096 21211be35a1SLionel Sambuc atf_add_test_case grow_48M_v2_8192 21311be35a1SLionel Sambuc atf_add_test_case grow_48M_v2_16384 21411be35a1SLionel Sambuc atf_add_test_case grow_48M_v2_32768 21511be35a1SLionel Sambuc atf_add_test_case grow_48M_v2_65536 21611be35a1SLionel Sambuc atf_add_test_case grow_64M_v2_4096 21711be35a1SLionel Sambuc atf_add_test_case grow_64M_v2_8192 21811be35a1SLionel Sambuc atf_add_test_case grow_64M_v2_16384 21911be35a1SLionel Sambuc atf_add_test_case grow_64M_v2_32768 22011be35a1SLionel Sambuc atf_add_test_case grow_64M_v2_65536 22111be35a1SLionel Sambucfi 22211be35a1SLionel Sambuc atf_add_test_case grow_ffsv1_partial_cg 22311be35a1SLionel Sambuc} 224