A recent change to XFSQA to resolve mkfs option conflicts means mkfs can be run twice...
[xfstests-dev.git] / common.rc
index 019476f2443519803fc008ca3c5ea22a023b45e8..a51ac70917806f3cbc56951a3b28650e04fea58e 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -197,9 +197,14 @@ _scratch_mkfs_xfs()
     # extra mkfs options can be added by tests
     local extra_mkfs_options=$*
 
+    local tmp_dir=/tmp/
+
     _scratch_options mkfs
 
-    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV
+    # save mkfs output in case conflict means we need to run again.
+    # only the output for the mkfs that applies should be shown
+    $MKFS_XFS_PROG $SCRATCH_OPTIONS $MKFS_OPTIONS $extra_mkfs_options $SCRATCH_DEV \
+        2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd
     local mkfs_status=$?
 
     # a mkfs failure may be caused by conflicts between
@@ -210,12 +215,19 @@ _scratch_mkfs_xfs()
             >>$here/$seq.full
         echo "** attempting to mkfs using only test $seq options: $extra_mkfs_options **" \
             >>$here/$seq.full
-        $MKFS_XFS_PROG $SCRATCH_OPTIONS $extra_mkfs_options $SCRATCH_DEV
+        # running mkfs again. overwrite previous mkfs output files
+        $MKFS_XFS_PROG $SCRATCH_OPTIONS $extra_mkfs_options $SCRATCH_DEV \
+            2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd
         mkfs_status=$?
     fi
 
+    # output stored mkfs output
+    cat $tmp_dir.mkfserr >&2
+    cat $tmp_dir.mkfsstd
+    rm -f $tmp_dir.mkfserr $tmp_dir.mkfsstd
+
     if [ "$USE_BIG_LOOPFS" = yes ]; then
-       [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
+        [ -z "$RETAIN_AG_BYTES" ] && RETAIN_AG_BYTES=0
         ./tools/ag-wipe -q -r $RETAIN_AG_BYTES $SCRATCH_DEV
     fi