File tree Expand file tree Collapse file tree 3 files changed +63
-49
lines changed
tools/testing/selftests/ublk Expand file tree Collapse file tree 3 files changed +63
-49
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ __run_io_and_remove()
230
230
local kill_server=$3
231
231
232
232
fio --name=job1 --filename=/dev/ublkb" ${dev_id} " --ioengine=libaio \
233
- --rw=readwrite --iodepth=64 --size=" ${size} " --numjobs=4 \
233
+ --rw=readwrite --iodepth=256 --size=" ${size} " --numjobs=4 \
234
234
--runtime=20 --time_based > /dev/null 2>&1 &
235
235
sleep 2
236
236
if [ " ${kill_server} " = " yes" ]; then
@@ -248,6 +248,38 @@ __run_io_and_remove()
248
248
wait
249
249
}
250
250
251
+ run_io_and_remove ()
252
+ {
253
+ local size=$1
254
+ local dev_id
255
+ shift 1
256
+
257
+ dev_id=$( _add_ublk_dev " $@ " )
258
+ _check_add_dev " $TID " $?
259
+
260
+ [ " $UBLK_TEST_QUIET " -eq 0 ] && echo " run ublk IO vs. remove device(ublk add $* )"
261
+ if ! __run_io_and_remove " $dev_id " " ${size} " " no" ; then
262
+ echo " /dev/ublkc$dev_id isn't removed"
263
+ exit 255
264
+ fi
265
+ }
266
+
267
+ run_io_and_kill_daemon ()
268
+ {
269
+ local size=$1
270
+ local dev_id
271
+ shift 1
272
+
273
+ dev_id=$( _add_ublk_dev " $@ " )
274
+ _check_add_dev " $TID " $?
275
+
276
+ [ " $UBLK_TEST_QUIET " -eq 0 ] && echo " run ublk IO vs kill ublk server(ublk add $* )"
277
+ if ! __run_io_and_remove " $dev_id " " ${size} " " yes" ; then
278
+ echo " /dev/ublkc$dev_id isn't removed res ${res} "
279
+ exit 255
280
+ fi
281
+ }
282
+
251
283
_ublk_test_top_dir ()
252
284
{
253
285
cd " $( dirname " $0 " ) " && pwd
Original file line number Diff line number Diff line change @@ -7,37 +7,28 @@ ERR_CODE=0
7
7
8
8
ublk_io_and_remove ()
9
9
{
10
- local size=$1
11
- local dev_id
12
- shift 1
13
-
14
- dev_id=$( _add_ublk_dev " $@ " )
15
- _check_add_dev $TID $?
16
-
17
- [ " $UBLK_TEST_QUIET " -eq 0 ] && echo " run ublk IO vs. remove device(ublk add $* )"
18
- if ! __run_io_and_remove " $dev_id " " ${size} " " no" ; then
19
- echo " /dev/ublkc$dev_id isn't removed"
20
- exit 255
10
+ run_io_and_remove " $@ "
11
+ ERR_CODE=$?
12
+ if [ ${ERR_CODE} -ne 0 ]; then
13
+ echo " $TID failure: $* "
14
+ _show_result $TID $ERR_CODE
21
15
fi
22
16
}
23
17
24
- _prep_test " stress" " run IO and remove device"
25
-
26
- ublk_io_and_remove 8G -t null -q 4
27
- ERR_CODE=$?
28
- if [ ${ERR_CODE} -ne 0 ]; then
29
- _show_result $TID $ERR_CODE
18
+ if ! _have_program fio; then
19
+ exit " $UBLK_SKIP_CODE "
30
20
fi
31
21
22
+ _prep_test " stress" " run IO and remove device"
23
+
32
24
_create_backfile 0 256M
25
+ _create_backfile 1 128M
26
+ _create_backfile 2 128M
33
27
34
- ublk_io_and_remove 256M -t loop -q 4 " ${UBLK_BACKFILES[0]} "
35
- ERR_CODE=$?
36
- if [ ${ERR_CODE} -ne 0 ]; then
37
- _show_result $TID $ERR_CODE
38
- fi
28
+ ublk_io_and_remove 8G -t null -q 4 &
29
+ ublk_io_and_remove 256M -t loop -q 4 " ${UBLK_BACKFILES[0]} " &
30
+ ublk_io_and_remove 256M -t stripe -q 4 " ${UBLK_BACKFILES[1]} " " ${UBLK_BACKFILES[2]} " &
31
+ wait
39
32
40
- ublk_io_and_remove 256M -t loop -q 4 -z " ${UBLK_BACKFILES[0]} "
41
- ERR_CODE=$?
42
33
_cleanup_test " stress"
43
34
_show_result $TID $ERR_CODE
Original file line number Diff line number Diff line change 5
5
TID=" stress_02"
6
6
ERR_CODE=0
7
7
8
+ if ! _have_program fio; then
9
+ exit " $UBLK_SKIP_CODE "
10
+ fi
11
+
8
12
ublk_io_and_kill_daemon ()
9
13
{
10
- local size=$1
11
- local dev_id
12
- shift 1
13
-
14
- dev_id=$( _add_ublk_dev " $@ " )
15
- _check_add_dev $TID $?
16
-
17
- [ " $UBLK_TEST_QUIET " -eq 0 ] && echo " run ublk IO vs kill ublk server(ublk add $* )"
18
- if ! __run_io_and_remove " $dev_id " " ${size} " " yes" ; then
19
- echo " /dev/ublkc$dev_id isn't removed res ${res} "
20
- exit 255
14
+ run_io_and_kill_daemon " $@ "
15
+ ERR_CODE=$?
16
+ if [ ${ERR_CODE} -ne 0 ]; then
17
+ echo " $TID failure: $* "
18
+ _show_result $TID $ERR_CODE
21
19
fi
22
20
}
23
21
24
22
_prep_test " stress" " run IO and kill ublk server"
25
23
26
- ublk_io_and_kill_daemon 8G -t null -q 4
27
- ERR_CODE=$?
28
- if [ ${ERR_CODE} -ne 0 ]; then
29
- _show_result $TID $ERR_CODE
30
- fi
31
-
32
24
_create_backfile 0 256M
25
+ _create_backfile 1 128M
26
+ _create_backfile 2 128M
33
27
34
- ublk_io_and_kill_daemon 256M -t loop -q 4 " ${UBLK_BACKFILES[0]} "
35
- ERR_CODE=$?
36
- if [ ${ERR_CODE} -ne 0 ]; then
37
- _show_result $TID $ERR_CODE
38
- fi
28
+ ublk_io_and_kill_daemon 8G -t null -q 4 &
29
+ ublk_io_and_kill_daemon 256M -t loop -q 4 " ${UBLK_BACKFILES[0]} " &
30
+ ublk_io_and_kill_daemon 256M -t stripe -q 4 " ${UBLK_BACKFILES[1]} " " ${UBLK_BACKFILES[2]} " &
31
+ wait
39
32
40
- ublk_io_and_kill_daemon 256M -t loop -q 4 -z " ${UBLK_BACKFILES[0]} "
41
- ERR_CODE=$?
42
33
_cleanup_test " stress"
43
34
_show_result $TID $ERR_CODE
You can’t perform that action at this time.
0 commit comments