File tree Expand file tree Collapse file tree
tools/testing/selftests/ublk Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ __run_io_and_remove()
230230 local kill_server=$3
231231
232232 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 \
234234 --runtime=20 --time_based > /dev/null 2>&1 &
235235 sleep 2
236236 if [ " ${kill_server} " = " yes" ]; then
@@ -248,6 +248,38 @@ __run_io_and_remove()
248248 wait
249249}
250250
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+
251283_ublk_test_top_dir ()
252284{
253285 cd " $( dirname " $0 " ) " && pwd
Original file line number Diff line number Diff line change @@ -7,37 +7,28 @@ ERR_CODE=0
77
88ublk_io_and_remove ()
99{
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
2115 fi
2216}
2317
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 "
3020fi
3121
22+ _prep_test " stress" " run IO and remove device"
23+
3224_create_backfile 0 256M
25+ _create_backfile 1 128M
26+ _create_backfile 2 128M
3327
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
3932
40- ublk_io_and_remove 256M -t loop -q 4 -z " ${UBLK_BACKFILES[0]} "
41- ERR_CODE=$?
4233_cleanup_test " stress"
4334_show_result $TID $ERR_CODE
Original file line number Diff line number Diff line change 55TID=" stress_02"
66ERR_CODE=0
77
8+ if ! _have_program fio; then
9+ exit " $UBLK_SKIP_CODE "
10+ fi
11+
812ublk_io_and_kill_daemon ()
913{
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
2119 fi
2220}
2321
2422_prep_test " stress" " run IO and kill ublk server"
2523
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-
3224_create_backfile 0 256M
25+ _create_backfile 1 128M
26+ _create_backfile 2 128M
3327
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
3932
40- ublk_io_and_kill_daemon 256M -t loop -q 4 -z " ${UBLK_BACKFILES[0]} "
41- ERR_CODE=$?
4233_cleanup_test " stress"
4334_show_result $TID $ERR_CODE
You can’t perform that action at this time.
0 commit comments