* [PATCH 0/5] ublk: misc improvement in driver and selftests
@ 2026-01-29 3:14 Ming Lei
2026-01-29 3:14 ` [PATCH 1/5] ublk: check list membership before cancelling batch fetch command Ming Lei
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw)
To: Jens Axboe, linux-block
Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei
Hi Jens,
The 1st patch improves fetch command removal and canceling, which is
reported as risk from AI.
The 2nd patch adds UBLK_F_NO_AUTO_PART_SCAN for disabling partition
scanning during adding disk.
The 3rd patch cleans up selftests by deriving TID automatically.
The 4th patch marks each test start and end in dmesg.
The last patch adds test case for UBLK_F_NO_AUTO_PART_SCAN.
Thanks,
Alexander Atanasov (1):
selftests: ublk: mark each test start and end time in dmesg
Ming Lei (4):
ublk: check list membership before cancelling batch fetch command
ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag
selftests: ublk: derive TID automatically from script name
selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN
drivers/block/ublk_drv.c | 23 +++-
include/uapi/linux/ublk_cmd.h | 3 +
tools/testing/selftests/ublk/Makefile | 2 +
tools/testing/selftests/ublk/kublk.c | 6 +-
tools/testing/selftests/ublk/kublk.h | 3 +-
tools/testing/selftests/ublk/test_batch_01.sh | 1 -
tools/testing/selftests/ublk/test_batch_02.sh | 1 -
tools/testing/selftests/ublk/test_batch_03.sh | 1 -
tools/testing/selftests/ublk/test_common.sh | 6 +
.../testing/selftests/ublk/test_generic_01.sh | 1 -
.../testing/selftests/ublk/test_generic_02.sh | 1 -
.../testing/selftests/ublk/test_generic_03.sh | 1 -
.../testing/selftests/ublk/test_generic_04.sh | 1 -
.../testing/selftests/ublk/test_generic_05.sh | 1 -
.../testing/selftests/ublk/test_generic_06.sh | 1 -
.../testing/selftests/ublk/test_generic_07.sh | 1 -
.../testing/selftests/ublk/test_generic_08.sh | 1 -
.../testing/selftests/ublk/test_generic_09.sh | 1 -
.../testing/selftests/ublk/test_generic_10.sh | 1 -
.../testing/selftests/ublk/test_generic_11.sh | 1 -
.../testing/selftests/ublk/test_generic_12.sh | 1 -
.../testing/selftests/ublk/test_generic_13.sh | 1 -
.../testing/selftests/ublk/test_generic_14.sh | 1 -
.../testing/selftests/ublk/test_generic_15.sh | 1 -
.../testing/selftests/ublk/test_generic_16.sh | 1 -
tools/testing/selftests/ublk/test_loop_01.sh | 1 -
tools/testing/selftests/ublk/test_loop_02.sh | 1 -
tools/testing/selftests/ublk/test_loop_03.sh | 1 -
tools/testing/selftests/ublk/test_loop_04.sh | 1 -
tools/testing/selftests/ublk/test_loop_05.sh | 1 -
tools/testing/selftests/ublk/test_loop_06.sh | 1 -
tools/testing/selftests/ublk/test_loop_07.sh | 1 -
tools/testing/selftests/ublk/test_loop_08.sh | 1 -
tools/testing/selftests/ublk/test_null_01.sh | 1 -
tools/testing/selftests/ublk/test_null_02.sh | 1 -
tools/testing/selftests/ublk/test_null_03.sh | 1 -
tools/testing/selftests/ublk/test_null_04.sh | 1 -
tools/testing/selftests/ublk/test_part_01.sh | 104 ++++++++++++++++++
.../testing/selftests/ublk/test_stress_01.sh | 1 -
.../testing/selftests/ublk/test_stress_02.sh | 1 -
.../testing/selftests/ublk/test_stress_03.sh | 1 -
.../testing/selftests/ublk/test_stress_04.sh | 1 -
.../testing/selftests/ublk/test_stress_05.sh | 1 -
.../testing/selftests/ublk/test_stress_06.sh | 1 -
.../testing/selftests/ublk/test_stress_07.sh | 1 -
.../testing/selftests/ublk/test_stress_08.sh | 1 -
.../testing/selftests/ublk/test_stress_09.sh | 1 -
.../testing/selftests/ublk/test_stripe_01.sh | 1 -
.../testing/selftests/ublk/test_stripe_02.sh | 1 -
.../testing/selftests/ublk/test_stripe_03.sh | 1 -
.../testing/selftests/ublk/test_stripe_04.sh | 1 -
.../testing/selftests/ublk/test_stripe_05.sh | 1 -
.../testing/selftests/ublk/test_stripe_06.sh | 1 -
53 files changed, 141 insertions(+), 52 deletions(-)
create mode 100755 tools/testing/selftests/ublk/test_part_01.sh
--
2.47.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/5] ublk: check list membership before cancelling batch fetch command 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei @ 2026-01-29 3:14 ` Ming Lei 2026-01-29 3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei ` (3 subsequent siblings) 4 siblings, 0 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw) To: Jens Axboe, linux-block Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei Add !list_empty(&fcmd->node) check in ublk_batch_cancel_cmd() to ensure the fcmd hasn't already been removed from the list. Once an fcmd is removed from the list, it's considered claimed by whoever removed it and will be freed by that path. Meantime switch to list_del_init() for deleting it from list. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/block/ublk_drv.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 8a5a6ba29a1d..94470a2ec05e 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -738,7 +738,7 @@ static void ublk_batch_deinit_fetch_buf(struct ublk_queue *ubq, int res) { spin_lock(&ubq->evts_lock); - list_del(&fcmd->node); + list_del_init(&fcmd->node); WARN_ON_ONCE(fcmd != ubq->active_fcmd); __ublk_release_fcmd(ubq); spin_unlock(&ubq->evts_lock); @@ -2693,6 +2693,16 @@ static void ublk_cancel_cmd(struct ublk_queue *ubq, unsigned tag, io_uring_cmd_done(io->cmd, UBLK_IO_RES_ABORT, issue_flags); } +/* + * Cancel a batch fetch command if it hasn't been claimed by another path. + * + * An fcmd can only be cancelled if: + * 1. It's not the active_fcmd (which is currently being processed) + * 2. It's still on the list (!list_empty check) - once removed from the list, + * the fcmd is considered claimed and will be freed by whoever removed it + * + * Use list_del_init() so subsequent list_empty() checks work correctly. + */ static void ublk_batch_cancel_cmd(struct ublk_queue *ubq, struct ublk_batch_fetch_cmd *fcmd, unsigned int issue_flags) @@ -2700,9 +2710,9 @@ static void ublk_batch_cancel_cmd(struct ublk_queue *ubq, bool done; spin_lock(&ubq->evts_lock); - done = (READ_ONCE(ubq->active_fcmd) != fcmd); + done = (READ_ONCE(ubq->active_fcmd) != fcmd) && !list_empty(&fcmd->node); if (done) - list_del(&fcmd->node); + list_del_init(&fcmd->node); spin_unlock(&ubq->evts_lock); if (done) { -- 2.47.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei 2026-01-29 3:14 ` [PATCH 1/5] ublk: check list membership before cancelling batch fetch command Ming Lei @ 2026-01-29 3:14 ` Ming Lei 2026-01-29 4:44 ` Caleb Sander Mateos 2026-01-29 5:45 ` Alexander Atanasov 2026-01-29 3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei ` (2 subsequent siblings) 4 siblings, 2 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw) To: Jens Axboe, linux-block Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei, Yoav Cohen Add a new feature flag UBLK_F_NO_AUTO_PART_SCAN to allow users to suppress automatic partition scanning when starting a ublk device. This is useful for some cases in which use don't want to scan partitions. Users still can manually trigger partition scanning later when appropriate using standard tools (e.g., partprobe, blockdev --rereadpt). Reported-by: Yoav Cohen <yoav@nvidia.com> Link: https://lore.kernel.org/linux-block/DM4PR12MB63280C5637917C071C2F0D65A9A8A@DM4PR12MB6328.namprd12.prod.outlook.com/ Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/block/ublk_drv.c | 7 ++++++- include/uapi/linux/ublk_cmd.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 94470a2ec05e..0b98ab0f8257 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -80,7 +80,8 @@ | UBLK_F_BUF_REG_OFF_DAEMON \ | (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ? UBLK_F_INTEGRITY : 0) \ | UBLK_F_SAFE_STOP_DEV \ - | UBLK_F_BATCH_IO) + | UBLK_F_BATCH_IO \ + | UBLK_F_NO_AUTO_PART_SCAN) #define UBLK_F_ALL_RECOVERY_FLAGS (UBLK_F_USER_RECOVERY \ | UBLK_F_USER_RECOVERY_REISSUE \ @@ -2364,6 +2365,10 @@ static void ublk_partition_scan_work(struct work_struct *work) &disk->state))) goto out; + /* Skip partition scan if disabled by user */ + if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN) + goto out; + mutex_lock(&disk->open_mutex); bdev_disk_changed(disk, false); mutex_unlock(&disk->open_mutex); diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h index 743d31491387..a88876756805 100644 --- a/include/uapi/linux/ublk_cmd.h +++ b/include/uapi/linux/ublk_cmd.h @@ -367,6 +367,9 @@ */ #define UBLK_F_SAFE_STOP_DEV (1ULL << 17) +/* Disable automatic partition scanning when device is started */ +#define UBLK_F_NO_AUTO_PART_SCAN (1ULL << 18) + /* device state */ #define UBLK_S_DEV_DEAD 0 #define UBLK_S_DEV_LIVE 1 -- 2.47.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag 2026-01-29 3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei @ 2026-01-29 4:44 ` Caleb Sander Mateos 2026-01-29 8:21 ` Ming Lei 2026-01-29 5:45 ` Alexander Atanasov 1 sibling, 1 reply; 12+ messages in thread From: Caleb Sander Mateos @ 2026-01-29 4:44 UTC (permalink / raw) To: Ming Lei Cc: Jens Axboe, linux-block, Uday Shankar, Alexander Atanasov, Yoav Cohen On Wed, Jan 28, 2026 at 7:15 PM Ming Lei <ming.lei@redhat.com> wrote: > > Add a new feature flag UBLK_F_NO_AUTO_PART_SCAN to allow users to suppress > automatic partition scanning when starting a ublk device. > > This is useful for some cases in which use don't want to scan > partitions. > > Users still can manually trigger partition scanning later when appropriate > using standard tools (e.g., partprobe, blockdev --rereadpt). > > Reported-by: Yoav Cohen <yoav@nvidia.com> > Link: https://lore.kernel.org/linux-block/DM4PR12MB63280C5637917C071C2F0D65A9A8A@DM4PR12MB6328.namprd12.prod.outlook.com/ > Signed-off-by: Ming Lei <ming.lei@redhat.com> > --- > drivers/block/ublk_drv.c | 7 ++++++- > include/uapi/linux/ublk_cmd.h | 3 +++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > index 94470a2ec05e..0b98ab0f8257 100644 > --- a/drivers/block/ublk_drv.c > +++ b/drivers/block/ublk_drv.c > @@ -80,7 +80,8 @@ > | UBLK_F_BUF_REG_OFF_DAEMON \ > | (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ? UBLK_F_INTEGRITY : 0) \ > | UBLK_F_SAFE_STOP_DEV \ > - | UBLK_F_BATCH_IO) > + | UBLK_F_BATCH_IO \ > + | UBLK_F_NO_AUTO_PART_SCAN) > > #define UBLK_F_ALL_RECOVERY_FLAGS (UBLK_F_USER_RECOVERY \ > | UBLK_F_USER_RECOVERY_REISSUE \ > @@ -2364,6 +2365,10 @@ static void ublk_partition_scan_work(struct work_struct *work) > &disk->state))) > goto out; > > + /* Skip partition scan if disabled by user */ > + if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN) > + goto out; Seems like it's not necessary to schedule ublk_partition_scan_work() in this case? Could just clear_bit(GD_SUPPRESS_PART_SCAN, &disk->state) in ublk_ctrl_start_dev()? Is it actually necessary to clear GD_SUPPRESS_PART_SCAN at all? Does that flag block partprobe too? Best, Caleb > + > mutex_lock(&disk->open_mutex); > bdev_disk_changed(disk, false); > mutex_unlock(&disk->open_mutex); > diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h > index 743d31491387..a88876756805 100644 > --- a/include/uapi/linux/ublk_cmd.h > +++ b/include/uapi/linux/ublk_cmd.h > @@ -367,6 +367,9 @@ > */ > #define UBLK_F_SAFE_STOP_DEV (1ULL << 17) > > +/* Disable automatic partition scanning when device is started */ > +#define UBLK_F_NO_AUTO_PART_SCAN (1ULL << 18) > + > /* device state */ > #define UBLK_S_DEV_DEAD 0 > #define UBLK_S_DEV_LIVE 1 > -- > 2.47.0 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag 2026-01-29 4:44 ` Caleb Sander Mateos @ 2026-01-29 8:21 ` Ming Lei 0 siblings, 0 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 8:21 UTC (permalink / raw) To: Caleb Sander Mateos Cc: Jens Axboe, linux-block, Uday Shankar, Alexander Atanasov, Yoav Cohen On Wed, Jan 28, 2026 at 08:44:58PM -0800, Caleb Sander Mateos wrote: > On Wed, Jan 28, 2026 at 7:15 PM Ming Lei <ming.lei@redhat.com> wrote: > > > > Add a new feature flag UBLK_F_NO_AUTO_PART_SCAN to allow users to suppress > > automatic partition scanning when starting a ublk device. > > > > This is useful for some cases in which use don't want to scan > > partitions. > > > > Users still can manually trigger partition scanning later when appropriate > > using standard tools (e.g., partprobe, blockdev --rereadpt). > > > > Reported-by: Yoav Cohen <yoav@nvidia.com> > > Link: https://lore.kernel.org/linux-block/DM4PR12MB63280C5637917C071C2F0D65A9A8A@DM4PR12MB6328.namprd12.prod.outlook.com/ > > Signed-off-by: Ming Lei <ming.lei@redhat.com> > > --- > > drivers/block/ublk_drv.c | 7 ++++++- > > include/uapi/linux/ublk_cmd.h | 3 +++ > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > > index 94470a2ec05e..0b98ab0f8257 100644 > > --- a/drivers/block/ublk_drv.c > > +++ b/drivers/block/ublk_drv.c > > @@ -80,7 +80,8 @@ > > | UBLK_F_BUF_REG_OFF_DAEMON \ > > | (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ? UBLK_F_INTEGRITY : 0) \ > > | UBLK_F_SAFE_STOP_DEV \ > > - | UBLK_F_BATCH_IO) > > + | UBLK_F_BATCH_IO \ > > + | UBLK_F_NO_AUTO_PART_SCAN) > > > > #define UBLK_F_ALL_RECOVERY_FLAGS (UBLK_F_USER_RECOVERY \ > > | UBLK_F_USER_RECOVERY_REISSUE \ > > @@ -2364,6 +2365,10 @@ static void ublk_partition_scan_work(struct work_struct *work) > > &disk->state))) > > goto out; > > > > + /* Skip partition scan if disabled by user */ > > + if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN) > > + goto out; > > Seems like it's not necessary to schedule ublk_partition_scan_work() > in this case? Could just clear_bit(GD_SUPPRESS_PART_SCAN, > &disk->state) in ublk_ctrl_start_dev()? OK, we can do it by saving one time of wq schedule. > Is it actually necessary to clear GD_SUPPRESS_PART_SCAN at all? Does > that flag block partprobe too? Yes, the flag is totally controlled by user side. Thanks, Ming ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag 2026-01-29 3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei 2026-01-29 4:44 ` Caleb Sander Mateos @ 2026-01-29 5:45 ` Alexander Atanasov 1 sibling, 0 replies; 12+ messages in thread From: Alexander Atanasov @ 2026-01-29 5:45 UTC (permalink / raw) To: Ming Lei Cc: Jens Axboe, linux-block, Caleb Sander Mateos, Uday Shankar, Yoav Cohen > On 29 Jan 2026, at 5:14, Ming Lei <ming.lei@redhat.com> wrote: > > Add a new feature flag UBLK_F_NO_AUTO_PART_SCAN to allow users to suppress > automatic partition scanning when starting a ublk device. > > This is useful for some cases in which use don't want to scan > partitions. s/in which use/in which user/ have fun, alex ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/5] selftests: ublk: derive TID automatically from script name 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei 2026-01-29 3:14 ` [PATCH 1/5] ublk: check list membership before cancelling batch fetch command Ming Lei 2026-01-29 3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei @ 2026-01-29 3:14 ` Ming Lei 2026-01-29 4:46 ` Caleb Sander Mateos 2026-01-29 9:50 ` Alexander Atanasov 2026-01-29 3:14 ` [PATCH 4/5] selftests: ublk: mark each test start and end time in dmesg Ming Lei 2026-01-29 3:14 ` [PATCH 5/5] selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN Ming Lei 4 siblings, 2 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw) To: Jens Axboe, linux-block Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei 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. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- tools/testing/selftests/ublk/test_batch_01.sh | 1 - tools/testing/selftests/ublk/test_batch_02.sh | 1 - tools/testing/selftests/ublk/test_batch_03.sh | 1 - tools/testing/selftests/ublk/test_common.sh | 4 ++++ tools/testing/selftests/ublk/test_generic_01.sh | 1 - tools/testing/selftests/ublk/test_generic_02.sh | 1 - tools/testing/selftests/ublk/test_generic_03.sh | 1 - tools/testing/selftests/ublk/test_generic_04.sh | 1 - tools/testing/selftests/ublk/test_generic_05.sh | 1 - tools/testing/selftests/ublk/test_generic_06.sh | 1 - tools/testing/selftests/ublk/test_generic_07.sh | 1 - tools/testing/selftests/ublk/test_generic_08.sh | 1 - tools/testing/selftests/ublk/test_generic_09.sh | 1 - tools/testing/selftests/ublk/test_generic_10.sh | 1 - tools/testing/selftests/ublk/test_generic_11.sh | 1 - tools/testing/selftests/ublk/test_generic_12.sh | 1 - tools/testing/selftests/ublk/test_generic_13.sh | 1 - tools/testing/selftests/ublk/test_generic_14.sh | 1 - tools/testing/selftests/ublk/test_generic_15.sh | 1 - tools/testing/selftests/ublk/test_generic_16.sh | 1 - tools/testing/selftests/ublk/test_loop_01.sh | 1 - tools/testing/selftests/ublk/test_loop_02.sh | 1 - tools/testing/selftests/ublk/test_loop_03.sh | 1 - tools/testing/selftests/ublk/test_loop_04.sh | 1 - tools/testing/selftests/ublk/test_loop_05.sh | 1 - tools/testing/selftests/ublk/test_loop_06.sh | 1 - tools/testing/selftests/ublk/test_loop_07.sh | 1 - tools/testing/selftests/ublk/test_loop_08.sh | 1 - tools/testing/selftests/ublk/test_null_01.sh | 1 - tools/testing/selftests/ublk/test_null_02.sh | 1 - tools/testing/selftests/ublk/test_null_03.sh | 1 - tools/testing/selftests/ublk/test_null_04.sh | 1 - tools/testing/selftests/ublk/test_stress_01.sh | 1 - tools/testing/selftests/ublk/test_stress_02.sh | 1 - tools/testing/selftests/ublk/test_stress_03.sh | 1 - tools/testing/selftests/ublk/test_stress_04.sh | 1 - tools/testing/selftests/ublk/test_stress_05.sh | 1 - tools/testing/selftests/ublk/test_stress_06.sh | 1 - tools/testing/selftests/ublk/test_stress_07.sh | 1 - tools/testing/selftests/ublk/test_stress_08.sh | 1 - tools/testing/selftests/ublk/test_stress_09.sh | 1 - tools/testing/selftests/ublk/test_stripe_01.sh | 1 - tools/testing/selftests/ublk/test_stripe_02.sh | 1 - tools/testing/selftests/ublk/test_stripe_03.sh | 1 - tools/testing/selftests/ublk/test_stripe_04.sh | 1 - tools/testing/selftests/ublk/test_stripe_05.sh | 1 - tools/testing/selftests/ublk/test_stripe_06.sh | 1 - 47 files changed, 4 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/ublk/test_batch_01.sh b/tools/testing/selftests/ublk/test_batch_01.sh index 9fa9fff5c62f..a18fb39af8be 100755 --- a/tools/testing/selftests/ublk/test_batch_01.sh +++ b/tools/testing/selftests/ublk/test_batch_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="batch_01" ERR_CODE=0 if ! _have_feature "BATCH_IO"; then diff --git a/tools/testing/selftests/ublk/test_batch_02.sh b/tools/testing/selftests/ublk/test_batch_02.sh index b477f91359e1..7ca384d11987 100755 --- a/tools/testing/selftests/ublk/test_batch_02.sh +++ b/tools/testing/selftests/ublk/test_batch_02.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="batch_02" ERR_CODE=0 if ! _have_feature "BATCH_IO"; then diff --git a/tools/testing/selftests/ublk/test_batch_03.sh b/tools/testing/selftests/ublk/test_batch_03.sh index 13a2b3d3a1b9..aca9cf144b55 100755 --- a/tools/testing/selftests/ublk/test_batch_03.sh +++ b/tools/testing/selftests/ublk/test_batch_03.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="batch_03" ERR_CODE=0 if ! _have_feature "BATCH_IO"; then diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh index 7ff6ce79d62c..687884cbaec1 100755 --- a/tools/testing/selftests/ublk/test_common.sh +++ b/tools/testing/selftests/ublk/test_common.sh @@ -1,6 +1,10 @@ #!/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 | sed 's/^test_//') + UBLK_SKIP_CODE=4 _have_program() { diff --git a/tools/testing/selftests/ublk/test_generic_01.sh b/tools/testing/selftests/ublk/test_generic_01.sh index 21a31cd5491a..26cf3c7ceeb5 100755 --- a/tools/testing/selftests/ublk/test_generic_01.sh +++ b/tools/testing/selftests/ublk/test_generic_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_01" ERR_CODE=0 if ! _have_program bpftrace; then diff --git a/tools/testing/selftests/ublk/test_generic_02.sh b/tools/testing/selftests/ublk/test_generic_02.sh index 12920768b1a0..1d4b1d6e059c 100755 --- a/tools/testing/selftests/ublk/test_generic_02.sh +++ b/tools/testing/selftests/ublk/test_generic_02.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_02" ERR_CODE=0 if ! _have_program bpftrace; then diff --git a/tools/testing/selftests/ublk/test_generic_03.sh b/tools/testing/selftests/ublk/test_generic_03.sh index b551aa76cb0d..8934ea926762 100755 --- a/tools/testing/selftests/ublk/test_generic_03.sh +++ b/tools/testing/selftests/ublk/test_generic_03.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_generic_04.sh b/tools/testing/selftests/ublk/test_generic_04.sh index be2292822bbe..2672f9c40fa8 100755 --- a/tools/testing/selftests/ublk/test_generic_04.sh +++ b/tools/testing/selftests/ublk/test_generic_04.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_04" ERR_CODE=0 ublk_run_recover_test() diff --git a/tools/testing/selftests/ublk/test_generic_05.sh b/tools/testing/selftests/ublk/test_generic_05.sh index 9b7f71c16d82..bda5064bc31f 100755 --- a/tools/testing/selftests/ublk/test_generic_05.sh +++ b/tools/testing/selftests/ublk/test_generic_05.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_05" ERR_CODE=0 ublk_run_recover_test() diff --git a/tools/testing/selftests/ublk/test_generic_06.sh b/tools/testing/selftests/ublk/test_generic_06.sh index fd42062b7b76..14a05054fcd8 100755 --- a/tools/testing/selftests/ublk/test_generic_06.sh +++ b/tools/testing/selftests/ublk/test_generic_06.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_generic_07.sh b/tools/testing/selftests/ublk/test_generic_07.sh index cba86451fa5e..8dcfd8978f50 100755 --- a/tools/testing/selftests/ublk/test_generic_07.sh +++ b/tools/testing/selftests/ublk/test_generic_07.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_07" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_generic_08.sh b/tools/testing/selftests/ublk/test_generic_08.sh index b222f3a77e12..ce88c31d6b9c 100755 --- a/tools/testing/selftests/ublk/test_generic_08.sh +++ b/tools/testing/selftests/ublk/test_generic_08.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_08" ERR_CODE=0 if ! _have_feature "AUTO_BUF_REG"; then diff --git a/tools/testing/selftests/ublk/test_generic_09.sh b/tools/testing/selftests/ublk/test_generic_09.sh index bb6f77ca5522..744d0cdaa242 100755 --- a/tools/testing/selftests/ublk/test_generic_09.sh +++ b/tools/testing/selftests/ublk/test_generic_09.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_09" ERR_CODE=0 if ! _have_feature "AUTO_BUF_REG"; then diff --git a/tools/testing/selftests/ublk/test_generic_10.sh b/tools/testing/selftests/ublk/test_generic_10.sh index abc11c3d416b..4b4293b9081f 100755 --- a/tools/testing/selftests/ublk/test_generic_10.sh +++ b/tools/testing/selftests/ublk/test_generic_10.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_10" ERR_CODE=0 if ! _have_feature "UPDATE_SIZE"; then diff --git a/tools/testing/selftests/ublk/test_generic_11.sh b/tools/testing/selftests/ublk/test_generic_11.sh index d1f973c8c645..e0dc0b8fe5d6 100755 --- a/tools/testing/selftests/ublk/test_generic_11.sh +++ b/tools/testing/selftests/ublk/test_generic_11.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_11" ERR_CODE=0 ublk_run_quiesce_recover() diff --git a/tools/testing/selftests/ublk/test_generic_12.sh b/tools/testing/selftests/ublk/test_generic_12.sh index b4046201b4d9..54b81ddfe9f9 100755 --- a/tools/testing/selftests/ublk/test_generic_12.sh +++ b/tools/testing/selftests/ublk/test_generic_12.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_12" ERR_CODE=0 if ! _have_program bpftrace; then diff --git a/tools/testing/selftests/ublk/test_generic_13.sh b/tools/testing/selftests/ublk/test_generic_13.sh index b7aa90b1cb74..922115aa14f4 100755 --- a/tools/testing/selftests/ublk/test_generic_13.sh +++ b/tools/testing/selftests/ublk/test_generic_13.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_generic_14.sh b/tools/testing/selftests/ublk/test_generic_14.sh index cd9b44b97c24..178443394ca5 100755 --- a/tools/testing/selftests/ublk/test_generic_14.sh +++ b/tools/testing/selftests/ublk/test_generic_14.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_14" ERR_CODE=0 ublk_run_recover_test() diff --git a/tools/testing/selftests/ublk/test_generic_15.sh b/tools/testing/selftests/ublk/test_generic_15.sh index 76379362e0a2..727d0f4610d6 100755 --- a/tools/testing/selftests/ublk/test_generic_15.sh +++ b/tools/testing/selftests/ublk/test_generic_15.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_15" ERR_CODE=0 _test_partition_scan_no_hang() diff --git a/tools/testing/selftests/ublk/test_generic_16.sh b/tools/testing/selftests/ublk/test_generic_16.sh index e08af7b685c9..42e8d2e16ec9 100755 --- a/tools/testing/selftests/ublk/test_generic_16.sh +++ b/tools/testing/selftests/ublk/test_generic_16.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="generic_16" ERR_CODE=0 _prep_test "null" "stop --safe command" diff --git a/tools/testing/selftests/ublk/test_loop_01.sh b/tools/testing/selftests/ublk/test_loop_01.sh index 833fa0dbc700..338a235fd82a 100755 --- a/tools/testing/selftests/ublk/test_loop_01.sh +++ b/tools/testing/selftests/ublk/test_loop_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="loop_01" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_loop_02.sh b/tools/testing/selftests/ublk/test_loop_02.sh index 874568b3646b..04c52454e2ec 100755 --- a/tools/testing/selftests/ublk/test_loop_02.sh +++ b/tools/testing/selftests/ublk/test_loop_02.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="loop_02" ERR_CODE=0 _prep_test "loop" "mkfs & mount & umount" diff --git a/tools/testing/selftests/ublk/test_loop_03.sh b/tools/testing/selftests/ublk/test_loop_03.sh index c30f797c6429..6e8f649fe93d 100755 --- a/tools/testing/selftests/ublk/test_loop_03.sh +++ b/tools/testing/selftests/ublk/test_loop_03.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="loop_03" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_loop_04.sh b/tools/testing/selftests/ublk/test_loop_04.sh index b01d75b3214d..9f6774ec0de6 100755 --- a/tools/testing/selftests/ublk/test_loop_04.sh +++ b/tools/testing/selftests/ublk/test_loop_04.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_loop_05.sh b/tools/testing/selftests/ublk/test_loop_05.sh index de2141533074..2b8d99e007be 100755 --- a/tools/testing/selftests/ublk/test_loop_05.sh +++ b/tools/testing/selftests/ublk/test_loop_05.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="loop_05" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_loop_06.sh b/tools/testing/selftests/ublk/test_loop_06.sh index 1d1a8a725502..e73f6f4844db 100755 --- a/tools/testing/selftests/ublk/test_loop_06.sh +++ b/tools/testing/selftests/ublk/test_loop_06.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="loop_06" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_loop_07.sh b/tools/testing/selftests/ublk/test_loop_07.sh index 493f3fb611a5..264d20e7c530 100755 --- a/tools/testing/selftests/ublk/test_loop_07.sh +++ b/tools/testing/selftests/ublk/test_loop_07.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_loop_08.sh b/tools/testing/selftests/ublk/test_loop_08.sh index ca289cfb2ad4..2caa7ba748fb 100755 --- a/tools/testing/selftests/ublk/test_loop_08.sh +++ b/tools/testing/selftests/ublk/test_loop_08.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_null_01.sh b/tools/testing/selftests/ublk/test_null_01.sh index c2cb8f7a09fe..eebce8076530 100755 --- a/tools/testing/selftests/ublk/test_null_01.sh +++ b/tools/testing/selftests/ublk/test_null_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="null_01" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_null_02.sh b/tools/testing/selftests/ublk/test_null_02.sh index 8accd35beb55..654bdff39664 100755 --- a/tools/testing/selftests/ublk/test_null_02.sh +++ b/tools/testing/selftests/ublk/test_null_02.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="null_02" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_null_03.sh b/tools/testing/selftests/ublk/test_null_03.sh index 0051067b4686..29cd09f06672 100755 --- a/tools/testing/selftests/ublk/test_null_03.sh +++ b/tools/testing/selftests/ublk/test_null_03.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="null_03" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_null_04.sh b/tools/testing/selftests/ublk/test_null_04.sh index 0b0719ea33a3..7491b8c17f00 100755 --- a/tools/testing/selftests/ublk/test_null_04.sh +++ b/tools/testing/selftests/ublk/test_null_04.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID=null_04 _prep_test "null" "integrity params" diff --git a/tools/testing/selftests/ublk/test_stress_01.sh b/tools/testing/selftests/ublk/test_stress_01.sh index 7d3150f057d4..a9322ce496e9 100755 --- a/tools/testing/selftests/ublk/test_stress_01.sh +++ b/tools/testing/selftests/ublk/test_stress_01.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_02.sh b/tools/testing/selftests/ublk/test_stress_02.sh index 4bdd921081e5..6c114194f9c9 100755 --- a/tools/testing/selftests/ublk/test_stress_02.sh +++ b/tools/testing/selftests/ublk/test_stress_02.sh @@ -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 diff --git a/tools/testing/selftests/ublk/test_stress_03.sh b/tools/testing/selftests/ublk/test_stress_03.sh index 3ed4c9b2d8c0..4e81ca0db758 100755 --- a/tools/testing/selftests/ublk/test_stress_03.sh +++ b/tools/testing/selftests/ublk/test_stress_03.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_04.sh b/tools/testing/selftests/ublk/test_stress_04.sh index efa8dc33234b..6c6f44b172bc 100755 --- a/tools/testing/selftests/ublk/test_stress_04.sh +++ b/tools/testing/selftests/ublk/test_stress_04.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_05.sh b/tools/testing/selftests/ublk/test_stress_05.sh index 68a194144302..7e9324de2030 100755 --- a/tools/testing/selftests/ublk/test_stress_05.sh +++ b/tools/testing/selftests/ublk/test_stress_05.sh @@ -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 diff --git a/tools/testing/selftests/ublk/test_stress_06.sh b/tools/testing/selftests/ublk/test_stress_06.sh index 37188ec2e1f7..c72e5d0b14be 100755 --- a/tools/testing/selftests/ublk/test_stress_06.sh +++ b/tools/testing/selftests/ublk/test_stress_06.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_07.sh b/tools/testing/selftests/ublk/test_stress_07.sh index fb061fc26d36..04c2764d5238 100755 --- a/tools/testing/selftests/ublk/test_stress_07.sh +++ b/tools/testing/selftests/ublk/test_stress_07.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_08.sh b/tools/testing/selftests/ublk/test_stress_08.sh index 9abb50ee3d00..37f7d204879a 100755 --- a/tools/testing/selftests/ublk/test_stress_08.sh +++ b/tools/testing/selftests/ublk/test_stress_08.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stress_09.sh b/tools/testing/selftests/ublk/test_stress_09.sh index 87b92b0a2410..53c1e3b2ab30 100755 --- a/tools/testing/selftests/ublk/test_stress_09.sh +++ b/tools/testing/selftests/ublk/test_stress_09.sh @@ -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() diff --git a/tools/testing/selftests/ublk/test_stripe_01.sh b/tools/testing/selftests/ublk/test_stripe_01.sh index 4e4f0fdf3c9b..3bc821aadad8 100755 --- a/tools/testing/selftests/ublk/test_stripe_01.sh +++ b/tools/testing/selftests/ublk/test_stripe_01.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="stripe_01" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_stripe_02.sh b/tools/testing/selftests/ublk/test_stripe_02.sh index 5820ab2efba4..4a7d2b21a6bf 100755 --- a/tools/testing/selftests/ublk/test_stripe_02.sh +++ b/tools/testing/selftests/ublk/test_stripe_02.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="stripe_02" ERR_CODE=0 _prep_test "stripe" "mkfs & mount & umount" diff --git a/tools/testing/selftests/ublk/test_stripe_03.sh b/tools/testing/selftests/ublk/test_stripe_03.sh index 20b977e27814..a1c159d54e53 100755 --- a/tools/testing/selftests/ublk/test_stripe_03.sh +++ b/tools/testing/selftests/ublk/test_stripe_03.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="stripe_03" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_stripe_04.sh b/tools/testing/selftests/ublk/test_stripe_04.sh index 1b51ed2f1d84..0c30bd6c2b3b 100755 --- a/tools/testing/selftests/ublk/test_stripe_04.sh +++ b/tools/testing/selftests/ublk/test_stripe_04.sh @@ -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" diff --git a/tools/testing/selftests/ublk/test_stripe_05.sh b/tools/testing/selftests/ublk/test_stripe_05.sh index 05d71951d710..6ddfa88ad226 100755 --- a/tools/testing/selftests/ublk/test_stripe_05.sh +++ b/tools/testing/selftests/ublk/test_stripe_05.sh @@ -3,7 +3,6 @@ . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh -TID="stripe_05" ERR_CODE=0 if ! _have_program fio; then diff --git a/tools/testing/selftests/ublk/test_stripe_06.sh b/tools/testing/selftests/ublk/test_stripe_06.sh index d06cac7626e2..a2c7bf4cc613 100755 --- a/tools/testing/selftests/ublk/test_stripe_06.sh +++ b/tools/testing/selftests/ublk/test_stripe_06.sh @@ -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" -- 2.47.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] selftests: ublk: derive TID automatically from script name 2026-01-29 3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei @ 2026-01-29 4:46 ` Caleb Sander Mateos 2026-01-29 9:50 ` Alexander Atanasov 1 sibling, 0 replies; 12+ messages in thread From: Caleb Sander Mateos @ 2026-01-29 4:46 UTC (permalink / raw) To: Ming Lei; +Cc: Jens Axboe, linux-block, Uday Shankar, Alexander Atanasov On Wed, Jan 28, 2026 at 7:15 PM Ming Lei <ming.lei@redhat.com> wrote: > > 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. > > Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> > --- > tools/testing/selftests/ublk/test_batch_01.sh | 1 - > tools/testing/selftests/ublk/test_batch_02.sh | 1 - > tools/testing/selftests/ublk/test_batch_03.sh | 1 - > tools/testing/selftests/ublk/test_common.sh | 4 ++++ > tools/testing/selftests/ublk/test_generic_01.sh | 1 - > tools/testing/selftests/ublk/test_generic_02.sh | 1 - > tools/testing/selftests/ublk/test_generic_03.sh | 1 - > tools/testing/selftests/ublk/test_generic_04.sh | 1 - > tools/testing/selftests/ublk/test_generic_05.sh | 1 - > tools/testing/selftests/ublk/test_generic_06.sh | 1 - > tools/testing/selftests/ublk/test_generic_07.sh | 1 - > tools/testing/selftests/ublk/test_generic_08.sh | 1 - > tools/testing/selftests/ublk/test_generic_09.sh | 1 - > tools/testing/selftests/ublk/test_generic_10.sh | 1 - > tools/testing/selftests/ublk/test_generic_11.sh | 1 - > tools/testing/selftests/ublk/test_generic_12.sh | 1 - > tools/testing/selftests/ublk/test_generic_13.sh | 1 - > tools/testing/selftests/ublk/test_generic_14.sh | 1 - > tools/testing/selftests/ublk/test_generic_15.sh | 1 - > tools/testing/selftests/ublk/test_generic_16.sh | 1 - > tools/testing/selftests/ublk/test_loop_01.sh | 1 - > tools/testing/selftests/ublk/test_loop_02.sh | 1 - > tools/testing/selftests/ublk/test_loop_03.sh | 1 - > tools/testing/selftests/ublk/test_loop_04.sh | 1 - > tools/testing/selftests/ublk/test_loop_05.sh | 1 - > tools/testing/selftests/ublk/test_loop_06.sh | 1 - > tools/testing/selftests/ublk/test_loop_07.sh | 1 - > tools/testing/selftests/ublk/test_loop_08.sh | 1 - > tools/testing/selftests/ublk/test_null_01.sh | 1 - > tools/testing/selftests/ublk/test_null_02.sh | 1 - > tools/testing/selftests/ublk/test_null_03.sh | 1 - > tools/testing/selftests/ublk/test_null_04.sh | 1 - > tools/testing/selftests/ublk/test_stress_01.sh | 1 - > tools/testing/selftests/ublk/test_stress_02.sh | 1 - > tools/testing/selftests/ublk/test_stress_03.sh | 1 - > tools/testing/selftests/ublk/test_stress_04.sh | 1 - > tools/testing/selftests/ublk/test_stress_05.sh | 1 - > tools/testing/selftests/ublk/test_stress_06.sh | 1 - > tools/testing/selftests/ublk/test_stress_07.sh | 1 - > tools/testing/selftests/ublk/test_stress_08.sh | 1 - > tools/testing/selftests/ublk/test_stress_09.sh | 1 - > tools/testing/selftests/ublk/test_stripe_01.sh | 1 - > tools/testing/selftests/ublk/test_stripe_02.sh | 1 - > tools/testing/selftests/ublk/test_stripe_03.sh | 1 - > tools/testing/selftests/ublk/test_stripe_04.sh | 1 - > tools/testing/selftests/ublk/test_stripe_05.sh | 1 - > tools/testing/selftests/ublk/test_stripe_06.sh | 1 - > 47 files changed, 4 insertions(+), 46 deletions(-) > > diff --git a/tools/testing/selftests/ublk/test_batch_01.sh b/tools/testing/selftests/ublk/test_batch_01.sh > index 9fa9fff5c62f..a18fb39af8be 100755 > --- a/tools/testing/selftests/ublk/test_batch_01.sh > +++ b/tools/testing/selftests/ublk/test_batch_01.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="batch_01" > ERR_CODE=0 > > if ! _have_feature "BATCH_IO"; then > diff --git a/tools/testing/selftests/ublk/test_batch_02.sh b/tools/testing/selftests/ublk/test_batch_02.sh > index b477f91359e1..7ca384d11987 100755 > --- a/tools/testing/selftests/ublk/test_batch_02.sh > +++ b/tools/testing/selftests/ublk/test_batch_02.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="batch_02" > ERR_CODE=0 > > if ! _have_feature "BATCH_IO"; then > diff --git a/tools/testing/selftests/ublk/test_batch_03.sh b/tools/testing/selftests/ublk/test_batch_03.sh > index 13a2b3d3a1b9..aca9cf144b55 100755 > --- a/tools/testing/selftests/ublk/test_batch_03.sh > +++ b/tools/testing/selftests/ublk/test_batch_03.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="batch_03" > ERR_CODE=0 > > if ! _have_feature "BATCH_IO"; then > diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh > index 7ff6ce79d62c..687884cbaec1 100755 > --- a/tools/testing/selftests/ublk/test_common.sh > +++ b/tools/testing/selftests/ublk/test_common.sh > @@ -1,6 +1,10 @@ > #!/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 | sed 's/^test_//') > + > UBLK_SKIP_CODE=4 > > _have_program() { > diff --git a/tools/testing/selftests/ublk/test_generic_01.sh b/tools/testing/selftests/ublk/test_generic_01.sh > index 21a31cd5491a..26cf3c7ceeb5 100755 > --- a/tools/testing/selftests/ublk/test_generic_01.sh > +++ b/tools/testing/selftests/ublk/test_generic_01.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_01" > ERR_CODE=0 > > if ! _have_program bpftrace; then > diff --git a/tools/testing/selftests/ublk/test_generic_02.sh b/tools/testing/selftests/ublk/test_generic_02.sh > index 12920768b1a0..1d4b1d6e059c 100755 > --- a/tools/testing/selftests/ublk/test_generic_02.sh > +++ b/tools/testing/selftests/ublk/test_generic_02.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_02" > ERR_CODE=0 > > if ! _have_program bpftrace; then > diff --git a/tools/testing/selftests/ublk/test_generic_03.sh b/tools/testing/selftests/ublk/test_generic_03.sh > index b551aa76cb0d..8934ea926762 100755 > --- a/tools/testing/selftests/ublk/test_generic_03.sh > +++ b/tools/testing/selftests/ublk/test_generic_03.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_generic_04.sh b/tools/testing/selftests/ublk/test_generic_04.sh > index be2292822bbe..2672f9c40fa8 100755 > --- a/tools/testing/selftests/ublk/test_generic_04.sh > +++ b/tools/testing/selftests/ublk/test_generic_04.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_04" > ERR_CODE=0 > > ublk_run_recover_test() > diff --git a/tools/testing/selftests/ublk/test_generic_05.sh b/tools/testing/selftests/ublk/test_generic_05.sh > index 9b7f71c16d82..bda5064bc31f 100755 > --- a/tools/testing/selftests/ublk/test_generic_05.sh > +++ b/tools/testing/selftests/ublk/test_generic_05.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_05" > ERR_CODE=0 > > ublk_run_recover_test() > diff --git a/tools/testing/selftests/ublk/test_generic_06.sh b/tools/testing/selftests/ublk/test_generic_06.sh > index fd42062b7b76..14a05054fcd8 100755 > --- a/tools/testing/selftests/ublk/test_generic_06.sh > +++ b/tools/testing/selftests/ublk/test_generic_06.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_generic_07.sh b/tools/testing/selftests/ublk/test_generic_07.sh > index cba86451fa5e..8dcfd8978f50 100755 > --- a/tools/testing/selftests/ublk/test_generic_07.sh > +++ b/tools/testing/selftests/ublk/test_generic_07.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_07" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_generic_08.sh b/tools/testing/selftests/ublk/test_generic_08.sh > index b222f3a77e12..ce88c31d6b9c 100755 > --- a/tools/testing/selftests/ublk/test_generic_08.sh > +++ b/tools/testing/selftests/ublk/test_generic_08.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_08" > ERR_CODE=0 > > if ! _have_feature "AUTO_BUF_REG"; then > diff --git a/tools/testing/selftests/ublk/test_generic_09.sh b/tools/testing/selftests/ublk/test_generic_09.sh > index bb6f77ca5522..744d0cdaa242 100755 > --- a/tools/testing/selftests/ublk/test_generic_09.sh > +++ b/tools/testing/selftests/ublk/test_generic_09.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_09" > ERR_CODE=0 > > if ! _have_feature "AUTO_BUF_REG"; then > diff --git a/tools/testing/selftests/ublk/test_generic_10.sh b/tools/testing/selftests/ublk/test_generic_10.sh > index abc11c3d416b..4b4293b9081f 100755 > --- a/tools/testing/selftests/ublk/test_generic_10.sh > +++ b/tools/testing/selftests/ublk/test_generic_10.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_10" > ERR_CODE=0 > > if ! _have_feature "UPDATE_SIZE"; then > diff --git a/tools/testing/selftests/ublk/test_generic_11.sh b/tools/testing/selftests/ublk/test_generic_11.sh > index d1f973c8c645..e0dc0b8fe5d6 100755 > --- a/tools/testing/selftests/ublk/test_generic_11.sh > +++ b/tools/testing/selftests/ublk/test_generic_11.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_11" > ERR_CODE=0 > > ublk_run_quiesce_recover() > diff --git a/tools/testing/selftests/ublk/test_generic_12.sh b/tools/testing/selftests/ublk/test_generic_12.sh > index b4046201b4d9..54b81ddfe9f9 100755 > --- a/tools/testing/selftests/ublk/test_generic_12.sh > +++ b/tools/testing/selftests/ublk/test_generic_12.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_12" > ERR_CODE=0 > > if ! _have_program bpftrace; then > diff --git a/tools/testing/selftests/ublk/test_generic_13.sh b/tools/testing/selftests/ublk/test_generic_13.sh > index b7aa90b1cb74..922115aa14f4 100755 > --- a/tools/testing/selftests/ublk/test_generic_13.sh > +++ b/tools/testing/selftests/ublk/test_generic_13.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_generic_14.sh b/tools/testing/selftests/ublk/test_generic_14.sh > index cd9b44b97c24..178443394ca5 100755 > --- a/tools/testing/selftests/ublk/test_generic_14.sh > +++ b/tools/testing/selftests/ublk/test_generic_14.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_14" > ERR_CODE=0 > > ublk_run_recover_test() > diff --git a/tools/testing/selftests/ublk/test_generic_15.sh b/tools/testing/selftests/ublk/test_generic_15.sh > index 76379362e0a2..727d0f4610d6 100755 > --- a/tools/testing/selftests/ublk/test_generic_15.sh > +++ b/tools/testing/selftests/ublk/test_generic_15.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_15" > ERR_CODE=0 > > _test_partition_scan_no_hang() > diff --git a/tools/testing/selftests/ublk/test_generic_16.sh b/tools/testing/selftests/ublk/test_generic_16.sh > index e08af7b685c9..42e8d2e16ec9 100755 > --- a/tools/testing/selftests/ublk/test_generic_16.sh > +++ b/tools/testing/selftests/ublk/test_generic_16.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="generic_16" > ERR_CODE=0 > > _prep_test "null" "stop --safe command" > diff --git a/tools/testing/selftests/ublk/test_loop_01.sh b/tools/testing/selftests/ublk/test_loop_01.sh > index 833fa0dbc700..338a235fd82a 100755 > --- a/tools/testing/selftests/ublk/test_loop_01.sh > +++ b/tools/testing/selftests/ublk/test_loop_01.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="loop_01" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_loop_02.sh b/tools/testing/selftests/ublk/test_loop_02.sh > index 874568b3646b..04c52454e2ec 100755 > --- a/tools/testing/selftests/ublk/test_loop_02.sh > +++ b/tools/testing/selftests/ublk/test_loop_02.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="loop_02" > ERR_CODE=0 > > _prep_test "loop" "mkfs & mount & umount" > diff --git a/tools/testing/selftests/ublk/test_loop_03.sh b/tools/testing/selftests/ublk/test_loop_03.sh > index c30f797c6429..6e8f649fe93d 100755 > --- a/tools/testing/selftests/ublk/test_loop_03.sh > +++ b/tools/testing/selftests/ublk/test_loop_03.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="loop_03" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_loop_04.sh b/tools/testing/selftests/ublk/test_loop_04.sh > index b01d75b3214d..9f6774ec0de6 100755 > --- a/tools/testing/selftests/ublk/test_loop_04.sh > +++ b/tools/testing/selftests/ublk/test_loop_04.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_loop_05.sh b/tools/testing/selftests/ublk/test_loop_05.sh > index de2141533074..2b8d99e007be 100755 > --- a/tools/testing/selftests/ublk/test_loop_05.sh > +++ b/tools/testing/selftests/ublk/test_loop_05.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="loop_05" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_loop_06.sh b/tools/testing/selftests/ublk/test_loop_06.sh > index 1d1a8a725502..e73f6f4844db 100755 > --- a/tools/testing/selftests/ublk/test_loop_06.sh > +++ b/tools/testing/selftests/ublk/test_loop_06.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="loop_06" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_loop_07.sh b/tools/testing/selftests/ublk/test_loop_07.sh > index 493f3fb611a5..264d20e7c530 100755 > --- a/tools/testing/selftests/ublk/test_loop_07.sh > +++ b/tools/testing/selftests/ublk/test_loop_07.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_loop_08.sh b/tools/testing/selftests/ublk/test_loop_08.sh > index ca289cfb2ad4..2caa7ba748fb 100755 > --- a/tools/testing/selftests/ublk/test_loop_08.sh > +++ b/tools/testing/selftests/ublk/test_loop_08.sh > @@ -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" > > diff --git a/tools/testing/selftests/ublk/test_null_01.sh b/tools/testing/selftests/ublk/test_null_01.sh > index c2cb8f7a09fe..eebce8076530 100755 > --- a/tools/testing/selftests/ublk/test_null_01.sh > +++ b/tools/testing/selftests/ublk/test_null_01.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="null_01" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_null_02.sh b/tools/testing/selftests/ublk/test_null_02.sh > index 8accd35beb55..654bdff39664 100755 > --- a/tools/testing/selftests/ublk/test_null_02.sh > +++ b/tools/testing/selftests/ublk/test_null_02.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="null_02" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_null_03.sh b/tools/testing/selftests/ublk/test_null_03.sh > index 0051067b4686..29cd09f06672 100755 > --- a/tools/testing/selftests/ublk/test_null_03.sh > +++ b/tools/testing/selftests/ublk/test_null_03.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="null_03" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_null_04.sh b/tools/testing/selftests/ublk/test_null_04.sh > index 0b0719ea33a3..7491b8c17f00 100755 > --- a/tools/testing/selftests/ublk/test_null_04.sh > +++ b/tools/testing/selftests/ublk/test_null_04.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID=null_04 > > _prep_test "null" "integrity params" > > diff --git a/tools/testing/selftests/ublk/test_stress_01.sh b/tools/testing/selftests/ublk/test_stress_01.sh > index 7d3150f057d4..a9322ce496e9 100755 > --- a/tools/testing/selftests/ublk/test_stress_01.sh > +++ b/tools/testing/selftests/ublk/test_stress_01.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_02.sh b/tools/testing/selftests/ublk/test_stress_02.sh > index 4bdd921081e5..6c114194f9c9 100755 > --- a/tools/testing/selftests/ublk/test_stress_02.sh > +++ b/tools/testing/selftests/ublk/test_stress_02.sh > @@ -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 > diff --git a/tools/testing/selftests/ublk/test_stress_03.sh b/tools/testing/selftests/ublk/test_stress_03.sh > index 3ed4c9b2d8c0..4e81ca0db758 100755 > --- a/tools/testing/selftests/ublk/test_stress_03.sh > +++ b/tools/testing/selftests/ublk/test_stress_03.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_04.sh b/tools/testing/selftests/ublk/test_stress_04.sh > index efa8dc33234b..6c6f44b172bc 100755 > --- a/tools/testing/selftests/ublk/test_stress_04.sh > +++ b/tools/testing/selftests/ublk/test_stress_04.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_05.sh b/tools/testing/selftests/ublk/test_stress_05.sh > index 68a194144302..7e9324de2030 100755 > --- a/tools/testing/selftests/ublk/test_stress_05.sh > +++ b/tools/testing/selftests/ublk/test_stress_05.sh > @@ -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 > diff --git a/tools/testing/selftests/ublk/test_stress_06.sh b/tools/testing/selftests/ublk/test_stress_06.sh > index 37188ec2e1f7..c72e5d0b14be 100755 > --- a/tools/testing/selftests/ublk/test_stress_06.sh > +++ b/tools/testing/selftests/ublk/test_stress_06.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_07.sh b/tools/testing/selftests/ublk/test_stress_07.sh > index fb061fc26d36..04c2764d5238 100755 > --- a/tools/testing/selftests/ublk/test_stress_07.sh > +++ b/tools/testing/selftests/ublk/test_stress_07.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_08.sh b/tools/testing/selftests/ublk/test_stress_08.sh > index 9abb50ee3d00..37f7d204879a 100755 > --- a/tools/testing/selftests/ublk/test_stress_08.sh > +++ b/tools/testing/selftests/ublk/test_stress_08.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stress_09.sh b/tools/testing/selftests/ublk/test_stress_09.sh > index 87b92b0a2410..53c1e3b2ab30 100755 > --- a/tools/testing/selftests/ublk/test_stress_09.sh > +++ b/tools/testing/selftests/ublk/test_stress_09.sh > @@ -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() > diff --git a/tools/testing/selftests/ublk/test_stripe_01.sh b/tools/testing/selftests/ublk/test_stripe_01.sh > index 4e4f0fdf3c9b..3bc821aadad8 100755 > --- a/tools/testing/selftests/ublk/test_stripe_01.sh > +++ b/tools/testing/selftests/ublk/test_stripe_01.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="stripe_01" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_stripe_02.sh b/tools/testing/selftests/ublk/test_stripe_02.sh > index 5820ab2efba4..4a7d2b21a6bf 100755 > --- a/tools/testing/selftests/ublk/test_stripe_02.sh > +++ b/tools/testing/selftests/ublk/test_stripe_02.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="stripe_02" > ERR_CODE=0 > > _prep_test "stripe" "mkfs & mount & umount" > diff --git a/tools/testing/selftests/ublk/test_stripe_03.sh b/tools/testing/selftests/ublk/test_stripe_03.sh > index 20b977e27814..a1c159d54e53 100755 > --- a/tools/testing/selftests/ublk/test_stripe_03.sh > +++ b/tools/testing/selftests/ublk/test_stripe_03.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="stripe_03" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_stripe_04.sh b/tools/testing/selftests/ublk/test_stripe_04.sh > index 1b51ed2f1d84..0c30bd6c2b3b 100755 > --- a/tools/testing/selftests/ublk/test_stripe_04.sh > +++ b/tools/testing/selftests/ublk/test_stripe_04.sh > @@ -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" > diff --git a/tools/testing/selftests/ublk/test_stripe_05.sh b/tools/testing/selftests/ublk/test_stripe_05.sh > index 05d71951d710..6ddfa88ad226 100755 > --- a/tools/testing/selftests/ublk/test_stripe_05.sh > +++ b/tools/testing/selftests/ublk/test_stripe_05.sh > @@ -3,7 +3,6 @@ > > . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh > > -TID="stripe_05" > ERR_CODE=0 > > if ! _have_program fio; then > diff --git a/tools/testing/selftests/ublk/test_stripe_06.sh b/tools/testing/selftests/ublk/test_stripe_06.sh > index d06cac7626e2..a2c7bf4cc613 100755 > --- a/tools/testing/selftests/ublk/test_stripe_06.sh > +++ b/tools/testing/selftests/ublk/test_stripe_06.sh > @@ -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" > -- > 2.47.0 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] selftests: ublk: derive TID automatically from script name 2026-01-29 3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei 2026-01-29 4:46 ` Caleb Sander Mateos @ 2026-01-29 9:50 ` Alexander Atanasov 2026-01-29 11:45 ` Ming Lei 1 sibling, 1 reply; 12+ messages in thread From: Alexander Atanasov @ 2026-01-29 9:50 UTC (permalink / raw) To: Ming Lei; +Cc: Jens Axboe, linux-block, Caleb Sander Mateos, Uday Shankar > On 29 Jan 2026, at 5:14, Ming Lei <ming.lei@redhat.com> wrote: > > TID=$(basename "$0" .sh | sed 's/^test_//‘) TID=$(basename "$0" .sh) TID=${TID#test_} Scripts are using bash, so can save the sed call here. have fun, alex ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] selftests: ublk: derive TID automatically from script name 2026-01-29 9:50 ` Alexander Atanasov @ 2026-01-29 11:45 ` Ming Lei 0 siblings, 0 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 11:45 UTC (permalink / raw) To: Alexander Atanasov Cc: Jens Axboe, linux-block, Caleb Sander Mateos, Uday Shankar On Thu, Jan 29, 2026 at 5:50 PM Alexander Atanasov <alex@zazolabs.com> wrote: > > > > > On 29 Jan 2026, at 5:14, Ming Lei <ming.lei@redhat.com> wrote: > > > > TID=$(basename "$0" .sh | sed 's/^test_//‘) > > TID=$(basename "$0" .sh) > TID=${TID#test_} > > Scripts are using bash, so can save the sed call here. OK, thanks! ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/5] selftests: ublk: mark each test start and end time in dmesg 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei ` (2 preceding siblings ...) 2026-01-29 3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei @ 2026-01-29 3:14 ` Ming Lei 2026-01-29 3:14 ` [PATCH 5/5] selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN Ming Lei 4 siblings, 0 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw) To: Jens Axboe, linux-block Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei From: Alexander Atanasov <alex@zazolabs.com> Log test start and end time in dmesg, so generated log messages during the test run can be linked to specific test from the test suite. Signed-off-by: Alexander Atanasov <alex@zazolabs.com> (switch to `date +%F %T`) Signed-off-by: Ming Lei <ming.lei@redhat.com> --- tools/testing/selftests/ublk/test_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh index 687884cbaec1..cfe4b107f412 100755 --- a/tools/testing/selftests/ublk/test_common.sh +++ b/tools/testing/selftests/ublk/test_common.sh @@ -125,6 +125,7 @@ _prep_test() { modprobe ublk_drv > /dev/null 2>&1 UBLK_TMP=$(mktemp ublk_test_XXXXX) [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "ublk $type: $*" + echo "ublk selftest: $TID starting at $(date '+%F %T')" | tee /dev/kmsg } _remove_test_files() @@ -169,6 +170,7 @@ _cleanup_test() { "${UBLK_PROG}" del -a _remove_files + echo "ublk selftest: $TID done at $(date '+%F %T')" | tee /dev/kmsg } _have_feature() -- 2.47.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei ` (3 preceding siblings ...) 2026-01-29 3:14 ` [PATCH 4/5] selftests: ublk: mark each test start and end time in dmesg Ming Lei @ 2026-01-29 3:14 ` Ming Lei 4 siblings, 0 replies; 12+ messages in thread From: Ming Lei @ 2026-01-29 3:14 UTC (permalink / raw) To: Jens Axboe, linux-block Cc: Caleb Sander Mateos, Uday Shankar, Alexander Atanasov, Ming Lei Add test_part_01.sh to test the UBLK_F_NO_AUTO_PART_SCAN feature flag which allows suppressing automatic partition scanning during device startup while still allowing manual partition probing. The test verifies: - Normal behavior: partitions are auto-detected without the flag - With flag: partitions are not auto-detected during START_DEV - Manual scan: blockdev --rereadpt works with the flag Also update kublk tool to support --no_auto_part_scan option and recognize the feature flag. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- tools/testing/selftests/ublk/Makefile | 2 + tools/testing/selftests/ublk/kublk.c | 6 +- tools/testing/selftests/ublk/kublk.h | 3 +- tools/testing/selftests/ublk/test_part_01.sh | 104 +++++++++++++++++++ 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100755 tools/testing/selftests/ublk/test_part_01.sh diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile index e39a6f871fcc..bc5bd7d1381d 100644 --- a/tools/testing/selftests/ublk/Makefile +++ b/tools/testing/selftests/ublk/Makefile @@ -48,6 +48,8 @@ TEST_PROGS += test_stripe_04.sh TEST_PROGS += test_stripe_05.sh TEST_PROGS += test_stripe_06.sh +TEST_PROGS += test_part_01.sh + TEST_PROGS += test_stress_01.sh TEST_PROGS += test_stress_02.sh TEST_PROGS += test_stress_03.sh diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c index 2da37557e1a9..e8279c4acc40 100644 --- a/tools/testing/selftests/ublk/kublk.c +++ b/tools/testing/selftests/ublk/kublk.c @@ -1615,6 +1615,7 @@ static int cmd_dev_get_features(void) FEAT_NAME(UBLK_F_INTEGRITY), FEAT_NAME(UBLK_F_SAFE_STOP_DEV), FEAT_NAME(UBLK_F_BATCH_IO), + FEAT_NAME(UBLK_F_NO_AUTO_PART_SCAN), }; struct ublk_dev *dev; __u64 features = 0; @@ -1712,7 +1713,7 @@ static void __cmd_create_help(char *exe, bool recovery) printf("\t[--nthreads threads] [--per_io_tasks]\n"); printf("\t[--integrity_capable] [--integrity_reftag] [--metadata_size SIZE] " "[--pi_offset OFFSET] [--csum_type ip|t10dif|nvme] [--tag_size SIZE]\n"); - printf("\t[--batch|-b]\n"); + printf("\t[--batch|-b] [--no_auto_part_scan]\n"); printf("\t[target options] [backfile1] [backfile2] ...\n"); printf("\tdefault: nr_queues=2(max 32), depth=128(max 1024), dev_id=-1(auto allocation)\n"); printf("\tdefault: nthreads=nr_queues"); @@ -1786,6 +1787,7 @@ int main(int argc, char *argv[]) { "tag_size", 1, NULL, 0 }, { "safe", 0, NULL, 0 }, { "batch", 0, NULL, 'b'}, + { "no_auto_part_scan", 0, NULL, 0 }, { 0, 0, 0, 0 } }; const struct ublk_tgt_ops *ops = NULL; @@ -1898,6 +1900,8 @@ int main(int argc, char *argv[]) ctx.tag_size = strtoul(optarg, NULL, 0); if (!strcmp(longopts[option_idx].name, "safe")) ctx.safe_stop = 1; + if (!strcmp(longopts[option_idx].name, "no_auto_part_scan")) + ctx.flags |= UBLK_F_NO_AUTO_PART_SCAN; break; case '?': /* diff --git a/tools/testing/selftests/ublk/kublk.h b/tools/testing/selftests/ublk/kublk.h index ca97deb5e208..1faeccaaecae 100644 --- a/tools/testing/selftests/ublk/kublk.h +++ b/tools/testing/selftests/ublk/kublk.h @@ -78,12 +78,13 @@ struct dev_ctx { unsigned int auto_zc_fallback:1; unsigned int per_io_tasks:1; unsigned int no_ublk_fixed_fd:1; + unsigned int safe_stop:1; + unsigned int no_auto_part_scan:1; __u32 integrity_flags; __u8 metadata_size; __u8 pi_offset; __u8 csum_type; __u8 tag_size; - unsigned int safe_stop:1; int _evtfd; int _shmid; diff --git a/tools/testing/selftests/ublk/test_part_01.sh b/tools/testing/selftests/ublk/test_part_01.sh new file mode 100755 index 000000000000..8028f6e4b3a5 --- /dev/null +++ b/tools/testing/selftests/ublk/test_part_01.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +ERR_CODE=0 + +format_backing_file() +{ + local backing_file=$1 + + # Create ublk device to write partition table + local tmp_dev=$(_add_ublk_dev -t loop "${backing_file}") + [ $? -ne 0 ] && return 1 + + # Write partition table with sfdisk + sfdisk /dev/ublkb"${tmp_dev}" > /dev/null 2>&1 <<EOF +label: dos +start=2048, size=100MiB, type=83 +start=206848, size=100MiB, type=83 +EOF + local ret=$? + + "${UBLK_PROG}" del -n "${tmp_dev}" + + return $ret +} + +test_auto_part_scan() +{ + local backing_file=$1 + + # Create device WITHOUT --no_auto_part_scan + local dev_id=$(_add_ublk_dev -t loop "${backing_file}") + [ $? -ne 0 ] && return 1 + + udevadm settle + + # Partitions should be auto-detected + if [ ! -e /dev/ublkb"${dev_id}"p1 ] || [ ! -e /dev/ublkb"${dev_id}"p2 ]; then + "${UBLK_PROG}" del -n "${dev_id}" + return 1 + fi + + "${UBLK_PROG}" del -n "${dev_id}" + return 0 +} + +test_no_auto_part_scan() +{ + local backing_file=$1 + + # Create device WITH --no_auto_part_scan + local dev_id=$(_add_ublk_dev -t loop --no_auto_part_scan "${backing_file}") + [ $? -ne 0 ] && return 1 + + udevadm settle + + # Partitions should NOT be auto-detected + if [ -e /dev/ublkb"${dev_id}"p1 ]; then + "${UBLK_PROG}" del -n "${dev_id}" + return 1 + fi + + # Manual scan should work + blockdev --rereadpt /dev/ublkb"${dev_id}" > /dev/null 2>&1 + udevadm settle + + if [ ! -e /dev/ublkb"${dev_id}"p1 ] || [ ! -e /dev/ublkb"${dev_id}"p2 ]; then + "${UBLK_PROG}" del -n "${dev_id}" + return 1 + fi + + "${UBLK_PROG}" del -n "${dev_id}" + return 0 +} + +if ! _have_program sfdisk || ! _have_program blockdev; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "generic" "test UBLK_F_NO_AUTO_PART_SCAN" + +if ! _have_feature "UBLK_F_NO_AUTO_PART_SCAN"; then + _cleanup_test "generic" + exit "$UBLK_SKIP_CODE" +fi + + +# Create and format backing file with partition table +_create_backfile 0 256M +format_backing_file "${UBLK_BACKFILES[0]}" +[ $? -ne 0 ] && ERR_CODE=255 + +# Test normal auto partition scan +[ "$ERR_CODE" -eq 0 ] && test_auto_part_scan "${UBLK_BACKFILES[0]}" +[ $? -ne 0 ] && ERR_CODE=255 + +# Test no auto partition scan with manual scan +[ "$ERR_CODE" -eq 0 ] && test_no_auto_part_scan "${UBLK_BACKFILES[0]}" +[ $? -ne 0 ] && ERR_CODE=255 + +_cleanup_test "generic" +_show_result $TID $ERR_CODE -- 2.47.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-01-29 11:45 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-29 3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei 2026-01-29 3:14 ` [PATCH 1/5] ublk: check list membership before cancelling batch fetch command Ming Lei 2026-01-29 3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei 2026-01-29 4:44 ` Caleb Sander Mateos 2026-01-29 8:21 ` Ming Lei 2026-01-29 5:45 ` Alexander Atanasov 2026-01-29 3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei 2026-01-29 4:46 ` Caleb Sander Mateos 2026-01-29 9:50 ` Alexander Atanasov 2026-01-29 11:45 ` Ming Lei 2026-01-29 3:14 ` [PATCH 4/5] selftests: ublk: mark each test start and end time in dmesg Ming Lei 2026-01-29 3:14 ` [PATCH 5/5] selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN Ming Lei
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox