public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: John Pittman <jpittman@redhat.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH blktests 1/2] common/rc: support multiple arguments for _require_test_dev_sysfs()
Date: Fri, 16 Jan 2026 13:04:28 +0000	[thread overview]
Message-ID: <aWo3H2Lb2E8K4pIY@shinmob> (raw)
In-Reply-To: <20260114210809.2195262-2-jpittman@redhat.com>

On Jan 14, 2026 / 16:08, John Pittman wrote:
> 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..e4b5196 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 ret=0

Nit: it's a bit safer to declare "attr" as a local variable here.

> +	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-16 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 21:08 [PATCH blktests 0/2] blktests: add ability for multiple dev sysfs checks John Pittman
2026-01-14 21:08 ` [PATCH blktests 1/2] common/rc: support multiple arguments for _require_test_dev_sysfs() John Pittman
2026-01-16 13:04   ` Shinichiro Kawasaki [this message]
2026-01-14 21:08 ` [PATCH blktests 2/2] block/042: check sysfs values prior to running John Pittman
2026-01-16 13:03   ` Shinichiro Kawasaki
2026-01-20 16:16     ` John Pittman
2026-01-21  1:38       ` 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=aWo3H2Lb2E8K4pIY@shinmob \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=jpittman@redhat.com \
    --cc=linux-block@vger.kernel.org \
    /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