FS/XFS testing framework
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Zorro Lang <zlang@kernel.org>
Cc: fstests@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
	linux-ext4@vger.kernel.org
Subject: [PATCH 2/8] generic/740: clean up handling of mkfs options
Date: Sun, 23 Jun 2024 14:10:31 +0200	[thread overview]
Message-ID: <20240623121103.974270-3-hch@lst.de> (raw)
In-Reply-To: <20240623121103.974270-1-hch@lst.de>

Use a single case statement instead of lots of conditionals.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/740 | 50 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/tests/generic/740 b/tests/generic/740
index 3deba86b3..fc2ec627f 100755
--- a/tests/generic/740
+++ b/tests/generic/740
@@ -29,27 +29,41 @@ fi
 echo "Silence is golden."
 for fs in `echo ${MKFS_PROG}.* | sed -e "s:${MKFS_PROG}.::g"`
 do
-	preop=""	# for special input needs
+	preop=""	# for special input needs (usually a prompt)
 	preargs=""	# for any special pre-device options
 	postargs=""	# for any special post-device options
 
-	# minix, msdos and vfat mkfs fails for large devices, restrict to 2000 blocks
-	[ $fs = minix ] && postargs=2000
-	[ $fs = msdos ] && postargs=2000
-	[ $fs = vfat ] && postargs=2000
-	# these folks prompt before writing
-	[ $fs = jfs ] && preop="echo Y |"
-	[ $fs = gfs ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
-	[ $fs = gfs2 ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
-	[ $fs = reiserfs ] && preop="echo y |" && preargs="-f"
-	[ $fs = reiser4 ] && preop="echo y |" && preargs="-f"
-	# cramfs mkfs requires a directory argument
-	[ $fs = cramfs ] && preargs=/proc/fs
-	[ $fs = ext2 ] && preargs="-F"
-	[ $fs = ext3 ] && preargs="-F"
-	[ $fs = ext4 ] && preargs="-F"
-	# jffs2 mkfs requires '-r $directory' and '-o $image'
-	[ $fs = jffs2 ] && preargs="-r /proc/fs -o"
+	case "$fs"  in
+	ext2|ext3|ext4)
+		preargs="-F"
+		;;
+	cramfs)
+		# cramfs mkfs requires a directory argument
+		preargs=/proc/fs
+		;;
+	gfs|gfs2)
+		preop="echo y |"
+		preargs="-p lock_nolock -j 1"
+		;;
+	jffs2)
+		# jffs2 mkfs requires '-r $directory' and '-o $image'
+		preargs="-r /proc/fs -o"
+		;;
+	jfs)
+		preop="echo Y |"
+		;;
+	minix|msdos|vfat)
+		# minix, msdos and vfat mkfs fails for large devices,
+		# restrict to 2000 blocks
+		postargs=2000
+		;;
+	reiserfs|reiser4)
+		preop="echo y |"
+		preargs="-f"
+		;;
+	*)
+		;;
+	esac
 
 	# overwite the first few Kb - should blow away superblocks
 	$here/src/devzero -n 20 $SCRATCH_DEV >/dev/null
-- 
2.43.0


  parent reply	other threads:[~2024-06-23 12:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 12:10 mostly remove _supported_fs Christoph Hellwig
2024-06-23 12:10 ` [PATCH 1/8] remove support for ext4dev Christoph Hellwig
2024-06-23 12:10 ` Christoph Hellwig [this message]
2024-06-23 12:10 ` [PATCH 3/8] generic/740: pass the --quick option to mkfs.ntfs Christoph Hellwig
2024-06-23 12:10 ` [PATCH 4/8] generic/740: skip jffs2 as foreign fs earlier Christoph Hellwig
2024-06-23 12:10 ` [PATCH 5/8] generic/740: enable by default Christoph Hellwig
2024-06-24 16:16   ` Darrick J. Wong
2024-06-25  3:50     ` Theodore Ts'o
2024-06-25  6:00       ` Christoph Hellwig
2024-06-25 20:05         ` Theodore Ts'o
2024-06-26  4:01           ` Christoph Hellwig
2024-06-23 12:10 ` [PATCH 6/8] generic/745: rework support fs checking Christoph Hellwig
2024-06-23 12:10 ` [PATCH 7/8] generic/746: clean up fs support Christoph Hellwig
2024-06-23 12:10 ` [PATCH 8/8] remove spurious _supported_fs calls Christoph Hellwig
2024-06-24  2:17 ` mostly remove _supported_fs David Disseldorp
2024-06-24 16:17 ` Darrick J. Wong
2024-07-10  6:16 ` Christoph Hellwig
2024-07-11 13:16   ` 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=20240623121103.974270-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=zlang@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