File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed
tools/testing/selftests/ublk Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ TEST_PROGS += test_stress_01.sh
25
25
TEST_PROGS += test_stress_02.sh
26
26
TEST_PROGS += test_stress_03.sh
27
27
TEST_PROGS += test_stress_04.sh
28
+ TEST_PROGS += test_stress_05.sh
28
29
29
30
TEST_GEN_PROGS_EXTENDED = kublk
30
31
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # SPDX-License-Identifier: GPL-2.0
3
+
4
+ . " $( cd " $( dirname " $0 " ) " && pwd) " /test_common.sh
5
+ TID=" stress_05"
6
+ ERR_CODE=0
7
+
8
+ run_io_and_remove ()
9
+ {
10
+ local size=$1
11
+ local dev_id
12
+ local dev_pid
13
+ shift 1
14
+
15
+ dev_id=$( _add_ublk_dev " $@ " )
16
+ _check_add_dev $TID $?
17
+
18
+ [ " $UBLK_TEST_QUIET " -eq 0 ] && echo " run ublk IO vs. remove device(ublk add $* )"
19
+
20
+ fio --name=job1 --filename=/dev/ublkb" ${dev_id} " --ioengine=libaio \
21
+ --rw=readwrite --iodepth=128 --size=" ${size} " --numjobs=4 \
22
+ --runtime=40 --time_based > /dev/null 2>&1 &
23
+ sleep 4
24
+
25
+ dev_pid=$( _get_ublk_daemon_pid " $dev_id " )
26
+ kill -9 " $dev_pid "
27
+
28
+ if ! __remove_ublk_dev_return " ${dev_id} " ; then
29
+ echo " delete dev ${dev_id} failed"
30
+ return 255
31
+ fi
32
+ }
33
+
34
+ ublk_io_and_remove ()
35
+ {
36
+ run_io_and_remove " $@ "
37
+ ERR_CODE=$?
38
+ if [ ${ERR_CODE} -ne 0 ]; then
39
+ echo " $TID failure: $* "
40
+ _show_result $TID $ERR_CODE
41
+ fi
42
+ }
43
+
44
+ _prep_test " stress" " run IO and remove device with recovery enabled"
45
+
46
+ _create_backfile 0 256M
47
+ _create_backfile 1 256M
48
+
49
+ for reissue in $( seq 0 1) ; do
50
+ ublk_io_and_remove 8G -t null -q 4 -g 1 -r 1 -i " $reissue " &
51
+ ublk_io_and_remove 256M -t loop -q 4 -g 1 -r 1 -i " $reissue " " ${UBLK_BACKFILES[0]} " &
52
+ wait
53
+ done
54
+
55
+ if _have_feature " ZERO_COPY" ; then
56
+ for reissue in $( seq 0 1) ; do
57
+ ublk_io_and_remove 8G -t null -q 4 -g 1 -z -r 1 -i " $reissue " &
58
+ ublk_io_and_remove 256M -t loop -q 4 -g 1 -z -r 1 -i " $reissue " " ${UBLK_BACKFILES[1]} " &
59
+ wait
60
+ done
61
+ fi
62
+
63
+ _cleanup_test " stress"
64
+ _show_result $TID $ERR_CODE
You can’t perform that action at this time.
0 commit comments