[PATCH blktests v1 1/3] nvme/rc: add blkdev type environment variable

Daniel Wagner dwagner at suse.de
Tue Apr 2 03:03:20 PDT 2024


Introduce nvmet_blkdev_type environment variable which allows to control
the target setup. This allows us to drop duplicate tests which just
differ how the target is setup.

Signed-off-by: Daniel Wagner <dwagner at suse.de>
---
 Documentation/running-tests.md | 2 ++
 tests/nvme/rc                  | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md
index ae80860c917a..9cc53cb8d147 100644
--- a/Documentation/running-tests.md
+++ b/Documentation/running-tests.md
@@ -109,6 +109,8 @@ The NVMe tests can be additionally parameterized via environment variables.
 	and 'G' postfix are supported.
 - nvme_num_iter: 1000 (default)
   The number of iterations a test should do.
+- nvmet_blkdev_type: 'device' (default), 'file'
+  Select different target block device type backends.
 
 ### Running nvme-rdma and SRP tests
 
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 203cf0c7903b..5fa1871f7fd8 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -21,6 +21,7 @@ export def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"1G"}
 nvme_num_iter=${nvme_num_iter:-"1000"}
+nvmet_blkdev_type=${nvmet_blkdev_type:-"device"}
 
 # TMPDIR can not be referred out of test() or test_device() context. Instead of
 # global variable def_flie_path, use this getter function.
@@ -826,7 +827,7 @@ _find_nvme_passthru_loop_dev() {
 }
 
 _nvmet_target_setup() {
-	local blkdev_type="device"
+	local blkdev_type="${nvmet_blkdev_type}"
 	local blkdev
 	local ctrlkey=""
 	local hostkey=""
-- 
2.44.0




More information about the Linux-nvme mailing list