1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5TID="stress_02"
6ERR_CODE=0
7
8if ! _have_program fio; then
9	exit "$UBLK_SKIP_CODE"
10fi
11
12ublk_io_and_kill_daemon()
13{
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
19	fi
20}
21
22_prep_test "stress" "run IO and kill ublk server"
23
24_create_backfile 0 256M
25_create_backfile 1 128M
26_create_backfile 2 128M
27
28ublk_io_and_kill_daemon 8G -t null -q 4 &
29ublk_io_and_kill_daemon 256M -t loop -q 4 "${UBLK_BACKFILES[0]}" &
30ublk_io_and_kill_daemon 256M -t stripe -q 4 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
31wait
32
33_cleanup_test "stress"
34_show_result $TID $ERR_CODE
35