linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Stefan Behrens <sbehrens@giantdisaster.de>
Subject: [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly
Date: Tue, 26 Feb 2013 14:42:38 -0600	[thread overview]
Message-ID: <512D1E3E.9050907@redhat.com> (raw)

I added an "-f" option to mkfs.btrfs to force overwrite
of an existing filesystem.  Now on an xfstests run, new
mkfs.btrfs requires it, and old mkfs.btrfs cannot accept
it.

So, add a helper which works out whether -f is needed,
and add it to the MKFS_BTRFS_PROG env. var as necessary,
so that it is an always-included option during the tests.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common.config b/common.config
index 57f505d..9f1d309 100644
--- a/common.config
+++ b/common.config
@@ -101,6 +101,17 @@ set_prog_path()
     return 1
 }
 
+# Handle mkfs.btrfs which does (or does not) require -f to overwrite
+set_btrfs_mkfs_prog_path_with_opts()
+{
+	p=`set_prog_path mkfs.btrfs`
+	if grep -q 'force overwrite' $p; then
+		echo "$p -f"
+	else
+		echo $p
+	fi
+}
+
 _fatal()
 {
     echo "$*"
@@ -185,7 +196,7 @@ case "$HOSTOS" in
     Linux)
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_prog_path mkfs.btrfs`"
+        export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
         export MKFS_NFS_PROG="false"


             reply	other threads:[~2013-02-26 20:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 20:42 Eric Sandeen [this message]
2013-03-05 20:23 ` [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly Rich Johnston
2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
2013-03-05 22:47   ` Rich Johnston
2013-03-06 13:03   ` Rich Johnston

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=512D1E3E.9050907@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sbehrens@giantdisaster.de \
    --cc=xfs@oss.sgi.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 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).