xfs: refactor calls to xfs_admin
[xfstests-dev.git] / tests / xfs / 287
index b9276a7299c3f118055b15a41faf24b213943453..f77ed2f1ee63b51e4c1b11a238067581461192a8 100755 (executable)
@@ -1,28 +1,12 @@
 #! /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.
+# FS QA Test No. 287
 #
-# 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
-#
-#-----------------------------------------------------------------------
+# Test to verify project quota xfs_admin, xfsdump/xfsrestore and
+# xfs_db functionality
 #
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -39,17 +23,16 @@ rm -f $seqres.full
 
 _cleanup()
 {
+       _cleanup_dump
        cd /
-       umount $SCRATCH_MNT 2>/dev/null
        rm -rf $tmp.*
 }
 
 _print_projid()
 {
-       $XFS_DB_PROG -r -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
@@ -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"