]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: handle new mkfs.btrfs -f option cleanly
authorEric Sandeen <sandeen@redhat.com>
Tue, 26 Feb 2013 20:42:38 +0000 (20:42 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 5 Mar 2013 20:17:25 +0000 (14:17 -0600)
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>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common.config

index 43549699ecfb27caf25fa7bfc5c519b749a77a5e..c10163a8d0d70001bf1f795c3b43b709ec8b80cd 100644 (file)
@@ -104,6 +104,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 "$*"
@@ -192,7 +203,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"