xref: /linux/tools/testing/selftests/ublk/test_stress_04.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
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
23
24_prep_test "stress" "run IO and kill ublk server(zero copy)"
25
26_create_backfile 0 256M
27_create_backfile 1 128M
28_create_backfile 2 128M
29
30ublk_io_and_kill_daemon 8G -t null -q 4 -z --no_ublk_fixed_fd &
31ublk_io_and_kill_daemon 256M -t loop -q 4 -z --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" &
32ublk_io_and_kill_daemon 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
33wait
34
35if _have_feature "AUTO_BUF_REG"; then
36	ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc &
37	ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc "${UBLK_BACKFILES[0]}" &
38	ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --no_ublk_fixed_fd "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
39	ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback &
40	wait
41fi
42
43if _have_feature "PER_IO_DAEMON"; then
44	ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc --nthreads 8 --per_io_tasks &
45	ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
46	ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
47	ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback --nthreads 8 --per_io_tasks &
48	wait
49fi
50
51_cleanup_test "stress"
52_show_result $TID $ERR_CODE
53