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