xref: /freebsd/contrib/netbsd-tests/sbin/resize_ffs/t_grow.sh (revision c22165b4f1f5d38b681921797a44b3ba8c13b7e0)
1*640235e2SEnji Cooper# $NetBSD: t_grow.sh,v 1.9 2015/03/29 19:37:02 chopps Exp $
257718be8SEnji Cooper#
357718be8SEnji Cooper# Copyright (c) 2010 The NetBSD Foundation, Inc.
457718be8SEnji Cooper# All rights reserved.
557718be8SEnji Cooper#
657718be8SEnji Cooper# This code is derived from software contributed to The NetBSD Foundation
757718be8SEnji Cooper# by Jeffrey C. Rizzo.
857718be8SEnji Cooper#
957718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without
1057718be8SEnji Cooper# modification, are permitted provided that the following conditions
1157718be8SEnji Cooper# are met:
1257718be8SEnji Cooper# 1. Redistributions of source code must retain the above copyright
1357718be8SEnji Cooper#    notice, this list of conditions and the following disclaimer.
1457718be8SEnji Cooper# 2. Redistributions in binary form must reproduce the above copyright
1557718be8SEnji Cooper#    notice, this list of conditions and the following disclaimer in the
1657718be8SEnji Cooper#    documentation and/or other materials provided with the distribution.
1757718be8SEnji Cooper#
1857718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1957718be8SEnji Cooper# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2057718be8SEnji Cooper# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2157718be8SEnji Cooper# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2257718be8SEnji Cooper# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2357718be8SEnji Cooper# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2457718be8SEnji Cooper# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2557718be8SEnji Cooper# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2657718be8SEnji Cooper# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2757718be8SEnji Cooper# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2857718be8SEnji Cooper# POSSIBILITY OF SUCH DAMAGE.
2957718be8SEnji Cooper#
3057718be8SEnji Cooper
3157718be8SEnji Cooper
3257718be8SEnji Cooper# resize_ffs params as follows:
3357718be8SEnji Cooper# resize_ffs blocksize fragsize fssize newfssize level numdata swap
3457718be8SEnji Cooper# where 'numdata' is the number of data directories to copy - this is
3557718be8SEnji Cooper# determined manually based on the maximum number that will fit in the
3657718be8SEnji Cooper# created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
3757718be8SEnji Cooper# If 'swap' is included, byteswap the fs
3857718be8SEnji Cooper
3957718be8SEnji Cooper# v0 == newfs -O0  (4.3BSD layout, ffsv1 superblock)
4057718be8SEnji Coopertest_case grow_16M_v0_4096 resize_ffs 4096 512 32768 131072 0 28
4157718be8SEnji Coopertest_case grow_16M_v0_8192 resize_ffs 8192 1024 32768 131072 0 28
4257718be8SEnji Coopertest_case grow_16M_v0_16384 resize_ffs 16384 2048 32768 131072 0 29
4357718be8SEnji Coopertest_case grow_16M_v0_32768 resize_ffs 32768 4096 32768 131072 0 28
4457718be8SEnji Coopertest_case grow_16M_v0_65536 resize_ffs 65536 8192 32768 131072 0 26
4557718be8SEnji Cooper# these grow_24M grow a smaller amount; sometimes there's different issues
4657718be8SEnji Coopertest_case grow_24M_v0_4096 resize_ffs 4096 512 49152 65536 0 41
4757718be8SEnji Coopertest_case grow_24M_v0_8192 resize_ffs 8192 1024 49152 65536 0 42
4857718be8SEnji Coopertest_case grow_24M_v0_16384 resize_ffs 16384 2048 49152 65536 0 43
4957718be8SEnji Coopertest_case grow_24M_v0_32768 resize_ffs 32768 4096 49152 65536 0 42
5057718be8SEnji Coopertest_case grow_24M_v0_65536 resize_ffs 65536 8192 49152 65536 0 38
5157718be8SEnji Coopertest_case grow_32M_v0_4096 resize_ffs 4096 512 65536 131072 0 55
5257718be8SEnji Coopertest_case grow_32M_v0_8192 resize_ffs 8192 1024 65536 131072 0 56
5357718be8SEnji Coopertest_case grow_32M_v0_16384 resize_ffs 16384 2048 65536 131072 0 58
5457718be8SEnji Coopertest_case grow_32M_v0_32768 resize_ffs 32768 4096 65536 131072 0 56
5557718be8SEnji Coopertest_case grow_32M_v0_65536 resize_ffs 65536 8192 65536 131072 0 51
5657718be8SEnji Coopertest_case grow_48M_v0_4096 resize_ffs 4096 512 98304 131072 0 82
5757718be8SEnji Coopertest_case grow_48M_v0_8192 resize_ffs 8192 1024 98304 131072 0 84
5857718be8SEnji Coopertest_case grow_48M_v0_16384 resize_ffs 16384 2048 98304 131072 0 87
5957718be8SEnji Coopertest_case grow_48M_v0_32768 resize_ffs 32768 4096 98304 131072 0 83
6057718be8SEnji Coopertest_case grow_48M_v0_65536 resize_ffs 65536 8192 98304 131072 0 76
6157718be8SEnji Coopertest_case grow_64M_v0_4096 resize_ffs 4096 512 131072 262144 0 109
6257718be8SEnji Coopertest_case grow_64M_v0_8192 resize_ffs 8192 1024 131072 262144 0 111
6357718be8SEnji Coopertest_case grow_64M_v0_16384 resize_ffs 16384 2048 131072 262144 0 115
6457718be8SEnji Coopertest_case grow_64M_v0_32768 resize_ffs 32768 4096 131072 262144 0 111
6557718be8SEnji Coopertest_case grow_64M_v0_65536 resize_ffs 65536 8192 131072 262144 0 101
6657718be8SEnji Cooper
6757718be8SEnji Cooper# v1 == newfs -O1 (FFSv1, v2 superblock layout)
6857718be8SEnji Coopertest_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28
6957718be8SEnji Coopertest_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28
7057718be8SEnji Coopertest_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29
7157718be8SEnji Coopertest_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28
7257718be8SEnji Coopertest_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26
7357718be8SEnji Cooper# these grow_24M grow a smaller amount; sometimes there's different issues
7457718be8SEnji Coopertest_case grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41
7557718be8SEnji Coopertest_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42
7657718be8SEnji Coopertest_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43
7757718be8SEnji Coopertest_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42
7857718be8SEnji Coopertest_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38
7957718be8SEnji Coopertest_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55
8057718be8SEnji Coopertest_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56
8157718be8SEnji Coopertest_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58
8257718be8SEnji Coopertest_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56
8357718be8SEnji Coopertest_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51
8457718be8SEnji Coopertest_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82
8557718be8SEnji Coopertest_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84
8657718be8SEnji Coopertest_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87
8757718be8SEnji Coopertest_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83
8857718be8SEnji Coopertest_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76
8957718be8SEnji Coopertest_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109
9057718be8SEnji Coopertest_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111
9157718be8SEnji Coopertest_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115
9257718be8SEnji Coopertest_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111
9357718be8SEnji Coopertest_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101
9457718be8SEnji Coopertest_case grow_16M_v2_4096 resize_ffs 4096 512 32768 131072 2 26
9557718be8SEnji Coopertest_case grow_16M_v2_8192 resize_ffs 8192 1024 32768 131072 2 28
9657718be8SEnji Coopertest_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29
9757718be8SEnji Coopertest_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28
9857718be8SEnji Coopertest_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25
9957718be8SEnji Coopertest_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40
10057718be8SEnji Coopertest_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42
10157718be8SEnji Coopertest_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43
10257718be8SEnji Coopertest_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42
10357718be8SEnji Coopertest_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38
10457718be8SEnji Coopertest_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53
10557718be8SEnji Coopertest_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56
10657718be8SEnji Coopertest_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58
10757718be8SEnji Coopertest_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56
10857718be8SEnji Coopertest_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51
10957718be8SEnji Coopertest_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80
11057718be8SEnji Coopertest_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84
11157718be8SEnji Coopertest_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87
11257718be8SEnji Coopertest_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83
11357718be8SEnji Coopertest_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76
11457718be8SEnji Coopertest_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107
11557718be8SEnji Coopertest_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111
11657718be8SEnji Coopertest_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115
11757718be8SEnji Coopertest_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111
11857718be8SEnji Coopertest_case grow_64M_v2_65536 resize_ffs 65536 8192 131072 262144 2 101
11957718be8SEnji Cooper
12057718be8SEnji Cooperatf_test_case grow_ffsv1_partial_cg
12157718be8SEnji Coopergrow_ffsv1_partial_cg_head()
12257718be8SEnji Cooper{
12357718be8SEnji Cooper	atf_set "descr" "Checks successful ffsv1 growth by less" \
12457718be8SEnji Cooper			"than a cylinder group"
12557718be8SEnji Cooper}
12657718be8SEnji Coopergrow_ffsv1_partial_cg_body()
12757718be8SEnji Cooper{
12857718be8SEnji Cooper	echo "***resize_ffs grow test"
12957718be8SEnji Cooper
13057718be8SEnji Cooper	# resize_ffs only supports ffsv1 at the moment
13157718be8SEnji Cooper	atf_check -o ignore -e ignore newfs -V1 -s 4000 -F ${IMG}
13257718be8SEnji Cooper
13357718be8SEnji Cooper	# size to grow to is chosen to cause partial cg
134*640235e2SEnji Cooper	atf_check -s exit:0 -o ignore resize_ffs -c -y -s 5760 ${IMG}
13557718be8SEnji Cooper	atf_check -s exit:0 -o ignore resize_ffs -y -s 5760 ${IMG}
13657718be8SEnji Cooper	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
137*640235e2SEnji Cooper	atf_check -s exit:1 -o ignore resize_ffs -c -y -s 5760 ${IMG}
13857718be8SEnji Cooper}
13957718be8SEnji Cooper
14057718be8SEnji Cooperatf_init_test_cases()
14157718be8SEnji Cooper{
14257718be8SEnji Cooper	setupvars
14357718be8SEnji Cooper	atf_add_test_case grow_16M_v0_8192
14457718be8SEnji Cooper	atf_add_test_case grow_16M_v1_16384
14557718be8SEnji Cooper	atf_add_test_case grow_16M_v2_32768
14657718be8SEnji Cooperif [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
14757718be8SEnji Cooper	atf_add_test_case grow_16M_v0_4096
14857718be8SEnji Cooper	atf_add_test_case grow_16M_v0_16384
14957718be8SEnji Cooper	atf_add_test_case grow_16M_v0_32768
15057718be8SEnji Cooper	atf_add_test_case grow_16M_v0_65536
15157718be8SEnji Cooper	atf_add_test_case grow_16M_v1_4096
15257718be8SEnji Cooper	atf_add_test_case grow_16M_v1_8192
15357718be8SEnji Cooper	atf_add_test_case grow_16M_v1_32768
15457718be8SEnji Cooper	atf_add_test_case grow_16M_v1_65536
15557718be8SEnji Cooper	atf_add_test_case grow_16M_v2_4096
15657718be8SEnji Cooper	atf_add_test_case grow_16M_v2_8192
15757718be8SEnji Cooper	atf_add_test_case grow_16M_v2_16384
15857718be8SEnji Cooper	atf_add_test_case grow_16M_v2_65536
15957718be8SEnji Cooper	atf_add_test_case grow_24M_v0_4096
16057718be8SEnji Cooper	atf_add_test_case grow_24M_v0_8192
16157718be8SEnji Cooper	atf_add_test_case grow_24M_v0_16384
16257718be8SEnji Cooper	atf_add_test_case grow_24M_v0_32768
16357718be8SEnji Cooper	atf_add_test_case grow_24M_v0_65536
16457718be8SEnji Cooper	atf_add_test_case grow_32M_v0_4096
16557718be8SEnji Cooper	atf_add_test_case grow_32M_v0_8192
16657718be8SEnji Cooper	atf_add_test_case grow_32M_v0_16384
16757718be8SEnji Cooper	atf_add_test_case grow_32M_v0_32768
16857718be8SEnji Cooper	atf_add_test_case grow_32M_v0_65536
16957718be8SEnji Cooper	atf_add_test_case grow_48M_v0_4096
17057718be8SEnji Cooper	atf_add_test_case grow_48M_v0_8192
17157718be8SEnji Cooper	atf_add_test_case grow_48M_v0_16384
17257718be8SEnji Cooper	atf_add_test_case grow_48M_v0_32768
17357718be8SEnji Cooper	atf_add_test_case grow_48M_v0_65536
17457718be8SEnji Cooper	atf_add_test_case grow_64M_v0_4096
17557718be8SEnji Cooper	atf_add_test_case grow_64M_v0_8192
17657718be8SEnji Cooper	atf_add_test_case grow_64M_v0_16384
17757718be8SEnji Cooper	atf_add_test_case grow_64M_v0_32768
17857718be8SEnji Cooper	atf_add_test_case grow_64M_v0_65536
17957718be8SEnji Cooper
18057718be8SEnji Cooper	atf_add_test_case grow_24M_v1_4096
18157718be8SEnji Cooper	atf_add_test_case grow_24M_v1_8192
18257718be8SEnji Cooper	atf_add_test_case grow_24M_v1_16384
18357718be8SEnji Cooper	atf_add_test_case grow_24M_v1_32768
18457718be8SEnji Cooper	atf_add_test_case grow_24M_v1_65536
18557718be8SEnji Cooper	atf_add_test_case grow_32M_v1_4096
18657718be8SEnji Cooper	atf_add_test_case grow_32M_v1_8192
18757718be8SEnji Cooper	atf_add_test_case grow_32M_v1_16384
18857718be8SEnji Cooper	atf_add_test_case grow_32M_v1_32768
18957718be8SEnji Cooper	atf_add_test_case grow_32M_v1_65536
19057718be8SEnji Cooper	atf_add_test_case grow_48M_v1_4096
19157718be8SEnji Cooper	atf_add_test_case grow_48M_v1_8192
19257718be8SEnji Cooper	atf_add_test_case grow_48M_v1_16384
19357718be8SEnji Cooper	atf_add_test_case grow_48M_v1_32768
19457718be8SEnji Cooper	atf_add_test_case grow_48M_v1_65536
19557718be8SEnji Cooper	atf_add_test_case grow_64M_v1_4096
19657718be8SEnji Cooper	atf_add_test_case grow_64M_v1_8192
19757718be8SEnji Cooper	atf_add_test_case grow_64M_v1_16384
19857718be8SEnji Cooper	atf_add_test_case grow_64M_v1_32768
19957718be8SEnji Cooper	atf_add_test_case grow_64M_v1_65536
20057718be8SEnji Cooper
20157718be8SEnji Cooper	atf_add_test_case grow_24M_v2_4096
20257718be8SEnji Cooper	atf_add_test_case grow_24M_v2_8192
20357718be8SEnji Cooper	atf_add_test_case grow_24M_v2_16384
20457718be8SEnji Cooper	atf_add_test_case grow_24M_v2_32768
20557718be8SEnji Cooper	atf_add_test_case grow_24M_v2_65536
20657718be8SEnji Cooper	atf_add_test_case grow_32M_v2_4096
20757718be8SEnji Cooper	atf_add_test_case grow_32M_v2_8192
20857718be8SEnji Cooper	atf_add_test_case grow_32M_v2_16384
20957718be8SEnji Cooper	atf_add_test_case grow_32M_v2_32768
21057718be8SEnji Cooper	atf_add_test_case grow_32M_v2_65536
21157718be8SEnji Cooper	atf_add_test_case grow_48M_v2_4096
21257718be8SEnji Cooper	atf_add_test_case grow_48M_v2_8192
21357718be8SEnji Cooper	atf_add_test_case grow_48M_v2_16384
21457718be8SEnji Cooper	atf_add_test_case grow_48M_v2_32768
21557718be8SEnji Cooper	atf_add_test_case grow_48M_v2_65536
21657718be8SEnji Cooper	atf_add_test_case grow_64M_v2_4096
21757718be8SEnji Cooper	atf_add_test_case grow_64M_v2_8192
21857718be8SEnji Cooper	atf_add_test_case grow_64M_v2_16384
21957718be8SEnji Cooper	atf_add_test_case grow_64M_v2_32768
22057718be8SEnji Cooper	atf_add_test_case grow_64M_v2_65536
22157718be8SEnji Cooperfi
22257718be8SEnji Cooper	atf_add_test_case grow_ffsv1_partial_cg
22357718be8SEnji Cooper}
224