mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
selftests: ublk: derive TID automatically from script name
Add automatic TID derivation in test_common.sh based on the script filename. The TID is extracted by stripping the "test_" prefix and ".sh" suffix from the script name (e.g., test_loop_01.sh -> loop_01). This removes the need for each test script to manually define TID, reducing boilerplate and preventing potential mismatches between the script name and TID. Scripts can still override TID after sourcing test_common.sh if needed. Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
8443e2087e
commit
3a4d8bed0b
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="batch_01"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "BATCH_IO"; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="batch_02"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "BATCH_IO"; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="batch_03"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "BATCH_IO"; then
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# Derive TID from script name: test_<type>_<num>.sh -> <type>_<num>
|
||||
# Can be overridden in test script after sourcing this file
|
||||
TID=$(basename "$0" .sh)
|
||||
TID=${TID#test_}
|
||||
|
||||
UBLK_SKIP_CODE=4
|
||||
|
||||
_have_program() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_01"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program bpftrace; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_02"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program bpftrace; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_03"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "null" "check dma & segment limits for zero copy"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_04"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_run_recover_test()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_05"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_run_recover_test()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_06"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "fault_inject" "fast cleanup when all I/Os of one hctx are in server"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_07"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_08"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "AUTO_BUF_REG"; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_09"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "AUTO_BUF_REG"; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_10"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_feature "UPDATE_SIZE"; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_11"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_run_quiesce_recover()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_12"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program bpftrace; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_13"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "null" "check that feature list is complete"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_14"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_run_recover_test()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_15"
|
||||
ERR_CODE=0
|
||||
|
||||
_test_partition_scan_no_hang()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="generic_16"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "null" "stop --safe command"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_01"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_02"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "loop" "mkfs & mount & umount"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_03"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_04"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "loop" "mkfs & mount & umount with zero copy"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_05"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_06"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="loop_07"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "loop" "mkfs & mount & umount with user copy"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ if [[ "$fio_version" =~ fio-[0-9]+\.[0-9]+$ ]]; then
|
|||
exit $UBLK_SKIP_CODE
|
||||
fi
|
||||
|
||||
TID=loop_08
|
||||
|
||||
_prep_test "loop" "end-to-end integrity"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="null_01"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="null_02"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="null_03"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID=null_04
|
||||
|
||||
_prep_test "null" "integrity params"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_01"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_remove()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_02"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_03"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_remove()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_04"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_kill_daemon()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_05"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_06"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_remove()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_07"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_kill_daemon()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_08"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_remove()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
TID="stress_09"
|
||||
ERR_CODE=0
|
||||
|
||||
ublk_io_and_kill_daemon()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_01"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_02"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "stripe" "mkfs & mount & umount"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_03"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_04"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "stripe" "mkfs & mount & umount on zero copy"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_05"
|
||||
ERR_CODE=0
|
||||
|
||||
if ! _have_program fio; then
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
|
||||
|
||||
TID="stripe_06"
|
||||
ERR_CODE=0
|
||||
|
||||
_prep_test "stripe" "mkfs & mount & umount on user copy"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user