btrfs: test cleaning up of the stale device
[xfstests-dev.git] / tests / xfs / 107
index 7640bff3479bb2f27fabc107febd1ab4d36520b8..da052290d3eade2cf920c522b7c91648601fbade 100755 (executable)
@@ -1,40 +1,17 @@
 #! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+#
 # FS QA Test No. 107
 #
 # Project quota.
 # Use of "sync" mount option here is an attempt to get deterministic
 # allocator behaviour.
 #
-#-----------------------------------------------------------------------
-# Copyright (c) 2005 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
-#
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1       # failure is the default!
-trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+. ./common/preamble
+_begin_fstest quota
 
-# get standard environment, filters and checks
-. ./common/rc
+# Import common functions.
 . ./common/filter
 . ./common/quota
 
@@ -51,7 +28,6 @@ s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
 }
 
 _supported_fs xfs
-_supported_os Linux
 _require_scratch
 _require_xfs_quota
 
@@ -109,17 +85,17 @@ $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
 
 echo "### initial report"
-xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give warnings"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### recursively setup the project"
-xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give no warnings now"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### deny a hard link - wrong project ID"
 rm -f $SCRATCH_MNT/outer $target/inner
@@ -131,7 +107,7 @@ if [ $? -eq 0 ]; then
 else
        echo hard link failed
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### allow a hard link - right project ID"
 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
@@ -142,12 +118,12 @@ else
        echo hard link failed
        ls -ld $SCRATCH_MNT/outer $target/inner
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### recursively clear the project"
-xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 #no output...
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 status=0
 exit