Skip to contentSkip to conversation

nvme testsuite runtime optimization

PATCH Superseded Daniel Wagner 1 participant 14 messages Apr 20, 2023 – Apr 21, 2023

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover nvme testsuite runtime optimization

Refactored v1 into more smaller bits and fixed a bunch of bugs alongside. For example the fio jobs size for rand rw used --jobs=$(nproc) which needs to fit with the test device size.

The loop transport runs a few more test but the largest contributer why it runs so much longer are the iteratons in 002. So I made them also configurable.

nvme_num_iter=100 nvme_img_size=350M (new defaults)

loop

  real    4m3.524s
  user    0m7.931s
  sys     1m35.871s

rdma

  real    4m20.559s
  user    0m8.895s
  sys     1m5.714s

tcp

  real    3m55.292s
  user    0m8.654s
  sys     1m15.314s

fc

  real    3m18.977s
  user    0m8.868s
  sys     0m58.655s

nvme_num_iter=1000 nvme_img_size=1G (previous/ defaults)

loop

  real    8m22.109s
  user    0m27.582s
  sys     3m0.484s

rdma

  real    9m1.784s
  user    0m14.274s
  sys     2m5.479s

tcp

  real    8m28.443s
  user    0m13.952s
  sys     2m55.544s

fc

  real    6m24.426s
  user    0m13.944s
  sys     2m2.489s

The fc tests are bit faster because some of them are failing.

changes:
v2:
- made image size configurable via nvme_img_size env
- make number of iteration configurable via nvme_num_iter
- do not hard code test values
- calculate job size
- use runtime for fio background jobs

v1:
- initial version
- https://lore.kernel.org/linux-nvme/[email protected]/

Daniel Wagner (9):
nvme-rc: Auto convert test device size info
nvme: Do not hard code device size for dd test
common-xfs: Make size argument optional for _xfs_run_fio_verify_io
nvme: Use runtime fio background jobs
nvme: Make test image size configurable
nvme-rc: Add minimal test image size requirement
nvme-rc: Calculate IO size for fio jobs
nvme-rc: Move discovery generation counter code to rc
nvme: Make the number iterations configurable

 common/rc          |   30 +-
 common/xfs         |    6 +
 tests/nvme/002     |    6 +-
 tests/nvme/002.out | 3004 --------------------------------------------
 tests/nvme/004     |    2 +-
 tests/nvme/005     |    2 +-
 tests/nvme/006     |    2 +-
 tests/nvme/007     |    2 +-
 tests/nvme/008     |    2 +-
 tests/nvme/009     |    2 +-
 tests/nvme/010     |    6 +-
 tests/nvme/011     |    6 +-
 tests/nvme/012     |    5 +-
 tests/nvme/013     |    5 +-
 tests/nvme/014     |   12 +-
 tests/nvme/015     |   12 +-
 tests/nvme/016     |    2 +-
 tests/nvme/017     |    4 +-
 tests/nvme/018     |    2 +-
 tests/nvme/019     |    2 +-
 tests/nvme/020     |    2 +-
 tests/nvme/021     |    2 +-
 tests/nvme/022     |    2 +-
 tests/nvme/023     |    2 +-
 tests/nvme/024     |    2 +-
 tests/nvme/025     |    2 +-
 tests/nvme/026     |    2 +-
 tests/nvme/027     |    2 +-
 tests/nvme/028     |    2 +-
 tests/nvme/029     |    2 +-
 tests/nvme/030     |   22 +-
 tests/nvme/031     |    2 +-
 tests/nvme/032     |    6 +-
 tests/nvme/034     |    4 +-
 tests/nvme/035     |    4 +-
 tests/nvme/040     |    9 +-
 tests/nvme/041     |    2 +-
 tests/nvme/042     |    2 +-
 tests/nvme/043     |    2 +-
 tests/nvme/044     |    2 +-
 tests/nvme/045     |    6 +-
 tests/nvme/047     |    8 +-
 tests/nvme/048     |    2 +-
 tests/nvme/rc      |   50 +
 44 files changed, 176 insertions(+), 3079 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH v2 1/9 nvme-rc: Auto convert test device size info

Introduce a convert_to_mb() helper which converts the size argument to MBytes and use in test device require function. This makes it possible to use user input strings in future.

---
 common/rc      | 30 +++++++++++++++++++++++++++---
 tests/nvme/035 |  2 +-
 2 files changed, 28 insertions(+), 4 deletions(-)
common/rc +27 -3
index af4c0b1cab22..dd0afda3d821 100644
@@ -324,9 +324,12 @@ _get_pci_parent_from_blkdev() {
 		tail -2 | head -1
 }
 
-_require_test_dev_size_mb() {
-	local require_sz_mb=$1
-	local test_dev_sz_mb=$(($(blockdev --getsize64 "$TEST_DEV")/1024/1024))
+_require_test_dev_size() {
+	local require_sz_mb
+	local test_dev_sz_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	test_dev_sz_mb="$(($(blockdev --getsize64 "$TEST_DEV")/1024/1024))"
 
 	if (( "$test_dev_sz_mb" < "$require_sz_mb" )); then
 		SKIP_REASONS+=("${TEST_DEV} required at least ${require_sz_mb}m")
@@ -422,3 +425,24 @@ _have_writeable_kmsg() {
 _run_user() {
 	su "$NORMAL_USER" -c "$1"
 }
+
+convert_to_mb()
+{
+    local str=$1
+    local res
+
+    res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)$/\1/p')
+    if [[ -n "${res}" ]]; then
+        echo "$((res / 1024 / 1024))"
+    fi
+
+    res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[mM]$/\1/p')
+    if [[ -n "${res}" ]]; then
+        echo "$((res))"
+    fi
+
+    res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[gG]$/\1/p')
+    if [[ -n "${res}" ]]; then
+        echo "$((res * 1024))"
+    fi
+}
tests/nvme/035 +1 -1
index d169e351e3d0..eb1024edddbf 100755
@@ -17,7 +17,7 @@ requires() {
 }
 
 device_requires() {
-	_require_test_dev_size_mb 1024
+	_require_test_dev_size 1024m
 }
 
 test_device() {
Signature · 1 line
2.40.0
#2 lore raw

PATCH v2 2/9 nvme: Do not hard code device size for dd test

In reply to Daniel Wagner

Read the block device sizes instead hard coding them.

---
 tests/nvme/014 | 10 +++++++++-
 tests/nvme/015 | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
tests/nvme/014 +9 -1
index d13cff7921da..28913641ae40 100755
@@ -23,6 +23,9 @@ test() {
 	local port
 	local nvmedev
 	local loop_dev
+	local size
+	local bs
+	local count
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -41,7 +44,12 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+	count=$((size / bs - 1))
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${count}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}" -n 1
 
tests/nvme/015 +9 -1
index bb52ba2598db..2f7957caac88 100755
@@ -22,6 +22,9 @@ test() {
 
 	local port
 	local nvmedev
+	local size
+	local bs
+	local count
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -38,7 +41,12 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+	count=$((size / bs - 1))
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${count}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}n1" -n 1
 
Signature · 1 line
2.40.0
#3 lore raw

PATCH v2 2/4 nvme: Make test image size configurable

In reply to Daniel Wagner

The reduce the overall runtime of the testsuite by making the default size of the test image small. For verification jobs, the default can be overwriten via the newly introduced nvme_img_size environment variable.

---
 tests/nvme/004 |  2 +-
 tests/nvme/005 |  2 +-
 tests/nvme/006 |  2 +-
 tests/nvme/007 |  2 +-
 tests/nvme/008 |  2 +-
 tests/nvme/009 |  2 +-
 tests/nvme/010 |  4 ++--
 tests/nvme/011 |  4 ++--
 tests/nvme/012 |  4 ++--
 tests/nvme/013 |  4 ++--
 tests/nvme/014 | 10 ++++++++--
 tests/nvme/015 | 10 ++++++++--
 tests/nvme/017 |  2 +-
 tests/nvme/018 |  2 +-
 tests/nvme/019 |  2 +-
 tests/nvme/020 |  2 +-
 tests/nvme/021 |  2 +-
 tests/nvme/022 |  2 +-
 tests/nvme/023 |  2 +-
 tests/nvme/024 |  2 +-
 tests/nvme/025 |  2 +-
 tests/nvme/026 |  2 +-
 tests/nvme/027 |  2 +-
 tests/nvme/028 |  2 +-
 tests/nvme/029 |  3 ++-
 tests/nvme/031 |  2 +-
 tests/nvme/032 |  4 ++--
 tests/nvme/034 |  2 +-
 tests/nvme/035 |  4 ++--
 tests/nvme/040 |  4 ++--
 tests/nvme/041 |  2 +-
 tests/nvme/042 |  2 +-
 tests/nvme/043 |  2 +-
 tests/nvme/044 |  2 +-
 tests/nvme/045 |  2 +-
 tests/nvme/047 |  2 +-
 tests/nvme/048 |  2 +-
 tests/nvme/rc  |  1 +
 38 files changed, 60 insertions(+), 46 deletions(-)
tests/nvme/004 +1 -1
index 9dda538b1ac0..cab98ff44326 100755
@@ -25,7 +25,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/005 +1 -1
index de567a74a891..8e15a13f3794 100755
@@ -24,7 +24,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/006 +1 -1
index d993861c06ba..ea0db93791a7 100755
@@ -24,7 +24,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/007 +1 -1
index d53100f3ff7b..243a79f5a254 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/008 +1 -1
index 5568fe46e463..5abc4240ca46 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/009 +1 -1
index 2814c79164ee..491d3c809ab0 100755
@@ -24,7 +24,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/010 +2 -2
index b7b1d5188e9b..2f81610699d4 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
@@ -41,7 +41,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/011 +2 -2
index 4bfe9af084e4..d8504b71d7d5 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -39,7 +39,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/012 +2 -2
index e60082c2e751..1fb36e33d574 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
@@ -44,7 +44,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "${nvme_img_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/013 +2 -2
index 9d60a7df4577..2c6e4d707d3c 100755
@@ -28,7 +28,7 @@ test() {
 
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -41,7 +41,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "${nvme_img_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/014 +8 -2
index d13cff7921da..3f3193bb6583 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
@@ -41,7 +41,13 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	local sectors
+	local bs
+	sectors="$(blockdev --getss "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${sectors}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}" -n 1
 
tests/nvme/015 +8 -2
index bb52ba2598db..20fe17c589e1 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -38,7 +38,13 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	local sectors
+	local bs
+	sectors="$(blockdev --getss "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${sectors}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}n1" -n 1
 
tests/nvme/017 +1 -1
index f2a95cf276cb..0248aee9bc41 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/018 +1 -1
index 315e79534348..78e9b2bb94d8 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/019 +1 -1
index 4cb3509a12b2..9fff8ccaac9c 100755
@@ -28,7 +28,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/020 +1 -1
index 16fdfcc94918..1966d5925213 100755
@@ -26,7 +26,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/021 +1 -1
index 6ee0af1fe158..1fefc0fbca00 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/022 +1 -1
index 1d76ffa44178..1ff915786f86 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/023 +1 -1
index b65be07edc38..90316230a3d7 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/024 +1 -1
index f756797d6f29..384a8266e741 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/025 +1 -1
index 941bf36f67fb..815223d1c28d 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/026 +1 -1
index c3f06c2a377c..d2203f19f026 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/027 +1 -1
index 0ad663ace811..97fe70e78344 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/028 +1 -1
index 7de977a81213..c539620bee28 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/029 +2 -1
index f8b4cbbb9156..1808b7b0edf1 100755
@@ -14,6 +14,7 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_test_dev_size 1M
 }
 
 test_user_io()
@@ -59,7 +60,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/031 +1 -1
index 4e1798246db1..e70898819a86 100755
@@ -33,7 +33,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/032 +2 -2
index 017d4a339971..1a467119a2ff 100755
@@ -38,8 +38,8 @@ test_device() {
 	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	# start fio job
-	_run_fio_rand_io --filename="$TEST_DEV" --size=1g \
-		--group_reporting  &> /dev/null &
+	_run_fio_rand_io --filename="$TEST_DEV" --size=256M \
+		--group_reporting --time_based --runtime=1m > /dev/null &
 
 	sleep 5
 
tests/nvme/034 +1 -1
index f92e5e20865b..e0ede717c373 100755
@@ -26,7 +26,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_run_fio_verify_io --size=950m --filename="${nsdev}"
+	_run_fio_verify_io --size="${nvme_img_size}" --filename="${nsdev}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/035 +2 -2
index eb1024edddbf..0896f7bb578d 100755
@@ -17,7 +17,7 @@ requires() {
 }
 
 device_requires() {
-	_require_test_dev_size 1024m
+	_require_test_dev_size "${nvme_img_size}"
 }
 
 test_device() {
@@ -32,7 +32,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_xfs_run_fio_verify_io "${nsdev}" "900m"
+	_xfs_run_fio_verify_io "${nsdev}" "${nvme_img_size}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/040 +2 -2
index 04bd726cd309..885e5ed68fe6 100755
@@ -25,7 +25,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	_setup_nvmet
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s ${nvme_img_size} "$TMPDIR/img"
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
 	port="$(_create_nvmet_port "${nvme_trtype}")"
@@ -37,7 +37,7 @@ test() {
 
 	# start fio job
 	echo "starting background fio"
-	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size=1g \
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${nvme_img_size}" \
 		--group_reporting --ramp_time=5  &> /dev/null &
 	sleep 5
 
tests/nvme/041 +1 -1
index 03e2dab25918..308655dd6090 100755
@@ -44,7 +44,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/042 +1 -1
index 4ad726f72f5a..fed2efead013 100755
@@ -41,7 +41,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/043 +1 -1
index c031cecf34a5..a030884aa4ed 100755
@@ -42,7 +42,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/044 +1 -1
index f2406ecadf7d..9928bcc55397 100755
@@ -53,7 +53,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/045 +1 -1
index 612e5f168e3c..7c51da27b5f1 100755
@@ -55,7 +55,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/047 +1 -1
index d56d3be185b0..b5a8d469a983 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/048 +1 -1
index b4ee7371eb68..08fdee16c811 100755
@@ -84,7 +84,7 @@ test() {
 	fi
 	hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/rc +1 -0
index 41f196b037d6..e6075e31178f 100644
@@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002"
 def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
+nvme_img_size=${nvme_img_size:-"64M"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0
#4 lore raw

PATCH v2 3/9 common-xfs: Make size argument optional for _xfs_run_fio_verify_io

In reply to Daniel Wagner

Make the size argument optional by reading the filesystem info. The caller doesn't have to guess (or calculate) how big the max IO size. The log data structure of XFS is reducing the capacity.

---
 common/xfs     | 6 ++++++
 tests/nvme/012 | 2 +-
 tests/nvme/013 | 2 +-
 tests/nvme/035 | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)
common/xfs +6 -0
index 2c5d96164ac1..ec35599e017b 100644
@@ -27,6 +27,12 @@ _xfs_run_fio_verify_io() {
 
 	_xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1
 
+	if [[ -z "${sz}" ]]; then
+		local avail
+		avail="$(df --output=avail "${mount_dir}" | awk 'NR==2 {print $1}')"
+		sz="$(printf "%d" $((avail / 1024 - 1 )))m"
+	fi
+
 	_run_fio_verify_io --size="$sz" --directory="${mount_dir}/"
 
 	umount "${mount_dir}" >> "${FULL}" 2>&1
tests/nvme/012 +1 -1
index e60082c2e751..c9d24388306d 100755
@@ -44,7 +44,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/013 +1 -1
index 9d60a7df4577..265b6968fd34 100755
@@ -41,7 +41,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/035 +1 -1
index eb1024edddbf..8b485bc8e682 100755
@@ -32,7 +32,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_xfs_run_fio_verify_io "${nsdev}" "900m"
+	_xfs_run_fio_verify_io "${nsdev}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
Signature · 1 line
2.40.0
#5 lore raw

PATCH v2 3/4 nvme-rc: Move discovery generation counter code to rc

In reply to Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

---
 tests/nvme/002     |    4 +-
 tests/nvme/002.out | 3004 --------------------------------------------
 tests/nvme/030     |   22 +-
 tests/nvme/rc      |   13 +
 4 files changed, 20 insertions(+), 3023 deletions(-)
tests/nvme/002 +3 -1
index 6c6ae5fea89b..6b8484844b4d 100755
@@ -27,12 +27,14 @@ test() {
 	local loop_dev
 	loop_dev="$(losetup -f)"
 
+	local genctr=1
+
 	for ((i = 0; i < iterations; i++)); do
 		_create_nvmet_subsystem "blktests-subsystem-$i" "${loop_dev}"
 		_add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i"
 	done
 
-	_nvme_discover "${nvme_trtype}" | _filter_discovery
+	genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
 
 	for ((i = iterations - 1; i >= 0; i--)); do
 		_remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i"
tests/nvme/002.out +0 -3004

2,985 lines not on this page · raw message

tests/nvme/030 +4 -18
index 20fef696e565..cfcdcbe6be23 100755

Lines of this file are not shown. View the raw message.

tests/nvme/rc +13 -0
index e6075e31178f..8cd89af703bb 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.0

Part of the diff is not shown here. View the raw message.

#6 lore raw

PATCH v2 4/9 nvme: Use runtime fio background jobs

In reply to Daniel Wagner

The fio jobs are supposed to run long in background during the test. Instead relying on a job size use explicit runtime for this.

---
 tests/nvme/032 | 2 +-
 tests/nvme/040 | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
tests/nvme/032 +1 -1
index 017d4a339971..81e074cc11bc 100755
@@ -39,7 +39,7 @@ test_device() {
 
 	# start fio job
 	_run_fio_rand_io --filename="$TEST_DEV" --size=1g \
-		--group_reporting  &> /dev/null &
+		--group_reporting --time_based --runtime=1m &> /dev/null &
 
 	sleep 5
 
tests/nvme/040 +2 -1
index 04bd726cd309..8d29f905adb5 100755
@@ -38,7 +38,8 @@ test() {
 	# start fio job
 	echo "starting background fio"
 	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size=1g \
-		--group_reporting --ramp_time=5  &> /dev/null &
+		--group_reporting --ramp_time=5 \
+		--time_based --runtime=1m &> /dev/null &
 	sleep 5
 
 	# do reset/remove operation
Signature · 1 line
2.40.0
#7 lore raw

PATCH v2 5/9 nvme: Make test image size configurable

In reply to Daniel Wagner

The reduce the overall runtime of the testsuite by making the default size of the test image small. For verification jobs, the default can be overwriten via the newly introduced nvme_img_size environment variable.

The default size of 350M is the minimum requirement of nvme/012 and nvme/013. These tests rely on an xfs filesystem which requires this minimum size.

---
 tests/nvme/004 | 2 +-
 tests/nvme/005 | 2 +-
 tests/nvme/006 | 2 +-
 tests/nvme/007 | 2 +-
 tests/nvme/008 | 2 +-
 tests/nvme/009 | 2 +-
 tests/nvme/010 | 5 +++--
 tests/nvme/011 | 5 +++--
 tests/nvme/012 | 2 +-
 tests/nvme/013 | 2 +-
 tests/nvme/014 | 2 +-
 tests/nvme/015 | 2 +-
 tests/nvme/017 | 2 +-
 tests/nvme/018 | 2 +-
 tests/nvme/019 | 2 +-
 tests/nvme/020 | 2 +-
 tests/nvme/021 | 2 +-
 tests/nvme/022 | 2 +-
 tests/nvme/023 | 2 +-
 tests/nvme/024 | 2 +-
 tests/nvme/025 | 2 +-
 tests/nvme/026 | 2 +-
 tests/nvme/027 | 2 +-
 tests/nvme/028 | 2 +-
 tests/nvme/029 | 3 ++-
 tests/nvme/031 | 2 +-
 tests/nvme/032 | 2 +-
 tests/nvme/034 | 2 +-
 tests/nvme/035 | 2 +-
 tests/nvme/040 | 4 ++--
 tests/nvme/041 | 2 +-
 tests/nvme/042 | 2 +-
 tests/nvme/043 | 2 +-
 tests/nvme/044 | 2 +-
 tests/nvme/045 | 2 +-
 tests/nvme/047 | 2 +-
 tests/nvme/048 | 2 +-
 tests/nvme/rc  | 1 +
 38 files changed, 44 insertions(+), 40 deletions(-)
tests/nvme/004 +1 -1
index 9dda538b1ac0..cab98ff44326 100755
@@ -25,7 +25,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/005 +1 -1
index de567a74a891..8e15a13f3794 100755
@@ -24,7 +24,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/006 +1 -1
index d993861c06ba..ea0db93791a7 100755
@@ -24,7 +24,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/007 +1 -1
index d53100f3ff7b..243a79f5a254 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/008 +1 -1
index 5568fe46e463..5abc4240ca46 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/009 +1 -1
index 2814c79164ee..491d3c809ab0 100755
@@ -24,7 +24,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/010 +3 -2
index b7b1d5188e9b..805f80d40620 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
@@ -41,7 +41,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size=${nvme_img_size} \
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/011 +3 -2
index 4bfe9af084e4..da8cbac11124 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -39,7 +39,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size="${nvme_img_size}" \
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/012 +1 -1
index c9d24388306d..ecf44fcb5a51 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/013 +1 -1
index 265b6968fd34..e249add46295 100755
@@ -28,7 +28,7 @@ test() {
 
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/014 +1 -1
index 28913641ae40..2d00ed392ea8 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/015 +1 -1
index 2f7957caac88..3755cdee00c9 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/017 +1 -1
index f2a95cf276cb..0248aee9bc41 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/018 +1 -1
index 315e79534348..78e9b2bb94d8 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/019 +1 -1
index 4cb3509a12b2..9fff8ccaac9c 100755
@@ -28,7 +28,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/020 +1 -1
index 16fdfcc94918..1966d5925213 100755
@@ -26,7 +26,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/021 +1 -1
index 6ee0af1fe158..1fefc0fbca00 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/022 +1 -1
index 1d76ffa44178..1ff915786f86 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/023 +1 -1
index b65be07edc38..90316230a3d7 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/024 +1 -1
index f756797d6f29..384a8266e741 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/025 +1 -1
index 941bf36f67fb..815223d1c28d 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/026 +1 -1
index c3f06c2a377c..d2203f19f026 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/027 +1 -1
index 0ad663ace811..97fe70e78344 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/028 +1 -1
index 7de977a81213..c539620bee28 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/029 +2 -1
index f8b4cbbb9156..1808b7b0edf1 100755
@@ -14,6 +14,7 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_test_dev_size 1M
 }
 
 test_user_io()
@@ -59,7 +60,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/031 +1 -1
index 4e1798246db1..e70898819a86 100755
@@ -33,7 +33,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/032 +1 -1
index 81e074cc11bc..9f9756b0f959 100755
@@ -38,7 +38,7 @@ test_device() {
 	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	# start fio job
-	_run_fio_rand_io --filename="$TEST_DEV" --size=1g \
+	_run_fio_rand_io --filename="$TEST_DEV" --size="${nvme_img_size}" \
 		--group_reporting --time_based --runtime=1m &> /dev/null &
 
 	sleep 5
tests/nvme/034 +1 -1
index f92e5e20865b..e0ede717c373 100755
@@ -26,7 +26,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_run_fio_verify_io --size=950m --filename="${nsdev}"
+	_run_fio_verify_io --size="${nvme_img_size}" --filename="${nsdev}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/035 +1 -1
index 8b485bc8e682..2c4a25f82937 100755
@@ -17,7 +17,7 @@ requires() {
 }
 
 device_requires() {
-	_require_test_dev_size 1024m
+	_require_test_dev_size "${nvme_img_size}"
 }
 
 test_device() {
tests/nvme/040 +2 -2
index 8d29f905adb5..31b7cafef4be 100755
@@ -25,7 +25,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	_setup_nvmet
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
 	port="$(_create_nvmet_port "${nvme_trtype}")"
@@ -37,7 +37,7 @@ test() {
 
 	# start fio job
 	echo "starting background fio"
-	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size=1g \
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${nvme_img_size}" \
 		--group_reporting --ramp_time=5 \
 		--time_based --runtime=1m &> /dev/null &
 	sleep 5
tests/nvme/041 +1 -1
index 03e2dab25918..308655dd6090 100755
@@ -44,7 +44,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/042 +1 -1
index 4ad726f72f5a..fed2efead013 100755
@@ -41,7 +41,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/043 +1 -1
index c031cecf34a5..a030884aa4ed 100755
@@ -42,7 +42,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/044 +1 -1
index f2406ecadf7d..9928bcc55397 100755
@@ -53,7 +53,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/045 +1 -1
index 612e5f168e3c..7c51da27b5f1 100755
@@ -55,7 +55,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/047 +1 -1
index d56d3be185b0..b5a8d469a983 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/048 +1 -1
index b4ee7371eb68..08fdee16c811 100755
@@ -84,7 +84,7 @@ test() {
 	fi
 	hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/rc +1 -0
index 41f196b037d6..e5ba9a6d5f54 100644
@@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002"
 def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
+nvme_img_size=${nvme_img_size:-"350M"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0
#8 lore raw

PATCH v2 6/9 nvme-rc: Add minimal test image size requirement

In reply to Daniel Wagner

Some tests need a minimal test image size to work correctly. Thus add a helper to check the size and update these tests accordingly.

The image minimum is 4M because some of the test have hard coded values. All tests which use the xfs fio verification job have a minimum requirement of 350M impossed by the xfs filesystem.

---
 tests/nvme/012 |  1 +
 tests/nvme/013 |  1 +
 tests/nvme/029 |  1 -
 tests/nvme/045 |  2 +-
 tests/nvme/rc  | 15 +++++++++++++++
 5 files changed, 18 insertions(+), 2 deletions(-)
tests/nvme/012 +1 -0
index ecf44fcb5a51..efe227538c57 100755
@@ -16,6 +16,7 @@ requires() {
 	_have_fio
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/013 +1 -0
index e249add46295..14e646a19c47 100755
@@ -15,6 +15,7 @@ requires() {
 	_have_xfs
 	_have_fio
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/029 +0 -1
index 1808b7b0edf1..c6d38b42af70 100755
@@ -14,7 +14,6 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
-	_require_test_dev_size 1M
 }
 
 test_user_io()
tests/nvme/045 +1 -1
index 7c51da27b5f1..99012f6bed8f 100755
@@ -120,7 +120,7 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=8m --filename="/dev/${nvmedev}n1"
+	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/rc +15 -0
index e5ba9a6d5f54..b1f2dacae125 100644
@@ -21,6 +21,7 @@ nvme_img_size=${nvme_img_size:-"350M"}
 
 _nvme_requires() {
 	_have_program nvme
+	_require_nvme_test_img_size 4m
 	case ${nvme_trtype} in
 	loop)
 		_have_driver nvme-loop
@@ -94,6 +95,20 @@ _require_test_dev_is_nvme() {
 	return 0
 }
 
+_require_nvme_test_img_size() {
+	local require_sz_mb
+	local nvme_img_size_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	nvme_img_size_mb="$(convert_to_mb "${nvme_img_size}")"
+
+	if (( "${nvme_img_size_mb}" < "$require_sz_mb" )); then
+		SKIP_REASONS+=("nvme_img_size must be at least ${require_sz_mb}m")
+		return 1
+	fi
+	return 0
+}
+
 _require_nvme_trtype() {
 	local trtype
 	for trtype in "$@"; do
Signature · 1 line
2.40.0
#9 lore raw

PATCH v2 7/9 nvme-rc: Calculate IO size for fio jobs

In reply to Daniel Wagner

Introduce two new function to calculate the IO size for fio jobs.

_nvme_calc_io_size() returns the jobs size for _run_fio_verify_io() function. Reduce the max size of the job by one megabyte to make the test more robust not to run out of space by accident. Note these fio calls run with just one jobs.

_nvme_calc_run_io_size() returns the jobs size for _run_fio_rand_io() function. Again, the jobs size is not maxing out the space and most important it takes the number of jobs into account which are created (number of CPUs).

---
 tests/nvme/010 |  5 +++--
 tests/nvme/011 |  5 +++--
 tests/nvme/032 |  6 ++++--
 tests/nvme/034 |  4 +++-
 tests/nvme/040 |  4 +++-
 tests/nvme/045 |  4 +++-
 tests/nvme/047 |  6 ++++--
 tests/nvme/rc  | 20 ++++++++++++++++++++
 8 files changed, 43 insertions(+), 11 deletions(-)
tests/nvme/010 +3 -2
index 805f80d40620..d209335c2158 100755
@@ -25,6 +25,7 @@ test() {
 	local loop_dev
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
+	local io_size
 
 	truncate -s "${nvme_img_size}" "${file_path}"
 
@@ -41,8 +42,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=${nvme_img_size} \
-		--filename="/dev/${nvmedev}n1"
+	io_size="$(_nvme_calc_io_size "${nvme_img_size}")"
+	_run_fio_verify_io --size="${io_size}" --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/011 +3 -2
index da8cbac11124..294ba4333aff 100755
@@ -25,6 +25,7 @@ test() {
 	local file_path
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
+	local io_size
 
 	truncate -s "${nvme_img_size}" "${file_path}"
 
@@ -39,8 +40,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size="${nvme_img_size}" \
-		--filename="/dev/${nvmedev}n1"
+	io_size="$(_nvme_calc_io_size "${nvme_img_size}")"
+	_run_fio_verify_io --size="${io_size}" --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/032 +4 -2
index 9f9756b0f959..ad701cea877d 100755
@@ -33,13 +33,15 @@ test_device() {
 	local sysfs
 	local attr
 	local m
+	local rand_io_size
 
 	pdev="$(_get_pci_dev_from_blkdev)"
 	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	# start fio job
-	_run_fio_rand_io --filename="$TEST_DEV" --size="${nvme_img_size}" \
-		--group_reporting --time_based --runtime=1m &> /dev/null &
+	rand_io_size="$(_nvme_calc_rand_io_size "${nvme_img_size}")"
+	_run_fio_rand_io --filename="$TEST_DEV" --size="${rand_io_size}" \
+		--group_reporting --time_based --runtime=1m > /dev/null &
 
 	sleep 5
 
tests/nvme/034 +3 -1
index e0ede717c373..0df8bef98e5e 100755
@@ -19,6 +19,7 @@ test_device() {
 	local ctrldev
 	local nsdev
 	local port
+	local io_size
 
 	echo "Running ${TEST_NAME}"
 
@@ -26,7 +27,8 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_run_fio_verify_io --size="${nvme_img_size}" --filename="${nsdev}"
+	io_size="$(_nvme_calc_io_size "${nvme_img_size}")"
+	_run_fio_verify_io --size="${io_size}" --filename="${nsdev}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/040 +3 -1
index 31b7cafef4be..b033a2a866f2 100755
@@ -21,6 +21,7 @@ test() {
 	local port
 	local loop_dev
 	local nvmedev
+	local rand_io_size
 
 	echo "Running ${TEST_NAME}"
 
@@ -37,7 +38,8 @@ test() {
 
 	# start fio job
 	echo "starting background fio"
-	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${nvme_img_size}" \
+	rand_io_size="$(_nvme_calc_rand_io_size "${nvme_img_size}")"
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" \
 		--group_reporting --ramp_time=5 \
 		--time_based --runtime=1m &> /dev/null &
 	sleep 5
tests/nvme/045 +3 -1
index 99012f6bed8f..f50087cccb6a 100755
@@ -31,6 +31,7 @@ test() {
 	local ctrlkey
 	local new_ctrlkey
 	local ctrldev
+	local rand_io_size
 
 	echo "Running ${TEST_NAME}"
 
@@ -120,7 +121,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
+	rand_io_size="$(_nvme_calc_rand_io_size 4m)"
+	_run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/047 +4 -2
index b5a8d469a983..6a7599bc2e91 100755
@@ -25,6 +25,7 @@ test() {
 	local port
 	local nvmedev
 	local loop_dev
+	local rand_io_size
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -42,7 +43,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	rand_io_size="$(_nvme_calc_rand_io_size 4M)"
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
 
@@ -50,7 +52,7 @@ test() {
 		--nr-write-queues 1 \
 		--nr-poll-queues 1 || echo FAIL
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
 
tests/nvme/rc +20 -0
index b1f2dacae125..172f510527ed 100644
@@ -150,6 +150,26 @@ _test_dev_nvme_nsid() {
 	cat "${TEST_DEV_SYSFS}/nsid"
 }
 
+_nvme_calc_io_size() {
+	local img_size_mb
+	local io_size_mb
+
+	img_size_mb="$(convert_to_mb "$1")"
+	io_size_mb="$((img_size_mb - 1))"
+
+	echo "${io_size_mb}m"
+}
+
+_nvme_calc_rand_io_size() {
+	local img_size_mb
+	local io_size_mb
+
+	img_size_mb="$(convert_to_mb "$1")"
+	io_size_mb="$(printf "%d" $((((img_size_mb * 1024 * 1024) / $(nproc) - 1) / 1024)))"
+
+	echo "${io_size_mb}k"
+}
+
 _nvme_fcloop_add_rport() {
 	local local_wwnn="$1"
 	local local_wwpn="$2"
Signature · 1 line
2.40.0
#10 lore raw

PATCH v2 8/9 nvme-rc: Move discovery generation counter code to rc

In reply to Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

---
 tests/nvme/002     |    4 +-
 tests/nvme/002.out | 3004 --------------------------------------------
 tests/nvme/030     |   22 +-
 tests/nvme/rc      |   13 +
 4 files changed, 20 insertions(+), 3023 deletions(-)
tests/nvme/002 +3 -1
index 6c6ae5fea89b..6b8484844b4d 100755
@@ -27,12 +27,14 @@ test() {
 	local loop_dev
 	loop_dev="$(losetup -f)"
 
+	local genctr=1
+
 	for ((i = 0; i < iterations; i++)); do
 		_create_nvmet_subsystem "blktests-subsystem-$i" "${loop_dev}"
 		_add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i"
 	done
 
-	_nvme_discover "${nvme_trtype}" | _filter_discovery
+	genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
 
 	for ((i = iterations - 1; i >= 0; i--)); do
 		_remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i"
tests/nvme/002.out +0 -3004

2,985 lines not on this page · raw message

tests/nvme/030 +4 -18
index 20fef696e565..cfcdcbe6be23 100755

Lines of this file are not shown. View the raw message.

tests/nvme/rc +13 -0
index 172f510527ed..2aa34fb0c9b8 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.0

Part of the diff is not shown here. View the raw message.

#11 lore raw

PATCH v2 4/4 nvme: Make the number iterations configurable

In reply to Daniel Wagner

The test hard code the number of iterations certain test should run. Make this variable via the newly introduced nvme_num_iter environment variable.

---
 tests/nvme/002 | 2 +-
 tests/nvme/016 | 2 +-
 tests/nvme/017 | 2 +-
 tests/nvme/031 | 2 +-
 tests/nvme/037 | 2 +-
 tests/nvme/rc  | 1 +
 6 files changed, 6 insertions(+), 5 deletions(-)
tests/nvme/002 +1 -1
index 6b8484844b4d..c28035483514 100755
@@ -20,7 +20,7 @@ test() {
 
 	_setup_nvmet
 
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
tests/nvme/016 +1 -1
index 4eba30223a08..c0c31a55b190 100755
@@ -17,7 +17,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	local port
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local loop_dev
 	local subsys_nqn="blktests-subsystem-1"
 
tests/nvme/017 +1 -1
index 0248aee9bc41..e1674508f654 100755
@@ -18,7 +18,7 @@ test() {
 
 	local port
 	local file_path
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local subsys_name="blktests-subsystem-1"
 
 	_setup_nvmet
tests/nvme/031 +1 -1
index e70898819a86..9b08ec1f6989 100755
@@ -25,7 +25,7 @@ requires() {
 
 test() {
 	local subsys="blktests-subsystem-"
-	local iterations=10
+	local iterations="${nvme_num_iter}"
 	local loop_dev
 	local port
 
tests/nvme/037 +1 -1
index fc6c21343652..de9765af194b 100755
@@ -14,7 +14,7 @@ requires() {
 
 test_device() {
 	local subsys="blktests-subsystem-"
-	local iterations=10
+	local iterations="${nvme_num_iter}"
 	local ctrldev
 	local port
 
tests/nvme/rc +1 -0
index 8cd89af703bb..03b66100423b 100644
@@ -18,6 +18,7 @@ def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"64M"}
+nvme_num_iter=${nvme_num_iter:-"100"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0
#12 lore raw

PATCH v2 9/9 nvme: Make the number iterations configurable

In reply to Daniel Wagner

Some tests hard code high values of iterations. This makes them run relatively long compared to the other tests. Introduce a new environment variable nvme_num_iter to allow tune the runtime.

---
 tests/nvme/002 | 2 +-
 tests/nvme/016 | 2 +-
 tests/nvme/017 | 2 +-
 tests/nvme/rc  | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)
tests/nvme/002 +1 -1
index 6b8484844b4d..c28035483514 100755
@@ -20,7 +20,7 @@ test() {
 
 	_setup_nvmet
 
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
tests/nvme/016 +1 -1
index 4eba30223a08..c0c31a55b190 100755
@@ -17,7 +17,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	local port
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local loop_dev
 	local subsys_nqn="blktests-subsystem-1"
 
tests/nvme/017 +1 -1
index 0248aee9bc41..e1674508f654 100755
@@ -18,7 +18,7 @@ test() {
 
 	local port
 	local file_path
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local subsys_name="blktests-subsystem-1"
 
 	_setup_nvmet
tests/nvme/rc +1 -0
index 2aa34fb0c9b8..bb135502220a 100644
@@ -18,6 +18,7 @@ def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"350M"}
+nvme_num_iter=${nvme_num_iter:-"100"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0