xref: /linux/tools/testing/selftests/ublk/test_stress_07.sh (revision d8ba32c5a460837a5f0b9619dac99fafb6faef07)
1*63276182SCaleb Sander Mateos#!/bin/bash
2*63276182SCaleb Sander Mateos# SPDX-License-Identifier: GPL-2.0
3*63276182SCaleb Sander Mateos
4*63276182SCaleb Sander Mateos. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5*63276182SCaleb Sander MateosTID="stress_07"
6*63276182SCaleb Sander MateosERR_CODE=0
7*63276182SCaleb Sander Mateos
8*63276182SCaleb Sander Mateosublk_io_and_kill_daemon()
9*63276182SCaleb Sander Mateos{
10*63276182SCaleb Sander Mateos	run_io_and_kill_daemon "$@"
11*63276182SCaleb Sander Mateos	ERR_CODE=$?
12*63276182SCaleb Sander Mateos	if [ ${ERR_CODE} -ne 0 ]; then
13*63276182SCaleb Sander Mateos		echo "$TID failure: $*"
14*63276182SCaleb Sander Mateos		_show_result $TID $ERR_CODE
15*63276182SCaleb Sander Mateos	fi
16*63276182SCaleb Sander Mateos}
17*63276182SCaleb Sander Mateos
18*63276182SCaleb Sander Mateosif ! _have_program fio; then
19*63276182SCaleb Sander Mateos	exit "$UBLK_SKIP_CODE"
20*63276182SCaleb Sander Mateosfi
21*63276182SCaleb Sander Mateos
22*63276182SCaleb Sander Mateos_prep_test "stress" "run IO and kill ublk server (user copy)"
23*63276182SCaleb Sander Mateos
24*63276182SCaleb Sander Mateos_create_backfile 0 256M
25*63276182SCaleb Sander Mateos_create_backfile 1 128M
26*63276182SCaleb Sander Mateos_create_backfile 2 128M
27*63276182SCaleb Sander Mateos
28*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 8G -t null -q 4 -u --no_ublk_fixed_fd &
29*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 256M -t loop -q 4 -u --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" &
30*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
31*63276182SCaleb Sander Mateoswait
32*63276182SCaleb Sander Mateos
33*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 8G -t null -q 4 -u --nthreads 8 --per_io_tasks &
34*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
35*63276182SCaleb Sander Mateosublk_io_and_kill_daemon 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
36*63276182SCaleb Sander Mateoswait
37*63276182SCaleb Sander Mateos
38*63276182SCaleb Sander Mateos_cleanup_test "stress"
39*63276182SCaleb Sander Mateos_show_result $TID $ERR_CODE
40