linux/tools/testing/selftests/ublk/test_generic_09.sh
Ming Lei 6f1a182a87 selftests: ublk: add test for covering UBLK_AUTO_BUF_REG_FALLBACK
Add test for covering UBLK_AUTO_BUF_REG_FALLBACK:

- pass '--auto_zc_fallback' to null target, which requires both F_AUTO_BUF_REG
and F_SUPPORT_ZERO_COPY for handling UBLK_AUTO_BUF_REG_FALLBACK

- add ->buf_index() method for returning invalid buffer index to trigger
UBLK_AUTO_BUF_REG_FALLBACK

- add generic_09 for running the test

- add --auto_zc_fallback test in stress_03/stress_04/stress_05

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250520045455.515691-7-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-05-20 10:24:45 -06:00

28 lines
592 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
TID="generic_09"
ERR_CODE=0
if ! _have_feature "AUTO_BUF_REG"; then
exit "$UBLK_SKIP_CODE"
fi
if ! _have_program fio; then
exit "$UBLK_SKIP_CODE"
fi
_prep_test "null" "basic IO test"
dev_id=$(_add_ublk_dev -t null -z --auto_zc --auto_zc_fallback)
_check_add_dev $TID $?
# run fio over the two disks
fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio --rw=readwrite --iodepth=32 --size=256M > /dev/null 2>&1
ERR_CODE=$?
_cleanup_test "null"
_show_result $TID $ERR_CODE