]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh
MFC r305358,r305449,r305451,r306367,r306397,r309474:
[FreeBSD/stable/10.git] / contrib / netbsd-tests / sbin / resize_ffs / t_shrink.sh
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
38 test_case shrink_24M_16M_v0_4096 resize_ffs 4096 512 49152 32768 0 41
39 test_case shrink_24M_16M_v0_8192 resize_ffs 8192 1024 49152 32768 0 42
40 test_case shrink_24M_16M_v0_16384 resize_ffs 16384 2048 49152 32768 0 43
41 test_case shrink_24M_16M_v0_32768 resize_ffs 32768 4096 49152 32768 0 42
42 test_case shrink_24M_16M_v0_65536 resize_ffs 65536 8192 49152 32768 0 38
43 test_case shrink_32M_24M_v0_4096 resize_ffs 4096 512 65536 49152 0 55
44 test_case shrink_32M_24M_v0_8192 resize_ffs 8192 1024 65536 49152 0 56
45 test_case shrink_32M_24M_v0_16384 resize_ffs 16384 2048 65536 49152 0 58
46 test_case shrink_32M_24M_v0_32768 resize_ffs 32768 4096 65536 49152 0 56
47 test_case_xfail shrink_32M_24M_v0_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 0 51
48 test_case shrink_48M_16M_v0_4096 resize_ffs 4096 512 98304 32768 0 82
49 test_case shrink_48M_16M_v0_8192 resize_ffs 8192 1024 98304 32768 0 84
50 test_case shrink_48M_16M_v0_16384 resize_ffs 16384 2048 98304 32768 0 87
51 test_case shrink_48M_16M_v0_32768 resize_ffs 32768 4096 98304 32768 0 83
52 test_case shrink_48M_16M_v0_65536 resize_ffs 65536 8192 98304 32768 0 76
53 test_case shrink_64M_48M_v0_4096 resize_ffs 4096 512 131072 98304 0 109
54 test_case shrink_64M_48M_v0_8192 resize_ffs 8192 1024 131072 98304 0 111
55 test_case shrink_64M_48M_v0_16384 resize_ffs 16384 2048 131072 98304 0 115
56 test_case shrink_64M_48M_v0_32768 resize_ffs 32768 4096 131072 98304 0 111
57 test_case shrink_64M_48M_v0_65536 resize_ffs 65536 8192 131072 98304 0 101
58
59 test_case shrink_24M_16M_v1_4096 resize_ffs 4096 512 49152 32768 1 41
60 test_case shrink_24M_16M_v1_8192 resize_ffs 8192 1024 49152 32768 1 42
61 test_case shrink_24M_16M_v1_16384 resize_ffs 16384 2048 49152 32768 1 43
62 test_case shrink_24M_16M_v1_32768 resize_ffs 32768 4096 49152 32768 1 42
63 test_case shrink_24M_16M_v1_65536 resize_ffs 65536 8192 49152 32768 1 38
64 test_case shrink_32M_24M_v1_4096 resize_ffs 4096 512 65536 49152 1 55
65 test_case shrink_32M_24M_v1_8192 resize_ffs 8192 1024 65536 49152 1 56
66 test_case shrink_32M_24M_v1_16384 resize_ffs 16384 2048 65536 49152 1 58
67 test_case shrink_32M_24M_v1_32768 resize_ffs 32768 4096 65536 49152 1 56
68 test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 1 51
69 test_case shrink_48M_16M_v1_4096 resize_ffs 4096 512 98304 32768 1 82
70 test_case shrink_48M_16M_v1_8192 resize_ffs 8192 1024 98304 32768 1 84
71 test_case shrink_48M_16M_v1_16384 resize_ffs 16384 2048 98304 32768 1 87
72 test_case shrink_48M_16M_v1_32768 resize_ffs 32768 4096 98304 32768 1 83
73 test_case shrink_48M_16M_v1_65536 resize_ffs 65536 8192 98304 32768 1 76
74 test_case shrink_64M_48M_v1_4096 resize_ffs 4096 512 131072 98304 1 109
75 test_case shrink_64M_48M_v1_8192 resize_ffs 8192 1024 131072 98304 1 111
76 test_case shrink_64M_48M_v1_16384 resize_ffs 16384 2048 131072 98304 1 115
77 test_case shrink_64M_48M_v1_32768 resize_ffs 32768 4096 131072 98304 1 111
78 test_case shrink_64M_48M_v1_65536 resize_ffs 65536 8192 131072 98304 1 101
79
80 test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 49152 32768 2 41
81 test_case_xfail shrink_24M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 49152 32768 2 42
82 test_case_xfail shrink_24M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 49152 32768 2 43
83 test_case_xfail shrink_24M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 49152 32768 2 42
84 test_case_xfail shrink_24M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 49152 32768 2 38
85 test_case_xfail shrink_32M_24M_v2_4096 "PR bin/44205" resize_ffs 4096 512 65536 49152 2 55
86 test_case_xfail shrink_32M_24M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 65536 49152 2 56
87 test_case_xfail shrink_32M_24M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 65536 49152 2 58
88 test_case_xfail shrink_32M_24M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 65536 49152 2 56
89 test_case_xfail shrink_32M_24M_v2_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 2 51
90 test_case_xfail shrink_48M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 98304 32768 2 82
91 test_case_xfail shrink_48M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 98304 32768 2 84
92 test_case_xfail shrink_48M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 98304 32768 2 87
93 test_case_xfail shrink_48M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 98304 32768 2 83
94 test_case_xfail shrink_48M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 98304 32768 2 76
95 test_case_xfail shrink_64M_48M_v2_4096 "PR bin/44205" resize_ffs 4096 512 131072 98304 2 109
96 test_case_xfail shrink_64M_48M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 131072 98304 2 111
97 test_case_xfail shrink_64M_48M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 131072 98304 2 115
98 test_case_xfail shrink_64M_48M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 131072 98304 2 111
99 test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101
100
101
102 atf_test_case shrink_ffsv1_partial_cg
103 shrink_ffsv1_partial_cg_head()
104 {
105         atf_set "descr" "Checks successful shrinkage of ffsv1 by" \
106                         "less than a cylinder group"
107 }
108 shrink_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
121 atf_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
127 if [ "${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
185 fi
186         atf_add_test_case shrink_ffsv1_partial_cg
187 }