Remove building with NOCRYPTO option
[minix.git] / tests / dev / raidframe / t_raid.sh
blobae21eedf5e340f562df24ac02b967a06ce717ed0
1 #! /usr/bin/atf-sh
2 # $NetBSD: t_raid.sh,v 1.12 2013/02/19 21:08:24 joerg Exp $
4 # Copyright (c) 2010 The NetBSD Foundation, Inc.
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
29 rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
30 rawraid=/dev/rraid0${rawpart}
31 raidserver="rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -lrumpdev_raidframe"
33 makecfg()
35 level=${1}
36 ncol=${2}
38 printf "START array\n1 ${ncol} 0\nSTART disks\n" > raid.conf
39 diskn=0
40 while [ ${ncol} -gt ${diskn} ] ; do
41 echo "/disk${diskn}" >> raid.conf
42 diskn=$((diskn+1))
43 done
45 printf "START layout\n32 1 1 ${level}\nSTART queue\nfifo 100\n" \
46 >> raid.conf
49 atf_test_case smalldisk cleanup
50 smalldisk_head()
52 atf_set "descr" "Checks the raidframe works on small disks " \
53 "(PR kern/44239)"
54 atf_set "require.progs" "rump_server"
57 smalldisk_body()
59 makecfg 1 2
60 export RUMP_SERVER=unix://sock
61 atf_check -s exit:0 ${raidserver} \
62 -d key=/disk0,hostpath=disk0.img,size=1m \
63 -d key=/disk1,hostpath=disk1.img,size=1m \
64 ${RUMP_SERVER}
66 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
69 smalldisk_cleanup()
71 export RUMP_SERVER=unix://sock
72 rump.halt
76 # make this smaller once 44239 is fixed
77 export RAID_MEDIASIZE=32m
79 atf_test_case raid1_compfail cleanup
80 raid1_compfail_head()
82 atf_set "descr" "Checks that RAID1 works after component failure"
83 atf_set "require.progs" "rump_server"
86 raid1_compfail_body()
88 makecfg 1 2
89 export RUMP_SERVER=unix://sock
90 atf_check -s exit:0 ${raidserver} \
91 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
92 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
93 ${RUMP_SERVER}
95 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
96 atf_check -s exit:0 rump.raidctl -I 12345 raid0
97 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
99 # put some data there
100 atf_check -s exit:0 -e ignore \
101 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
102 atf_check -s exit:0 -e ignore -x \
103 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
105 # restart server with failed component
106 rump.halt
107 rm disk1.img # FAIL
108 atf_check -s exit:0 ${raidserver} \
109 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
110 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
111 ${RUMP_SERVER}
113 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
115 # check if we we get what we wrote
116 atf_check -s exit:0 -o file:testfile -e ignore \
117 rump.dd if=${rawraid} count=4
120 raid1_compfail_cleanup()
122 export RUMP_SERVER=unix://sock
123 rump.halt
128 atf_test_case raid1_comp0fail cleanup
129 raid1_comp0fail_head()
131 atf_set "descr" "Checks configuring RAID1 after component 0 fails" \
132 "(PR kern/44251)"
133 atf_set "require.progs" "rump_server"
136 raid1_comp0fail_body()
138 makecfg 1 2
139 export RUMP_SERVER=unix://sock
140 atf_check -s exit:0 ${raidserver} \
141 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
142 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
143 ${RUMP_SERVER}
145 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
146 atf_check -s exit:0 rump.raidctl -I 12345 raid0
147 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
149 # restart server with failed component
150 rump.halt
151 rm disk0.img # FAIL
152 atf_check -s exit:0 ${raidserver} \
153 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
154 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
155 ${RUMP_SERVER}
157 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
160 raid1_comp0fail_cleanup()
162 export RUMP_SERVER=unix://sock
163 rump.halt
166 atf_test_case raid1_normal cleanup
167 raid1_normal_head()
169 atf_set "descr" "Checks that RAID1 -c configurations work " \
170 "in the normal case"
171 atf_set "require.progs" "rump_server"
174 raid1_normal_body()
176 makecfg 1 2
177 export RUMP_SERVER=unix://sock
178 atf_check -s exit:0 ${raidserver} \
179 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
180 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
181 ${RUMP_SERVER}
183 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
184 atf_check -s exit:0 rump.raidctl -I 12345 raid0
185 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
187 # put some data there
188 atf_check -s exit:0 -e ignore \
189 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
190 atf_check -s exit:0 -e ignore -x \
191 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
193 # restart server, disks remain normal
194 rump.halt
196 atf_check -s exit:0 ${raidserver} \
197 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
198 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
199 ${RUMP_SERVER}
201 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
203 # check if we we get what we wrote
204 atf_check -s exit:0 -o file:testfile -e ignore \
205 rump.dd if=${rawraid} count=4
209 raid1_normal_cleanup()
211 export RUMP_SERVER=unix://sock
212 rump.halt
216 atf_test_case raid5_compfail cleanup
217 raid5_compfail_head()
219 atf_set "descr" "Checks that RAID5 works after component failure"
220 atf_set "require.progs" "rump_server"
223 raid5_compfail_body()
225 makecfg 5 3
226 export RUMP_SERVER=unix://sock
227 atf_check -s exit:0 ${raidserver} \
228 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
229 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
230 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
231 ${RUMP_SERVER}
233 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
234 atf_check -s exit:0 rump.raidctl -I 12345 raid0
235 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
237 # put some data there
238 atf_check -s exit:0 -e ignore \
239 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
240 atf_check -s exit:0 -e ignore -x \
241 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
243 # restart server with failed component
244 rump.halt
245 rm disk2.img # FAIL
246 atf_check -s exit:0 ${raidserver} \
247 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
248 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
249 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
250 ${RUMP_SERVER}
252 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
254 # check if we we get what we wrote
255 atf_check -s exit:0 -o file:testfile -e ignore \
256 rump.dd if=${rawraid} count=4
259 raid5_compfail_cleanup()
261 export RUMP_SERVER=unix://sock
262 rump.halt
265 atf_test_case raid5_normal cleanup
266 raid5_normal_head()
268 atf_set "descr" "Checks that RAID5 works after normal shutdown " \
269 "and 'raidctl -c' startup"
270 atf_set "require.progs" "rump_server"
273 raid5_normal_body()
275 makecfg 5 3
276 export RUMP_SERVER=unix://sock
277 atf_check -s exit:0 ${raidserver} \
278 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
279 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
280 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
281 ${RUMP_SERVER}
283 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
284 atf_check -s exit:0 rump.raidctl -I 12345 raid0
285 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
287 # put some data there
288 atf_check -s exit:0 -e ignore \
289 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
290 atf_check -s exit:0 -e ignore -x \
291 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
293 # restart server after normal shutdown
294 rump.halt
296 atf_check -s exit:0 ${raidserver} \
297 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
298 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
299 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
300 ${RUMP_SERVER}
302 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
304 # check if we we get what we wrote
305 atf_check -s exit:0 -o file:testfile -e ignore \
306 rump.dd if=${rawraid} count=4
309 raid5_normal_cleanup()
311 export RUMP_SERVER=unix://sock
312 rump.halt
315 atf_init_test_cases()
317 atf_add_test_case smalldisk
318 atf_add_test_case raid1_normal
319 atf_add_test_case raid1_comp0fail
320 atf_add_test_case raid1_compfail
321 atf_add_test_case raid5_normal
322 atf_add_test_case raid5_compfail