From: John Garry <john.g.garry@oracle.com>
To: linux-block@vger.kernel.org, shinichiro.kawasaki@wdc.com
Cc: John Garry <john.g.garry@oracle.com>
Subject: [PATCH blktests v2 2/9] nvme: relocate _nvme_requires and _require_nvme_test_img_size
Date: Mon, 22 Sep 2025 10:24:26 +0000 [thread overview]
Message-ID: <20250922102433.1586402-3-john.g.garry@oracle.com> (raw)
In-Reply-To: <20250922102433.1586402-1-john.g.garry@oracle.com>
Helper _nvme_requires will be required for md atomics NVMe testing, so
relocate to a common file.
Helper _require_nvme_test_img_size is referenced by _nvme_requires, so
relocate that as well.
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
common/nvme | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/rc | 72 ---------------------------------------------------
2 files changed, 72 insertions(+), 72 deletions(-)
diff --git a/common/nvme b/common/nvme
index 8de41fa..26b3b97 100644
--- a/common/nvme
+++ b/common/nvme
@@ -1102,3 +1102,75 @@ _nvmet_target_cleanup() {
_cleanup_blkdev
fi
}
+
+_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
+}
+
+_nvme_requires() {
+ _require_nvme_test_img_size 4m
+ case ${nvme_trtype} in
+ loop)
+ _have_driver nvme-loop
+ _have_configfs
+ ;;
+ pci)
+ _have_driver nvme
+ ;;
+ tcp)
+ _have_driver nvme-tcp
+ _have_driver nvmet-tcp
+ _have_configfs
+ ;;
+ rdma)
+ _have_driver nvme-rdma
+ _have_driver nvmet-rdma
+ _have_configfs
+ _have_program rdma
+ if [ -n "$USE_RXE" ]; then
+ _have_driver rdma_rxe
+ else
+ _have_driver siw
+ fi
+ ;;
+ fc)
+ _have_driver nvme-fc
+ _have_driver nvme-fcloop
+ _have_configfs
+ def_adrfam="fc"
+ ;;
+ esac
+
+ if [[ -n ${nvme_adrfam} ]]; then
+ case ${nvme_adrfam} in
+ ipv6)
+ def_traddr="::1"
+ def_adrfam="ipv6"
+ ;;
+ ipv4)
+ ;; # was already set
+ fc)
+ def_adrfam="fc"
+ ;;
+ *)
+ # ignore for non ip transports
+ if [[ "${nvme_trtype}" == "tcp" ||
+ "${nvme_trtype}" == "rdma" ]]; then
+ SKIP_REASONS+=("unsupported nvme_adrfam=${nvme_adrfam}")
+ return 1
+ fi
+ esac
+ fi
+
+ return 0
+}
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 6d86ad4..33055ef 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -54,64 +54,6 @@ _set_nvmet_blkdev_type() {
COND_DESC="bd=${nvmet_blkdev_type}"
}
-_nvme_requires() {
- _require_nvme_test_img_size 4m
- case ${nvme_trtype} in
- loop)
- _have_driver nvme-loop
- _have_configfs
- ;;
- pci)
- _have_driver nvme
- ;;
- tcp)
- _have_driver nvme-tcp
- _have_driver nvmet-tcp
- _have_configfs
- ;;
- rdma)
- _have_driver nvme-rdma
- _have_driver nvmet-rdma
- _have_configfs
- _have_program rdma
- if [ -n "$USE_RXE" ]; then
- _have_driver rdma_rxe
- else
- _have_driver siw
- fi
- ;;
- fc)
- _have_driver nvme-fc
- _have_driver nvme-fcloop
- _have_configfs
- def_adrfam="fc"
- ;;
- esac
-
- if [[ -n ${nvme_adrfam} ]]; then
- case ${nvme_adrfam} in
- ipv6)
- def_traddr="::1"
- def_adrfam="ipv6"
- ;;
- ipv4)
- ;; # was already set
- fc)
- def_adrfam="fc"
- ;;
- *)
- # ignore for non ip transports
- if [[ "${nvme_trtype}" == "tcp" ||
- "${nvme_trtype}" == "rdma" ]]; then
- SKIP_REASONS+=("unsupported nvme_adrfam=${nvme_adrfam}")
- return 1
- fi
- esac
- fi
-
- return 0
-}
-
group_setup() {
if [[ -n "${nvme_target_control}" ]]; then
NVMET_TRTYPES="$(${nvme_target_control} config --show-trtype)"
@@ -186,20 +128,6 @@ _test_dev_disables_extended_lba() {
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_cli_auth() {
if ! nvme gen-dhchap-key --nqn nvmf-test-subsys > /dev/null 2>&1 ; then
SKIP_REASONS+=("nvme gen-dhchap-key command missing")
--
2.43.5
next prev parent reply other threads:[~2025-09-22 10:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 10:24 [PATCH blktests v2 0/9] Further stacked device atomic writes testing John Garry
2025-09-22 10:24 ` [PATCH blktests v2 1/9] common/rc: add _min() John Garry
2025-09-22 10:24 ` John Garry [this message]
2025-09-22 10:24 ` [PATCH blktests v2 3/9] nvme: relocate _require_test_dev_is_nvme John Garry
2025-09-22 10:24 ` [PATCH blktests v2 4/9] md/rc: add _md_atomics_test John Garry
2025-09-22 10:24 ` [PATCH blktests v2 5/9] md/002: convert to use _md_atomics_test John Garry
2025-09-22 10:24 ` [PATCH blktests v2 6/9] md/003: add NVMe atomic write tests for stacked devices John Garry
2025-09-25 8:39 ` Shinichiro Kawasaki
2025-09-25 8:46 ` John Garry
2025-09-25 14:12 ` Shinichiro Kawasaki
2025-09-25 14:14 ` John Garry
2025-09-25 15:02 ` John Garry
2025-09-25 23:53 ` Shinichiro Kawasaki
2025-09-22 10:24 ` [PATCH blktests v2 7/9] md/rc: test atomic writes for dm-linear John Garry
2025-09-22 10:24 ` [PATCH blktests v2 8/9] md/rc: test atomic writes for dm-stripe John Garry
2025-09-22 10:24 ` [PATCH blktests v2 9/9] md/rc: test atomic writes for dm-mirror John Garry
2025-09-25 14:09 ` [PATCH blktests v2 0/9] Further stacked device atomic writes testing Shinichiro Kawasaki
2025-09-25 14:13 ` John Garry
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=20250922102433.1586402-3-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--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