From: Daniel Wagner <dwagner@suse.de>
To: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Chaitanya Kulkarni <kch@nvidia.com>,
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Max Gurtovoy <mgurtovoy@nvidia.com>,
Hannes Reinecke <hare@suse.de>, Sagi Grimberg <sagi@grimberg.me>,
James Smart <jsmart2021@gmail.com>,
Bart Van Assche <bvanassche@acm.org>,
Daniel Wagner <dwagner@suse.de>
Subject: [PATCH blktests v3 02/13] nvme: Reorganize test preamble code section
Date: Fri, 11 Aug 2023 11:36:03 +0200 [thread overview]
Message-ID: <20230811093614.28005-3-dwagner@suse.de> (raw)
In-Reply-To: <20230811093614.28005-1-dwagner@suse.de>
This unifies all the tests preamble code section.
Reorganize all tests to start with printing the test name, then
the setting nvmet and finally followed by the variable declarations.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
tests/nvme/006 | 4 ++--
tests/nvme/007 | 4 ++--
tests/nvme/016 | 4 ++--
tests/nvme/017 | 4 ++--
tests/nvme/030 | 8 ++++----
tests/nvme/031 | 8 ++++----
tests/nvme/033 | 7 ++++---
tests/nvme/034 | 7 ++++---
tests/nvme/035 | 7 ++++---
tests/nvme/036 | 7 ++++---
tests/nvme/037 | 8 ++++----
tests/nvme/038 | 6 +++---
tests/nvme/039 | 4 ++--
tests/nvme/040 | 7 ++++---
tests/nvme/041 | 8 ++++----
tests/nvme/042 | 8 ++++----
tests/nvme/043 | 8 ++++----
tests/nvme/044 | 8 ++++----
tests/nvme/045 | 8 ++++----
tests/nvme/048 | 8 ++++----
20 files changed, 69 insertions(+), 64 deletions(-)
diff --git a/tests/nvme/006 b/tests/nvme/006
index ea0db93791a7..b44c56b6a25d 100755
--- a/tests/nvme/006
+++ b/tests/nvme/006
@@ -18,12 +18,12 @@ requires() {
test() {
echo "Running ${TEST_NAME}"
+ _setup_nvmet
+
local port
local loop_dev
local subsys_name="blktests-subsystem-1"
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "$TMPDIR/img"
loop_dev="$(losetup -f --show "$TMPDIR/img")"
diff --git a/tests/nvme/007 b/tests/nvme/007
index 243a79f5a254..112432df7a9d 100755
--- a/tests/nvme/007
+++ b/tests/nvme/007
@@ -17,12 +17,12 @@ requires() {
test() {
echo "Running ${TEST_NAME}"
+ _setup_nvmet
+
local port
local file_path
local subsys_name="blktests-subsystem-1"
- _setup_nvmet
-
file_path="${TMPDIR}/img"
truncate -s "${nvme_img_size}" "${file_path}"
diff --git a/tests/nvme/016 b/tests/nvme/016
index f617cf103900..cac0c0509aca 100755
--- a/tests/nvme/016
+++ b/tests/nvme/016
@@ -16,13 +16,13 @@ requires() {
test() {
echo "Running ${TEST_NAME}"
+ _setup_nvmet
+
local port
local iterations="${nvme_num_iter}"
local loop_dev
local subsys_nqn="blktests-subsystem-1"
- _setup_nvmet
-
loop_dev="$(losetup -f)"
local genctr=1
diff --git a/tests/nvme/017 b/tests/nvme/017
index 3dbb7c174b56..429a25e8e011 100755
--- a/tests/nvme/017
+++ b/tests/nvme/017
@@ -16,13 +16,13 @@ requires() {
test() {
echo "Running ${TEST_NAME}"
+ _setup_nvmet
+
local port
local file_path
local iterations="${nvme_num_iter}"
local subsys_name="blktests-subsystem-1"
- _setup_nvmet
-
file_path="${TMPDIR}/img"
truncate -s "${nvme_img_size}" "${file_path}"
diff --git a/tests/nvme/030 b/tests/nvme/030
index cfcdcbe6be23..a0b999cace94 100755
--- a/tests/nvme/030
+++ b/tests/nvme/030
@@ -16,14 +16,14 @@ requires() {
}
test() {
- local port
- local genctr
- local subsys="blktests-subsystem-"
-
echo "Running ${TEST_NAME}"
_setup_nvmet
+ local port
+ local genctr
+ local subsys="blktests-subsystem-"
+
port="$(_create_nvmet_port "${nvme_trtype}")"
_create_nvmet_subsystem "${subsys}1" "$(losetup -f)"
diff --git a/tests/nvme/031 b/tests/nvme/031
index e70898819a86..27b08e96dd0b 100755
--- a/tests/nvme/031
+++ b/tests/nvme/031
@@ -24,15 +24,15 @@ requires() {
}
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-"
local iterations=10
local loop_dev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "$TMPDIR/img"
loop_dev="$(losetup -f --show "$TMPDIR/img")"
diff --git a/tests/nvme/033 b/tests/nvme/033
index 90aee817de5d..5a4fac03bea0 100755
--- a/tests/nvme/033
+++ b/tests/nvme/033
@@ -45,13 +45,14 @@ compare_dev_info() {
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-1"
local nsdev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
port=$(_nvmet_passthru_target_setup "${subsys}")
nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
diff --git a/tests/nvme/034 b/tests/nvme/034
index e0ede717c373..334b2525d1b6 100755
--- a/tests/nvme/034
+++ b/tests/nvme/034
@@ -15,14 +15,15 @@ requires() {
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-1"
local ctrldev
local nsdev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
port=$(_nvmet_passthru_target_setup "${subsys}")
nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
diff --git a/tests/nvme/035 b/tests/nvme/035
index 0896f7bb578d..68a9b608920e 100755
--- a/tests/nvme/035
+++ b/tests/nvme/035
@@ -21,14 +21,15 @@ device_requires() {
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-1"
local ctrldev
local nsdev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
port=$(_nvmet_passthru_target_setup "${subsys}")
nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
diff --git a/tests/nvme/036 b/tests/nvme/036
index 8218c6538dfd..c3fc5d4a948d 100755
--- a/tests/nvme/036
+++ b/tests/nvme/036
@@ -14,13 +14,14 @@ requires() {
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-1"
local ctrldev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
port=$(_nvmet_passthru_target_setup "${subsys}")
nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
diff --git a/tests/nvme/037 b/tests/nvme/037
index fc6c21343652..5a78444b7e78 100755
--- a/tests/nvme/037
+++ b/tests/nvme/037
@@ -13,15 +13,15 @@ requires() {
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-"
local iterations=10
local ctrldev
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
-
for ((i = 0; i < iterations; i++)); do
port=$(_nvmet_passthru_target_setup "${subsys}${i}")
nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" \
diff --git a/tests/nvme/038 b/tests/nvme/038
index 24f02d4ad4d1..5af28da03c36 100755
--- a/tests/nvme/038
+++ b/tests/nvme/038
@@ -19,13 +19,13 @@ requires() {
}
test() {
- local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1"
- local port
-
echo "Running ${TEST_NAME}"
_setup_nvmet
+ local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1"
+ local port
+
mkdir -p "${subsys_path}"
rmdir "${subsys_path}"
diff --git a/tests/nvme/039 b/tests/nvme/039
index f327b54a8d00..73b53d0b949c 100755
--- a/tests/nvme/039
+++ b/tests/nvme/039
@@ -131,12 +131,12 @@ inject_invalid_admin_cmd()
}
test_device() {
+ echo "Running ${TEST_NAME}"
+
local nvme_verbose_errors
local ns_dev
local ctrl_dev
- echo "Running ${TEST_NAME}"
-
if _check_kernel_option NVME_VERBOSE_ERRORS; then
nvme_verbose_errors=true
else
diff --git a/tests/nvme/040 b/tests/nvme/040
index 688a0939a376..3b76753132f3 100755
--- a/tests/nvme/040
+++ b/tests/nvme/040
@@ -17,6 +17,10 @@ requires() {
}
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys="blktests-subsystem-1"
local file_path="${TMPDIR}/img"
local port
@@ -24,9 +28,6 @@ test() {
local nvmedev
local fio_pid
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
truncate -s "${nvme_img_size}" "${file_path}"
loop_dev="$(losetup -f --show "${file_path}")"
diff --git a/tests/nvme/041 b/tests/nvme/041
index 5b04b99b128e..d8937915d622 100755
--- a/tests/nvme/041
+++ b/tests/nvme/041
@@ -20,6 +20,10 @@ requires() {
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local port
local subsys_name="blktests-subsystem-1"
local hostid
@@ -28,8 +32,6 @@ test() {
local hostkey
local ctrldev
- echo "Running ${TEST_NAME}"
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
@@ -38,8 +40,6 @@ test() {
return 1
fi
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "${file_path}"
_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
diff --git a/tests/nvme/042 b/tests/nvme/042
index 8df5ed37aacc..af291cb33a04 100755
--- a/tests/nvme/042
+++ b/tests/nvme/042
@@ -20,6 +20,10 @@ requires() {
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local port
local subsys_name="blktests-subsystem-1"
local hostid
@@ -30,13 +34,9 @@ test() {
local hostkey
local ctrldev
- echo "Running ${TEST_NAME}"
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "${file_path}"
_create_nvmet_subsystem "${subsys_name}" "${file_path}"
diff --git a/tests/nvme/043 b/tests/nvme/043
index 8f4b783a02ff..4a37f91e50c3 100755
--- a/tests/nvme/043
+++ b/tests/nvme/043
@@ -21,6 +21,10 @@ requires() {
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local port
local subsys_name="blktests-subsystem-1"
local hostid
@@ -31,8 +35,6 @@ test() {
local hostkey
local ctrldev
- echo "Running ${TEST_NAME}"
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
@@ -41,8 +43,6 @@ test() {
return 1
fi
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "${file_path}"
_create_nvmet_subsystem "${subsys_name}" "${file_path}"
diff --git a/tests/nvme/044 b/tests/nvme/044
index fca0897af27b..27cb343f5ea7 100755
--- a/tests/nvme/044
+++ b/tests/nvme/044
@@ -21,6 +21,10 @@ requires() {
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local port
local subsys_name="blktests-subsystem-1"
local hostid
@@ -30,8 +34,6 @@ test() {
local ctrlkey
local ctrldev
- echo "Running ${TEST_NAME}"
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
@@ -47,8 +49,6 @@ test() {
return 1
fi
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "${file_path}"
_create_nvmet_subsystem "${subsys_name}" "${file_path}"
diff --git a/tests/nvme/045 b/tests/nvme/045
index eca629a18691..005d62d4f886 100755
--- a/tests/nvme/045
+++ b/tests/nvme/045
@@ -22,6 +22,10 @@ requires() {
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local port
local subsys_name="blktests-subsystem-1"
local hostid
@@ -34,8 +38,6 @@ test() {
local ctrldev
local rand_io_size
- echo "Running ${TEST_NAME}"
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
@@ -51,8 +53,6 @@ test() {
return 1
fi
- _setup_nvmet
-
truncate -s "${nvme_img_size}" "${file_path}"
_create_nvmet_subsystem "${subsys_name}" "${file_path}"
diff --git a/tests/nvme/048 b/tests/nvme/048
index a6ebb8927865..6efcd7d6ab03 100755
--- a/tests/nvme/048
+++ b/tests/nvme/048
@@ -81,6 +81,10 @@ set_qid_max() {
}
test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
local subsys_name="blktests-subsystem-1"
local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}"
local file_path="${TMPDIR}/img"
@@ -89,10 +93,6 @@ test() {
local hostid
local port
- echo "Running ${TEST_NAME}"
-
- _setup_nvmet
-
hostid="${def_hostid}"
hostnqn="${def_hostnqn}"
--
2.41.0
next prev parent reply other threads:[~2023-08-11 9:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 9:36 [PATCH blktests v3 00/13] Switch to allowed_host Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 01/13] nvme/{003,004,005,013,046,049}: Group all variables declarations Daniel Wagner
2023-08-11 9:36 ` Daniel Wagner [this message]
2023-08-11 9:36 ` [PATCH blktests v3 03/13] nvme/043: Use hostnqn to generate DHCAP key Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 04/13] nvme/rc: Add common subsystem nqn define Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 05/13] nvme: Use def_subsysnqn variable instead local variable Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 06/13] nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 07/13] nvme/rc: Add common file_path name define Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 08/13] nvme: Use def_file_path variable instead local variable Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 09/13] nvme/rc: Add common def_subsys_uuid define Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 10/13] nvme: Use def_subsys_uuid variable Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 11/13] nvme/rc: Add helper for adding/removing to allow list Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 12/13] nvme: Add explicitly host to allow_host list Daniel Wagner
2023-08-11 9:36 ` [PATCH blktests v3 13/13] nvme: Introduce nvmet_target_{setup/cleanup} common code Daniel Wagner
2023-08-13 14:55 ` Sagi Grimberg
2023-08-16 9:28 ` Daniel Wagner
2023-08-17 8:33 ` Sagi Grimberg
2023-08-11 10:29 ` [PATCH blktests v3 00/13] Switch to allowed_host Hannes Reinecke
2023-08-13 14:59 ` Sagi Grimberg
2023-08-16 9:31 ` Daniel Wagner
2023-08-16 12:18 ` Shinichiro Kawasaki
2023-08-17 2:58 ` Shinichiro Kawasaki
2023-08-17 8:25 ` Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230811093614.28005-3-dwagner@suse.de \
--to=dwagner@suse.de \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=jsmart2021@gmail.com \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mgurtovoy@nvidia.com \
--cc=sagi@grimberg.me \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox