linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yi Zhang <yi.zhang@redhat.com>
To: shinichiro.kawasaki@wdc.com
Cc: chaitanyak@nvidia.com, linux-block@vger.kernel.org
Subject: [PATCH V2 blktests 2/3] common/rc: add one function to check required dev size for TEST_DEV
Date: Wed,  2 Nov 2022 10:57:01 +0800	[thread overview]
Message-ID: <20221102025702.1664101-3-yi.zhang@redhat.com> (raw)
In-Reply-To: <20221102025702.1664101-1-yi.zhang@redhat.com>

nvme/035 has minimum TEST_DEV size requirement, add a helper function
to check it

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
 common/rc      | 10 ++++++++++
 tests/nvme/035 |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/common/rc b/common/rc
index e490041..7987ac3 100644
--- a/common/rc
+++ b/common/rc
@@ -324,6 +324,16 @@ _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))
+
+	if (( "$test_dev_sz_mb" < "$require_sz_mb" )); then
+		SKIP_REASONS+=("${TEST_DEV} required at least ${require_sz_mb}m")
+		return 1
+	fi
+}
+
 _require_test_dev_in_hotplug_slot() {
 	local parent
 	parent="$(_get_pci_parent_from_blkdev)"
diff --git a/tests/nvme/035 b/tests/nvme/035
index ee78a75..e8581ef 100755
--- a/tests/nvme/035
+++ b/tests/nvme/035
@@ -16,6 +16,10 @@ requires() {
 	_have_fio
 }
 
+device_requires() {
+	_require_test_dev_size_mb 1024
+}
+
 test_device() {
 	local subsys="blktests-subsystem-1"
 	local ctrldev
-- 
2.34.1


  parent reply	other threads:[~2022-11-02  2:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  2:56 [PATCH V2 blktests 0/3] fix and improvement for xfs log size change from new xfsprogs version Yi Zhang
2022-11-02  2:57 ` [PATCH V2 blktests 1/3] common/xfs: set the minimal log size 64m during mkfs.xfs Yi Zhang
2022-11-02  2:57 ` Yi Zhang [this message]
2022-11-02  2:57 ` [PATCH V2 blktests 3/3] nvme/012,013,035: change fio I/O size and move size definition place Yi Zhang
2022-11-02  5:43 ` [PATCH V2 blktests 0/3] fix and improvement for xfs log size change from new xfsprogs version Chaitanya Kulkarni
2022-11-04 11:42 ` Shinichiro Kawasaki

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=20221102025702.1664101-3-yi.zhang@redhat.com \
    --to=yi.zhang@redhat.com \
    --cc=chaitanyak@nvidia.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;
as well as URLs for NNTP newsgroup(s).