xref: /linux/tools/testing/selftests/ublk/test_stress_02.sh (revision 6f7e6393d1ce636bb7ec77a7fe7b77458fddf701)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5ERR_CODE=0
6
7if ! _have_program fio; then
8	exit "$UBLK_SKIP_CODE"
9fi
10
11ublk_io_and_kill_daemon()
12{
13	run_io_and_kill_daemon "$@"
14	ERR_CODE=$?
15	if [ ${ERR_CODE} -ne 0 ]; then
16		echo "$TID failure: $*"
17		_show_result $TID $ERR_CODE
18	fi
19}
20
21_prep_test "stress" "run IO and kill ublk server"
22
23_create_backfile 0 256M
24_create_backfile 1 128M
25_create_backfile 2 128M
26
27for nr_queue in 1 4; do
28	ublk_io_and_kill_daemon 8G -t null -q "$nr_queue" &
29	ublk_io_and_kill_daemon 256M -t loop -q "$nr_queue" "${UBLK_BACKFILES[0]}" &
30	ublk_io_and_kill_daemon 256M -t stripe -q "$nr_queue" "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
31	wait
32done
33
34_cleanup_test "stress"
35_show_result $TID $ERR_CODE
36