xref: /freebsd/contrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh (revision 02e9120893770924227138ba49df1edb3896112a)
1# $NetBSD: t_shrink.sh,v 1.8 2015/03/29 19:37:02 chopps Exp $
2#
3# Copyright (c) 2010 The NetBSD Foundation, Inc.
4# All rights reserved.
5#
6# This code is derived from software contributed to The NetBSD Foundation
7# by Jeffrey C. Rizzo.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12# 1. Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in the
16#    documentation and/or other materials provided with the distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE.
29#
30
31
32# resize_ffs params as follows:
33# resize_ffs blocksize fragsize fssize newfssize level numdata swap
34# where 'numdata' is the number of data directories to copy - this is
35# determined manually based on the maximum number that will fit in the
36# created fs.  'level' is the fs-level (-O 0,1,2) passed to newfs.
37# If 'swap' is included, byteswap the fs
38test_case shrink_24M_16M_v0_4096 resize_ffs 4096 512 49152 32768 0 41
39test_case shrink_24M_16M_v0_8192 resize_ffs 8192 1024 49152 32768 0 42
40test_case shrink_24M_16M_v0_16384 resize_ffs 16384 2048 49152 32768 0 43
41test_case shrink_24M_16M_v0_32768 resize_ffs 32768 4096 49152 32768 0 42
42test_case shrink_24M_16M_v0_65536 resize_ffs 65536 8192 49152 32768 0 38
43test_case shrink_32M_24M_v0_4096 resize_ffs 4096 512 65536 49152 0 55
44test_case shrink_32M_24M_v0_8192 resize_ffs 8192 1024 65536 49152 0 56
45test_case shrink_32M_24M_v0_16384 resize_ffs 16384 2048 65536 49152 0 58
46test_case shrink_32M_24M_v0_32768 resize_ffs 32768 4096 65536 49152 0 56
47test_case_xfail shrink_32M_24M_v0_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 0 51
48test_case shrink_48M_16M_v0_4096 resize_ffs 4096 512 98304 32768 0 82
49test_case shrink_48M_16M_v0_8192 resize_ffs 8192 1024 98304 32768 0 84
50test_case shrink_48M_16M_v0_16384 resize_ffs 16384 2048 98304 32768 0 87
51test_case shrink_48M_16M_v0_32768 resize_ffs 32768 4096 98304 32768 0 83
52test_case shrink_48M_16M_v0_65536 resize_ffs 65536 8192 98304 32768 0 76
53test_case shrink_64M_48M_v0_4096 resize_ffs 4096 512 131072 98304 0 109
54test_case shrink_64M_48M_v0_8192 resize_ffs 8192 1024 131072 98304 0 111
55test_case shrink_64M_48M_v0_16384 resize_ffs 16384 2048 131072 98304 0 115
56test_case shrink_64M_48M_v0_32768 resize_ffs 32768 4096 131072 98304 0 111
57test_case shrink_64M_48M_v0_65536 resize_ffs 65536 8192 131072 98304 0 101
58
59test_case shrink_24M_16M_v1_4096 resize_ffs 4096 512 49152 32768 1 41
60test_case shrink_24M_16M_v1_8192 resize_ffs 8192 1024 49152 32768 1 42
61test_case shrink_24M_16M_v1_16384 resize_ffs 16384 2048 49152 32768 1 43
62test_case shrink_24M_16M_v1_32768 resize_ffs 32768 4096 49152 32768 1 42
63test_case shrink_24M_16M_v1_65536 resize_ffs 65536 8192 49152 32768 1 38
64test_case shrink_32M_24M_v1_4096 resize_ffs 4096 512 65536 49152 1 55
65test_case shrink_32M_24M_v1_8192 resize_ffs 8192 1024 65536 49152 1 56
66test_case shrink_32M_24M_v1_16384 resize_ffs 16384 2048 65536 49152 1 58
67test_case shrink_32M_24M_v1_32768 resize_ffs 32768 4096 65536 49152 1 56
68test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 1 51
69test_case shrink_48M_16M_v1_4096 resize_ffs 4096 512 98304 32768 1 82
70test_case shrink_48M_16M_v1_8192 resize_ffs 8192 1024 98304 32768 1 84
71test_case shrink_48M_16M_v1_16384 resize_ffs 16384 2048 98304 32768 1 87
72test_case shrink_48M_16M_v1_32768 resize_ffs 32768 4096 98304 32768 1 83
73test_case shrink_48M_16M_v1_65536 resize_ffs 65536 8192 98304 32768 1 76
74test_case shrink_64M_48M_v1_4096 resize_ffs 4096 512 131072 98304 1 109
75test_case shrink_64M_48M_v1_8192 resize_ffs 8192 1024 131072 98304 1 111
76test_case shrink_64M_48M_v1_16384 resize_ffs 16384 2048 131072 98304 1 115
77test_case shrink_64M_48M_v1_32768 resize_ffs 32768 4096 131072 98304 1 111
78test_case shrink_64M_48M_v1_65536 resize_ffs 65536 8192 131072 98304 1 101
79
80test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 49152 32768 2 41
81test_case_xfail shrink_24M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 49152 32768 2 42
82test_case_xfail shrink_24M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 49152 32768 2 43
83test_case_xfail shrink_24M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 49152 32768 2 42
84test_case_xfail shrink_24M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 49152 32768 2 38
85test_case_xfail shrink_32M_24M_v2_4096 "PR bin/44205" resize_ffs 4096 512 65536 49152 2 55
86test_case_xfail shrink_32M_24M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 65536 49152 2 56
87test_case_xfail shrink_32M_24M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 65536 49152 2 58
88test_case_xfail shrink_32M_24M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 65536 49152 2 56
89test_case_xfail shrink_32M_24M_v2_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 2 51
90test_case_xfail shrink_48M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 98304 32768 2 82
91test_case_xfail shrink_48M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 98304 32768 2 84
92test_case_xfail shrink_48M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 98304 32768 2 87
93test_case_xfail shrink_48M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 98304 32768 2 83
94test_case_xfail shrink_48M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 98304 32768 2 76
95test_case_xfail shrink_64M_48M_v2_4096 "PR bin/44205" resize_ffs 4096 512 131072 98304 2 109
96test_case_xfail shrink_64M_48M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 131072 98304 2 111
97test_case_xfail shrink_64M_48M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 131072 98304 2 115
98test_case_xfail shrink_64M_48M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 131072 98304 2 111
99test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101
100
101
102atf_test_case shrink_ffsv1_partial_cg
103shrink_ffsv1_partial_cg_head()
104{
105	atf_set "descr" "Checks successful shrinkage of ffsv1 by" \
106			"less than a cylinder group"
107}
108shrink_ffsv1_partial_cg_body()
109{
110	echo "*** resize_ffs shrinkage partial cg test"
111
112	atf_check -o ignore -e ignore newfs -V1 -F -s 5760 ${IMG}
113
114	# shrink so there's a partial cg at the end
115	atf_check -s exit:0 resize_ffs -c -s 4000 -y ${IMG}
116	atf_check -s exit:0 resize_ffs -s 4000 -y ${IMG}
117	atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
118	atf_check -s exit:1 resize_ffs -c -s 4000 -y ${IMG}
119}
120
121atf_init_test_cases()
122{
123	setupvars
124	atf_add_test_case shrink_24M_16M_v0_32768
125	atf_add_test_case shrink_24M_16M_v1_65536
126	atf_add_test_case shrink_24M_16M_v2_4096
127if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
128	atf_add_test_case shrink_24M_16M_v0_4096
129	atf_add_test_case shrink_24M_16M_v0_8192
130	atf_add_test_case shrink_24M_16M_v0_16384
131	atf_add_test_case shrink_24M_16M_v0_65536
132	atf_add_test_case shrink_24M_16M_v1_4096
133	atf_add_test_case shrink_24M_16M_v1_8192
134	atf_add_test_case shrink_24M_16M_v1_16384
135	atf_add_test_case shrink_24M_16M_v1_32768
136	atf_add_test_case shrink_24M_16M_v2_8192
137	atf_add_test_case shrink_24M_16M_v2_16384
138	atf_add_test_case shrink_24M_16M_v2_32768
139	atf_add_test_case shrink_24M_16M_v2_65536
140	atf_add_test_case shrink_32M_24M_v0_4096
141	atf_add_test_case shrink_32M_24M_v0_8192
142	atf_add_test_case shrink_32M_24M_v0_16384
143	atf_add_test_case shrink_32M_24M_v0_32768
144	atf_add_test_case shrink_32M_24M_v0_65536
145	atf_add_test_case shrink_48M_16M_v0_4096
146	atf_add_test_case shrink_48M_16M_v0_8192
147	atf_add_test_case shrink_48M_16M_v0_16384
148	atf_add_test_case shrink_48M_16M_v0_32768
149	atf_add_test_case shrink_48M_16M_v0_65536
150	atf_add_test_case shrink_64M_48M_v0_4096
151	atf_add_test_case shrink_64M_48M_v0_8192
152	atf_add_test_case shrink_64M_48M_v0_16384
153	atf_add_test_case shrink_64M_48M_v0_32768
154	atf_add_test_case shrink_64M_48M_v0_65536
155	atf_add_test_case shrink_32M_24M_v1_4096
156	atf_add_test_case shrink_32M_24M_v1_8192
157	atf_add_test_case shrink_32M_24M_v1_16384
158	atf_add_test_case shrink_32M_24M_v1_32768
159	atf_add_test_case shrink_32M_24M_v1_65536
160	atf_add_test_case shrink_48M_16M_v1_4096
161	atf_add_test_case shrink_48M_16M_v1_8192
162	atf_add_test_case shrink_48M_16M_v1_16384
163	atf_add_test_case shrink_48M_16M_v1_32768
164	atf_add_test_case shrink_48M_16M_v1_65536
165	atf_add_test_case shrink_64M_48M_v1_4096
166	atf_add_test_case shrink_64M_48M_v1_8192
167	atf_add_test_case shrink_64M_48M_v1_16384
168	atf_add_test_case shrink_64M_48M_v1_32768
169	atf_add_test_case shrink_64M_48M_v1_65536
170	atf_add_test_case shrink_32M_24M_v2_4096
171	atf_add_test_case shrink_32M_24M_v2_8192
172	atf_add_test_case shrink_32M_24M_v2_16384
173	atf_add_test_case shrink_32M_24M_v2_32768
174	atf_add_test_case shrink_32M_24M_v2_65536
175	atf_add_test_case shrink_48M_16M_v2_4096
176	atf_add_test_case shrink_48M_16M_v2_8192
177	atf_add_test_case shrink_48M_16M_v2_16384
178	atf_add_test_case shrink_48M_16M_v2_32768
179	atf_add_test_case shrink_48M_16M_v2_65536
180	atf_add_test_case shrink_64M_48M_v2_4096
181	atf_add_test_case shrink_64M_48M_v2_8192
182	atf_add_test_case shrink_64M_48M_v2_16384
183	atf_add_test_case shrink_64M_48M_v2_32768
184	atf_add_test_case shrink_64M_48M_v2_65536
185fi
186	atf_add_test_case shrink_ffsv1_partial_cg
187}
188