fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Subject: [PATCH] common/rc: specifically make new xfs in _test_mkfs
Date: Thu, 11 Mar 2021 20:12:13 +0800	[thread overview]
Message-ID: <20210311121213.1348303-1-zlang@redhat.com> (raw)

When we test different filesystems with different sections in config
file, always hit below failure:
   ...
   our local _test_mkfs routine ...
   mkfs.xfs: /dev/vdb1 appears to contain an existing filesystem (xfs)
   mkfs.xfs: Use the -f option to force overwrite.
   check: failed to mkfs $TEST_DEV using specified options
   ...

To fix this problem, change the _test_mkfs to deal with xfs creation
properly. Due to xfstests uses _test_mkfs rarely, currently only in
check program, so I don't intend to write a whole new series of
_test_mkfs_xfs_* functions likes what _scratch_mkfs_xfs_* does.

Reported-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Zorro Lang <zlang@redhat.com>
---
 common/rc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/rc b/common/rc
index 0ce3cb0d..c783def7 100644
--- a/common/rc
+++ b/common/rc
@@ -258,6 +258,7 @@ _test_options()
 
     case $type in
     mkfs)
+	TEST_OPTIONS="$TEST_OPTIONS -f"
 	rt_opt="-r"
         log_opt="-l"
 	;;
@@ -633,6 +634,15 @@ _test_mkfs()
     ext2|ext3|ext4)
 	$MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV
 	;;
+    xfs)
+	local mkfs_opts=$*
+
+	if [ -n "$XFS_MKFS_HAS_NO_META_SUPPORT" ]; then
+		mkfs_opts=`echo $mkfs_opts | sed "s/-m\s\+\S\+//g"`
+	fi
+	_test_options mkfs
+	$MKFS_XFS_PROG $TEST_OPTIONS $MKFS_OPTIONS $mkfs_opts $TEST_DEV
+	;;
     *)
 	yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* $TEST_DEV
 	;;
-- 
2.29.2


             reply	other threads:[~2021-03-11 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 12:12 Zorro Lang [this message]
2021-03-14 11:42 ` [PATCH] common/rc: specifically make new xfs in _test_mkfs Eryu Guan
2021-03-14 14:34   ` Zorro Lang
2021-03-14 15:58     ` Eryu Guan

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=20210311121213.1348303-1-zlang@redhat.com \
    --to=zlang@redhat.com \
    --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 NNTP newsgroup(s).