xfs: add a _require_xfs_copy helper
[xfstests-dev.git] / tests / xfs / 073
index 45a3fdf6acadf05b293be0faf496cd15ead07de4..dc0cde4f2f909d27b1b3654e7b0530261f7ba78d 100755 (executable)
@@ -1,27 +1,11 @@
 #! /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
 echo "QA output created by $seq"
@@ -33,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/$$
@@ -40,7 +25,7 @@ imgs=$TEST_DIR/$$
 _cleanup()
 {
        cd /
-       umount $SCRATCH_MNT 2>/dev/null
+       _scratch_unmount 2>/dev/null
        umount $imgs.loop 2>/dev/null
        [ -d $imgs.loop ] && rmdir $imgs.loop
        umount $imgs.source_dir 2>/dev/null
@@ -106,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
@@ -127,22 +112,20 @@ _verify_copy()
 _supported_fs xfs
 _supported_os Linux
 _require_test
-
-[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
-[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
-
+_require_attrs
+_require_xfs_copy
 _require_scratch
 _require_loop
 
 rm -f $seqres.full
 
-_scratch_mkfs_xfs -m crc=0 -dsize=41m,agcount=2 | _filter_mkfs 2>/dev/null
-_scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
+_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_XFS_PROG} -m crc=0 -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