All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: fstests@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH] common/rc: Check SCRATCH_DEV in _require_dm_target()
Date: Tue,  7 Sep 2021 16:41:16 +0900	[thread overview]
Message-ID: <20210907074116.1799114-1-shinichiro.kawasaki@wdc.com> (raw)

When SCRATCH_DEV is not set and the test case does not call
_require_scratch*() before _require_dm_target(), _require_block_device()
called from _require_dm_target() fails to evaluate SCRATCH_DEV and
results in the test case failure. This failure was observed with
generic/628 and generic/629.

To avoid the failures, check SCRATCH_DEV in _require_dm_target(). With
this change, test cases do not need to call _require_scratch*() before
_require_dm_target(). To check SCRATCH_DEV, use simple variable check
instead of _require_scratch*() helper functions, so that each test case
can choose an appropriate function from _require_scratch*().

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/rc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/rc b/common/rc
index dda5da06..b4966af7 100644
--- a/common/rc
+++ b/common/rc
@@ -1971,6 +1971,9 @@ _require_dm_target()
 
 	# require SCRATCH_DEV to be a valid block device with sane BLKFLSBUF
 	# behaviour
+	if [ -z "$SCRATCH_DEV" ]; then
+		_notrun "This test requires a valid \$SCRATCH_DEV for dm $target"
+	fi
 	_require_block_device $SCRATCH_DEV
 	_require_sane_bdev_flush $SCRATCH_DEV
 	_require_command "$DMSETUP_PROG" dmsetup
-- 
2.31.1


             reply	other threads:[~2021-09-07  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  7:41 Shin'ichiro Kawasaki [this message]
2021-09-07  8:15 ` [PATCH] common/rc: Check SCRATCH_DEV in _require_dm_target() Dave Chinner
2021-09-07  9:28   ` Shinichiro Kawasaki
2021-09-07 10:36     ` Dave Chinner
2021-09-08  2:57       ` Shin'ichiro 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=20210907074116.1799114-1-shinichiro.kawasaki@wdc.com \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=fstests@vger.kernel.org \
    --cc=johannes.thumshirn@wdc.com \
    --cc=naohiro.aota@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.