]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: avoid mkfs option conflicts in _scratch_mkfs_xfs_supported
authorEryu Guan <eguan@redhat.com>
Fri, 15 Jul 2016 04:20:51 +0000 (12:20 +0800)
committerEryu Guan <eguan@redhat.com>
Mon, 18 Jul 2016 03:21:41 +0000 (11:21 +0800)
In recent mkfs.xfs updates in xfsprogs, commit 9090e187bc3e ("mkfs:
add respecification detection to generic parsing") added
re-specification detection to "-m" option, it causes several tests
_notrun if MKFS_OPTIONS has the same options as those being tested
in _scratch_mkfs_xfs_supported(), because they're specified multiple
times.

MKFS_OPTIONS="-m crc=0" ./check xfs/001
xfs/001 3s ... [not run] mkfs.xfs doesn't have crc feature

Fix it by creating XFS again without MKFS_OPTIONS in
_scratch_mkfs_xfs_supported(), in case there's conflict between
MKFS_OPTIONS and mkfs_opts, like what we do in _scratch_mkfs_xfs().

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc

index ad03b7030ee6528b1f844c6d6593d386e49e8c2a..aadf35e50ea0ea90e2cfa2064c6fb4616a7281a7 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -473,11 +473,20 @@ _scratch_mkfs_xfs_opts()
 
 _scratch_mkfs_xfs_supported()
 {
-       mkfs_opts=$*
+       local mkfs_opts=$*
 
        _scratch_options mkfs
 
        $MKFS_XFS_PROG -N $MKFS_OPTIONS $SCRATCH_OPTIONS $mkfs_opts $SCRATCH_DEV
+       local mkfs_status=$?
+
+       # a mkfs failure may be caused by conflicts between $MKFS_OPTIONS and
+       # $mkfs_opts, try again without $MKFS_OPTIONS
+       if [ $mkfs_status -ne 0 -a -n "$mkfs_opts" ]; then
+               $MKFS_XFS_PROG -N $SCRATCH_OPTIONS $mkfs_opts $SCRATCH_DEV
+               mkfs_status=$?
+       fi
+       return $mkfs_status
 }
 
 _scratch_mkfs_xfs()