Fri Jul 29 19:57:38 2011 UTC ()
Note that PR kern/44251 is fixed.
Add tests for normal configuration of RAID 1 and RAID 5 sets.


(oster)
diff -r1.8 -r1.9 src/tests/dev/raidframe/t_raid.sh

cvs diff -r1.8 -r1.9 src/tests/dev/raidframe/t_raid.sh (expand / switch to unified diff)

--- src/tests/dev/raidframe/t_raid.sh 2011/05/14 17:42:28 1.8
+++ src/tests/dev/raidframe/t_raid.sh 2011/07/29 19:57:38 1.9
@@ -1,14 +1,15 @@ @@ -1,14 +1,15 @@
1# $NetBSD: t_raid.sh,v 1.8 2011/05/14 17:42:28 jmmv Exp $ 1#! /usr/bin/atf-sh
 2# $NetBSD: t_raid.sh,v 1.9 2011/07/29 19:57:38 oster Exp $
2# 3#
3# Copyright (c) 2010 The NetBSD Foundation, Inc. 4# Copyright (c) 2010 The NetBSD Foundation, Inc.
4# All rights reserved. 5# All rights reserved.
5# 6#
6# Redistribution and use in source and binary forms, with or without 7# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions 8# modification, are permitted provided that the following conditions
8# are met: 9# are met:
9# 1. Redistributions of source code must retain the above copyright 10# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer. 11# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright 12# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the 13# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution. 14# documentation and/or other materials provided with the distribution.
14# 15#
@@ -115,60 +116,107 @@ raid1_compfail_body() @@ -115,60 +116,107 @@ raid1_compfail_body()
115} 116}
116 117
117raid1_compfail_cleanup() 118raid1_compfail_cleanup()
118{ 119{
119 export RUMP_SERVER=unix://sock 120 export RUMP_SERVER=unix://sock
120 rump.halt 121 rump.halt
121} 122}
122 123
123 124
124 125
125atf_test_case raid1_comp0fail cleanup 126atf_test_case raid1_comp0fail cleanup
126raid1_comp0fail_head() 127raid1_comp0fail_head()
127{ 128{
128 atf_set "descr" "Checks configuring RAID1 after component 0 fails" 129 atf_set "descr" "Checks configuring RAID1 after component 0 fails" \
 130 "(PR kern/44251)"
129} 131}
130 132
131raid1_comp0fail_body() 133raid1_comp0fail_body()
132{ 134{
133 makecfg 1 2 135 makecfg 1 2
134 export RUMP_SERVER=unix://sock 136 export RUMP_SERVER=unix://sock
135 atf_check -s exit:0 ${raidserver} \ 137 atf_check -s exit:0 ${raidserver} \
136 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ 138 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
137 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ 139 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
138 ${RUMP_SERVER} 140 ${RUMP_SERVER}
139 141
140 atf_check -s exit:0 rump.raidctl -C raid.conf raid0 142 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
141 atf_check -s exit:0 rump.raidctl -I 12345 raid0 143 atf_check -s exit:0 rump.raidctl -I 12345 raid0
142 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0 144 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
143 145
144 # restart server with failed component 146 # restart server with failed component
145 rump.halt 147 rump.halt
146 rm disk0.img # FAIL 148 rm disk0.img # FAIL
147 atf_check -s exit:0 ${raidserver} \ 149 atf_check -s exit:0 ${raidserver} \
148 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ 150 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
149 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ 151 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
150 ${RUMP_SERVER} 152 ${RUMP_SERVER}
151 153
152 atf_expect_fail "PR kern/44251" 
153 atf_check -s exit:0 rump.raidctl -c raid.conf raid0 154 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
154} 155}
155 156
156raid1_comp0fail_cleanup() 157raid1_comp0fail_cleanup()
157{ 158{
158 export RUMP_SERVER=unix://sock 159 export RUMP_SERVER=unix://sock
159 rump.halt 160 rump.halt
160} 161}
161 162
 163atf_test_case raid1_normal cleanup
 164raid1_normal_head()
 165{
 166 atf_set "descr" "Checks that RAID1 -c configurations work " \
 167 "in the normal case"
 168}
 169
 170raid1_normal_body()
 171{
 172 makecfg 1 2
 173 atf_check -s exit:0 ${raidserver} \
 174 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
 175 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
 176 ${RUMP_SERVER}
 177
 178 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
 179 atf_check -s exit:0 rump.raidctl -I 12345 raid0
 180 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
 181
 182 # put some data there
 183 atf_check -s exit:0 -e ignore \
 184 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
 185 atf_check -s exit:0 -e ignore -x \
 186 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
 187
 188 # restart server, disks remain normal
 189 rump.halt
 190
 191 atf_check -s exit:0 ${raidserver} \
 192 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
 193 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
 194 ${RUMP_SERVER}
 195
 196 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
 197
 198 # check if we we get what we wrote
 199 atf_check -s exit:0 -o file:testfile -e ignore \
 200 rump.dd if=${rawraid} count=4
 201
 202}
 203
 204raid1_comp0fail_cleanup()
 205{
 206 export RUMP_SERVER=unix://sock
 207 rump.halt
 208}
 209
162 210
163atf_test_case raid5_compfail cleanup 211atf_test_case raid5_compfail cleanup
164raid5_compfail_head() 212raid5_compfail_head()
165{ 213{
166 atf_set "descr" "Checks that RAID5 works after component failure" 214 atf_set "descr" "Checks that RAID5 works after component failure"
167} 215}
168 216
169raid5_compfail_body() 217raid5_compfail_body()
170{ 218{
171 makecfg 5 3 219 makecfg 5 3
172 export RUMP_SERVER=unix://sock 220 export RUMP_SERVER=unix://sock
173 atf_check -s exit:0 ${raidserver} \ 221 atf_check -s exit:0 ${raidserver} \
174 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ 222 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
@@ -198,21 +246,71 @@ raid5_compfail_body() @@ -198,21 +246,71 @@ raid5_compfail_body()
198 atf_check -s exit:0 rump.raidctl -c raid.conf raid0 246 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
199 247
200 # check if we we get what we wrote 248 # check if we we get what we wrote
201 atf_check -s exit:0 -o file:testfile -e ignore \ 249 atf_check -s exit:0 -o file:testfile -e ignore \
202 rump.dd if=${rawraid} count=4 250 rump.dd if=${rawraid} count=4
203} 251}
204 252
205raid5_compfail_cleanup() 253raid5_compfail_cleanup()
206{ 254{
207 export RUMP_SERVER=unix://sock 255 export RUMP_SERVER=unix://sock
208 rump.halt 256 rump.halt
209} 257}
210 258
 259atf_test_case raid5_normal cleanup
 260raid5_normal_head()
 261{
 262 atf_set "descr" "Checks that RAID5 works after normal shutdown " \
 263 "and 'raidctl -c' startup"
 264}
 265
 266raid5_normal_body()
 267{
 268 makecfg 5 3
 269 export RUMP_SERVER=unix://sock
 270 atf_check -s exit:0 ${raidserver} \
 271 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
 272 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
 273 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
 274 ${RUMP_SERVER}
 275
 276 atf_check -s exit:0 rump.raidctl -C raid.conf raid0
 277 atf_check -s exit:0 rump.raidctl -I 12345 raid0
 278 atf_check -s exit:0 -o ignore rump.raidctl -iv raid0
 279
 280 # put some data there
 281 atf_check -s exit:0 -e ignore \
 282 dd if=$(atf_get_srcdir)/t_raid of=testfile count=4
 283 atf_check -s exit:0 -e ignore -x \
 284 "dd if=testfile | rump.dd of=${rawraid} conv=sync"
 285
 286 # restart server after normal shutdown
 287 rump.halt
 288
 289 atf_check -s exit:0 ${raidserver} \
 290 -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \
 291 -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \
 292 -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \
 293 ${RUMP_SERVER}
 294
 295 atf_check -s exit:0 rump.raidctl -c raid.conf raid0
 296
 297 # check if we we get what we wrote
 298 atf_check -s exit:0 -o file:testfile -e ignore \
 299 rump.dd if=${rawraid} count=4
 300}
 301
 302raid5_normal_cleanup()
 303{
 304 export RUMP_SERVER=unix://sock
 305 rump.halt
 306}
211 307
212atf_init_test_cases() 308atf_init_test_cases()
213{ 309{
214 atf_add_test_case smalldisk 310 atf_add_test_case smalldisk
 311 atf_add_test_case raid1_normal
215 atf_add_test_case raid1_comp0fail 312 atf_add_test_case raid1_comp0fail
216 atf_add_test_case raid1_compfail 313 atf_add_test_case raid1_compfail
 314 atf_add_test_case raid5_normal
217 atf_add_test_case raid5_compfail 315 atf_add_test_case raid5_compfail
218} 316}