public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: John Pittman <jpittman@redhat.com>
To: shinichiro.kawasaki@wdc.com
Cc: linux-block@vger.kernel.org, John Pittman <jpittman@redhat.com>
Subject: [PATCH blktests v2 1/2] common/rc: support multiple arguments for _require_test_dev_sysfs()
Date: Thu, 22 Jan 2026 14:31:32 -0500	[thread overview]
Message-ID: <20260122193133.3087906-2-jpittman@redhat.com> (raw)
In-Reply-To: <20260122193133.3087906-1-jpittman@redhat.com>

In some cases we may need to check multiple sysfs values for tests.
If this happens, create the ability to pass in multiple arguments to
_require_test_dev_sysfs() instead of having to call the function
multiple times.

Signed-off-by: John Pittman <jpittman@redhat.com>
---
 common/rc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/common/rc b/common/rc
index b76a856..f09ba8b 100644
--- a/common/rc
+++ b/common/rc
@@ -326,11 +326,14 @@ _test_dev_is_rotational() {
 }
 
 _require_test_dev_sysfs() {
-	if [[ ! -e "${TEST_DEV_SYSFS}/$1" ]]; then
-		SKIP_REASONS+=("${TEST_DEV} does not have sysfs attribute $1")
-		return 1
-	fi
-	return 0
+	local attr ret=0
+	for attr in "$@"; do
+		if [[ ! -e "${TEST_DEV_SYSFS}/$attr" ]]; then
+			SKIP_REASONS+=("${TEST_DEV} does not have sysfs attribute $attr")
+			ret=1
+		fi
+	done
+	return $ret
 }
 
 _require_test_dev_is_rotational() {
-- 
2.51.1


  reply	other threads:[~2026-01-22 19:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 19:31 [PATCH blktests v2 0/2] blktests: add ability for multiple dev sysfs checks John Pittman
2026-01-22 19:31 ` John Pittman [this message]
2026-01-22 19:31 ` [PATCH blktests v2 2/2] block/042: check sysfs values prior to running John Pittman
2026-01-25  7:17 ` [PATCH blktests v2 0/2] blktests: add ability for multiple dev sysfs checks 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=20260122193133.3087906-2-jpittman@redhat.com \
    --to=jpittman@redhat.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