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