From: David Disseldorp <ddiss@suse.de>
To: fstests@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>, "Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH v2] tests: _fail on _scratch_mkfs_sized failure
Date: Mon, 29 Apr 2024 21:58:27 +1000 [thread overview]
Message-ID: <20240429115826.9171-1-ddiss@suse.de> (raw)
If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the
provided size, tests may subsequently mount and run atop a previously
created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC
exercising tests, near infinite runtimes. Avoid this by renaming the
current function to _try_scratch_mkfs_sized() and _fail in the parent
_scratch_mkfs_sized() wrapper.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Suggested-by: Darrick J. Wong <djwong@kernel.org>
---
Changes since v1:
- call _fail in a wrapper function, instead of adding failure handlers
to individual test _scratch_mkfs_sized() callers.
common/rc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/rc b/common/rc
index 56f1afb6..e95070dd 100644
--- a/common/rc
+++ b/common/rc
@@ -968,8 +968,8 @@ _small_fs_size_mb()
}
# Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
{
local fssize=$1
local blocksize=$2
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
esac
}
+_scratch_mkfs_sized()
+{
+ _try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized failed"
+}
+
# Emulate an N-data-disk stripe w/ various stripe units
# _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
_scratch_mkfs_geom()
--
2.35.3
next reply other threads:[~2024-04-29 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-29 11:58 David Disseldorp [this message]
2024-04-29 13:44 ` [PATCH v2] tests: _fail on _scratch_mkfs_sized failure Zorro Lang
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=20240429115826.9171-1-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=djwong@kernel.org \
--cc=fstests@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).