xfs: refactor calls to xfs_admin
[xfstests-dev.git] / tests / xfs / 287
old mode 100644 (file)
new mode 100755 (executable)
index 5247de3..f77ed2f
@@ -1,32 +1,14 @@
 #! /bin/bash
-# FS QA Test No. 285
-#
-# Test to verify project quota xfs_admin, xfsdump/xfsrestore and
-# xfs_db functionality
-#
-#-----------------------------------------------------------------------
+# SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2012 Red Hat, 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. 287
 #
-#-----------------------------------------------------------------------
+# Test to verify project quota xfs_admin, xfsdump/xfsrestore and
+# xfs_db functionality
 #
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
-seqres=$RESULT_DIR/$seq
-seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 tmp=/tmp/$$
 here=`pwd`
@@ -37,20 +19,20 @@ rm -f $seqres.full
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/quota
+. ./common/dump
 
 _cleanup()
 {
+       _cleanup_dump
        cd /
-       umount $SCRATCH_MNT 2>/dev/null
        rm -rf $tmp.*
 }
 
 _print_projid()
 {
-       $XFS_DB_PROG -c "inode $1" \
+       _scratch_xfs_db -r -c "inode $1" \
                -c "print core.projid_lo" \
-               -c "print core.projid_hi" \
-               $SCRATCH_DEV
+               -c "print core.projid_hi"
 }
 
 # real QA test starts here
@@ -58,6 +40,7 @@ _supported_fs xfs
 _require_xfs_quota
 _require_scratch
 _require_projid32bit
+_require_projid16bit
 
 # create xfs fs without projid32bit ability, will be gained by xfs_admin
 _scratch_mkfs_xfs -i projid32bit=0 -d size=200m >> $seqres.full \
@@ -84,10 +67,10 @@ echo "No 32bit project quotas:"
 $XFS_IO_PROG -r -c "lsproj" $dir/16bit
 $XFS_IO_PROG -r -c "lsproj" $dir/32bit
 
-umount $SCRATCH_MNT
+_scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
-xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
+_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"
@@ -129,7 +112,7 @@ $XFS_IO_PROG -r -c "lsproj" $restore_dir/16bit
 $XFS_IO_PROG -r -c "lsproj" $restore_dir/32bit
 $XFS_IO_PROG -r -c "lsproj" $restore_dir/32bitv2
 
-umount $SCRATCH_MNT
+_scratch_unmount
 
 # Now, we can examine the file systems with xfs_db
 echo "These two values of 16bit project quota ids shall be the same"