xref: /linux/tools/testing/selftests/ublk/test_stress_06.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_remove()
8{
9	run_io_and_remove "$@"
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
20
21_prep_test "stress" "run IO and remove device (user copy)"
22
23_create_backfile 0 256M
24_create_backfile 1 128M
25_create_backfile 2 128M
26
27ublk_io_and_remove 8G -t null -q 4 -u &
28ublk_io_and_remove 256M -t loop -q 4 -u "${UBLK_BACKFILES[0]}" &
29ublk_io_and_remove 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
30wait
31
32ublk_io_and_remove 8G -t null -q 4 -u --nthreads 8 --per_io_tasks &
33ublk_io_and_remove 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
34ublk_io_and_remove 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
35wait
36
37_cleanup_test "stress"
38_show_result $TID $ERR_CODE
39