xfs: add a _require_xfs_copy helper
[xfstests-dev.git] / tests / xfs / 073
index 72fdba56bad024a076aa615a4eacae6758087059..dc0cde4f2f909d27b1b3654e7b0530261f7ba78d 100755 (executable)
@@ -1,31 +1,13 @@
 #! /bin/bash
-# FS QA Test No. 073
-#
-# Test xfs_copy
-#
-#-----------------------------------------------------------------------
+# SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2000-2003,2008 Silicon Graphics, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# FS QA Test No. 073
 #
-#-----------------------------------------------------------------------
+# Test xfs_copy
 #
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
-seqres=$RESULT_DIR/$seq
-seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
 here=`pwd`
@@ -35,6 +17,7 @@ status=1      # failure is the default!
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/filter
+. ./common/attr
 
 # don't put fs images in /tmp
 imgs=$TEST_DIR/$$
@@ -42,10 +25,10 @@ imgs=$TEST_DIR/$$
 _cleanup()
 {
        cd /
-       umount $SCRATCH_MNT 2>/dev/null
-       umount -d $imgs.loop 2>/dev/null
+       _scratch_unmount 2>/dev/null
+       umount $imgs.loop 2>/dev/null
        [ -d $imgs.loop ] && rmdir $imgs.loop
-       umount -d $imgs.source_dir 2>/dev/null
+       umount $imgs.source_dir 2>/dev/null
        [ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
        rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
 }
@@ -90,7 +73,7 @@ _verify_copy()
 
        mount -t xfs -o loop $target $target_dir 2>/dev/null
        if [ $? -ne 0 ]; then
-               echo retrying mount with nouuid option
+               echo retrying mount with nouuid option >>$seqres.full
                mount -t xfs -o loop -o nouuid $target $target_dir
                if [ $? -ne 0 ]; then
                        echo mount failed - evil!
@@ -108,11 +91,11 @@ _verify_copy()
        diff -u $tmp.manifest1 $tmp.manifest2
 
        echo comparing new image geometry to old
-       xfs_info $source_dir \
+       $XFS_INFO_PROG $source_dir \
                | _filter_copy $source $source_dir '/dev/loop.' '#' \
                | tr -s ' ' \
                > $tmp.geometry1
-       xfs_info $target_dir \
+       $XFS_INFO_PROG $target_dir \
                | _filter_copy $target $target_dir '/dev/loop.' '#' \
                | tr -s ' ' \
                > $tmp.geometry2
@@ -121,28 +104,28 @@ _verify_copy()
 
        echo unmounting and removing new image
        umount $source_dir
-       umount -d $target_dir > /dev/null 2>&1
+       umount $target_dir > /dev/null 2>&1
        rm -f $target
 }
 
-
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-
-[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
-[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
-
+_require_test
+_require_attrs
+_require_xfs_copy
 _require_scratch
 _require_loop
 
-_scratch_mkfs_xfs -dsize=41m,agcount=2 | _filter_mkfs 2>/dev/null
-_scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
+rm -f $seqres.full
+
+_scratch_mkfs_xfs -dsize=41m,agcount=2 >>$seqres.full 2>&1
+_scratch_mount
 
 echo
 echo === populating scratch device
 _populate_scratch
-umount $SCRATCH_MNT 2>/dev/null
+_scratch_unmount 2>/dev/null
 
 echo
 echo === copying scratch device to single target
@@ -156,7 +139,8 @@ _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
 
 echo 
 echo === copying scratch device to single target, large ro device
-${MKFS_PROG}.xfs -dfile,name=$imgs.source,size=100g | _filter_mkfs 2>/dev/null
+${MKFS_XFS_PROG} -dfile,name=$imgs.source,size=100g \
+       | _filter_mkfs 2>/dev/null
 rmdir $imgs.source_dir 2>/dev/null
 mkdir $imgs.source_dir