[PATCH blktests v1 02/11] nvme: Reorganize test preamble code section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux