fstests: move now-generic xfs project quota tests generic

Now that these tests have been made generic, move them into the
generic/ dir and update group files.

xfs/133 -> generic/383
xfs/134 -> generic/384
xfs/196 -> generic/385
xfs/262 -> generic/386

Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2016-09-23 09:51:26 +08:00
parent 7369e9c7f9
commit c27a67f0e7
11 changed files with 12 additions and 12 deletions
-99
View File
@@ -1,99 +0,0 @@
#! /bin/bash
# FS QA Test 133
#
# Test xfs_quota when project names beginning with digits.
#
#-----------------------------------------------------------------------
# Copyright (c) 2015 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
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
qa_user=""
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/quota
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_scratch
_require_quota
_require_xfs_quota_foreign
_scratch_mkfs >/dev/null 2>&1
_scratch_enable_pquota
do_project_test()
{
local qa_project=123456-project
local dir=$SCRATCH_MNT/project
mkdir $dir 2>/dev/null
#project quota files
cat >$tmp.projects <<EOF
10:$dir
EOF
cat >$tmp.projid <<EOF
$qa_project:10
EOF
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-c "project -s $qa_project" $SCRATCH_MNT > /dev/null
# We set & test inodes, because xfs vs ext4 consume differing
# amounts of space for an empty dir, but an inode is an inode...
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-c "limit -p isoft=100 ihard=200 $qa_project" $SCRATCH_MNT
echo "=== quota command output ==="
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid \
-c "quota -p -v -i $qa_project" $SCRATCH_MNT | _filter_quota
echo "=== report command output ==="
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-c "report -p -N -i" $SCRATCH_MNT | _filter_project_quota
}
# Test project
_qmount_option "usrquota,prjquota"
_qmount
_require_prjquota $SCRATCH_DEV
do_project_test
# success, all done
status=0
exit
-8
View File
@@ -1,8 +0,0 @@
QA output created by 133
=== quota command output ===
Disk quotas for Project 123456-project (10)
Filesystem Files Quota Limit Warn/Time Mounted on
SCRATCH_DEV 1 100 200 00 [--------] SCRATCH_MNT
=== report command output ===
123456-project 1 100 200 00 [--------]
-116
View File
@@ -1,116 +0,0 @@
#! /bin/bash
# FS QA Test No. 134
#
# test to reproduce PV951636:
# project quotas not updated if a file is mv'd into that directory
#
#-----------------------------------------------------------------------
# Copyright (c) 2006 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!
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/quota
_cleanup()
{
cd /
_scratch_unmount 2>/dev/null
rm -f $tmp.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
_supported_fs generic
_supported_os Linux IRIX
_require_test
_require_quota
_require_xfs_quota_foreign
_require_xfs_io_command "chproj"
# we can't run with group quotas
_exclude_scratch_mount_option "gquota" "grpquota"
dir=$SCRATCH_MNT/project
#project quota files
cat >$tmp.projects <<EOF
1:$dir
EOF
cat >$tmp.projid <<EOF
test:1
EOF
cp /dev/null $seqres.full
chmod a+rwx $seqres.full # arbitrary users will write here
_require_scratch
_scratch_mkfs >/dev/null 2>&1
_scratch_enable_pquota
_qmount_option "prjquota"
_qmount
_require_prjquota $SCRATCH_DEV
report_quota()
{
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-c "repquota -inN -p" $SCRATCH_DEV | \
tr -s '[:space:]' | _filter_project_quota
}
mkdir $dir
$XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
report_quota
touch $dir/1
touch $dir/2
cp $dir/2 $dir/3
report_quota
if [ "$HOSTOS" == "IRIX" ] ; then
mkfile 1M $TEST_DIR/6
else
xfs_mkfile 1M $TEST_DIR/6
fi
#try cp to dir
cp $TEST_DIR/6 $dir/6
report_quota
#try mv to dir
mv $TEST_DIR/6 $dir/7
report_quota
# success, all done
status=0
exit
-5
View File
@@ -1,5 +0,0 @@
QA output created by 134
#1 1 0 0 00 [--------]
#1 4 0 0 00 [--------]
#1 5 0 0 00 [--------]
#1 6 0 0 00 [--------]
-101
View File
@@ -1,101 +0,0 @@
#! /bin/bash
# FS QA Test No. 196
#
# Make sure renames accross project boundaries are properly rejected
# and that we don't use the wrong lock flags internally.
#
# Based on a report and testcase from Arkadiusz Miskiewicz <arekm@maven.pl>
#
#-----------------------------------------------------------------------
# Copyright (c) 2008 Christoph Hellwig.
#
# 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!
_cleanup()
{
cd /
_scratch_unmount
rm -f $tmp.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/quota
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_scratch
_require_quota
_require_xfs_quota_foreign
#
# Setup temporary replacements for /etc/projects and /etc/projid
#
cat >$tmp.projects <<EOF
42:$SCRATCH_MNT/t
EOF
cat >$tmp.projid <<EOF
answer:42
EOF
#
# And make sure we always use our replacements
#
quota_cmd="$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid"
_scratch_mkfs >/dev/null 2>&1
_scratch_enable_pquota
_qmount_option "prjquota"
_qmount
_require_prjquota $SCRATCH_DEV
#
# Create the project root
#
mkdir $SCRATCH_MNT/t
$quota_cmd -x -c 'project -s answer' $SCRATCH_MNT >/dev/null 2>&1
$quota_cmd -x -c 'limit -p bhard=100m answer' $SCRATCH_MNT
touch $SCRATCH_MNT/test
#
# Try renaming a file into the project. This should fail.
#
# We repeat this a couple thousand times as a single rename couldn't
# always trigger the wrong unlock flags bug we had in older kernels.
#
for i in `seq 1 2000`; do
src/rename test t/test
done
# success, all done
echo "*** done"
rm -f $seqres.full
status=0
-2002
View File
File diff suppressed because it is too large Load Diff
-156
View File
@@ -1,156 +0,0 @@
#! /bin/bash
# FS QA Test No. 262
#
# This test checks the project quota values reported by the quota
# "df" and "report" subcommands to ensure they match what they
# should be. There was a bug (fixed by xfsprogs commit 7cb2d41b)
# where the values reported were double what they should have been.
#
# SGI PV 1015651
#
#-----------------------------------------------------------------------
# Copyright (c) 2011 SGI. 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)
rm -f $seqres.full
tmp=/tmp/$$
my_projects=$tmp.projects
my_projid=$tmp.projid
proj_name=test_project
proj_num=1
qlimit_meg=500 # 500M limit imposed = 500 * 1024 * 1024 bytes
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/quota
echo "Silence is golden."
# real QA test starts here
proj_dir="$SCRATCH_MNT/test"
# Modify as appropriate.
_supported_fs generic
_supported_os Linux
_require_quota
_require_xfs_quota_foreign
_require_scratch
# Make sure the hard limits reported are what was set.
# It is entirely too clever...
# It exploits the fact that we've set the soft and hard limits to
# the same value, and as a result the value in the fourth field in
# both the "df" and the "report" output. For "report", the line we're
# interested in contains our project name in the first field. For "df"
# it contains our project directory in the last field.
# But if the device name is too long, the "df" output is broke into two
# lines, the fourth field is not correct, so take $(nf-2) of "df"
_filter_quota_rpt() {
awk '
BEGIN {
proj_name = "'${proj_name}'";
proj_dir = "'${proj_dir}'";
qlimit_meg = '${qlimit_meg}';
qlimit = qlimit_meg * 1024 * 1024;
}
# This function parses the human-readable values produced
# by xfs_quota output
function byte_size(value, result) {
result = strtonum(value);
unit = value;
gsub("[0-9][0-9]*", "", unit);
shift = index("KMGTPE", unit);
while (shift--)
result *= 1024;
return result;
}
{
if ($1 =~ proj_name) {
# this is the "report" output
bsize = byte_size($4);
} else if ($nf =~ proj_dir) {
# this is the "df" output
bsize = byte_size($(nf-2));
} else {
next;
}
if (bsize != qlimit)
printf("hard limit %d bytes, expected %d\n",
bsize, qlimit);
}
'
}
_quota_cmd() {
$XFS_QUOTA_PROG -P "$my_projid" -D "$my_projects" -x \
-c "$@" "$SCRATCH_MNT"
}
# Set up--mount scratch and create the project directory
echo $proj_name:$proj_num > "$my_projid"
echo $proj_num:$proj_dir > "$my_projects"
_scratch_mkfs >> "$seqres.full" 2>&1
_scratch_enable_pquota
_qmount_option "prjquota"
_qmount
_require_prjquota $SCRATCH_DEV
mkdir -p "${proj_dir}"
# Setup the project quota directory
_quota_cmd "project -s ${proj_name}" >> "$seqres.full" 2>&1
# Assign block quota limits
_quota_cmd "limit -p bhard=${qlimit_meg}m bsoft=${qlimit_meg}m ${proj_name}" \
2>> "$seqres.full" 1>&2
# See what gets reported
_quota_cmd "report" | _filter_quota_rpt 2>> "$seqres.full"
_quota_cmd "df" | _filter_quota_rpt 2>> "$seqres.full"
# This time using "human readable" output
_quota_cmd "report -h" | _filter_quota_rpt 2>> "$seqres.full"
_quota_cmd "df -h" | _filter_quota_rpt 2>> "$seqres.full"
# Clean up
rm -rf "$proj_dir"
_scratch_unmount
status=0 # success, all done
-2
View File
@@ -1,2 +0,0 @@
QA output created by 262
Silence is golden.
-4
View File
@@ -128,8 +128,6 @@
130 fuzzers clone
131 auto quick clone
132 auto quick clone
133 auto quick quota
134 quota auto quick
135 auto logprint quick v2log
136 attr2
137 auto metadata v2log
@@ -190,7 +188,6 @@
193 auto quick clone
194 rw auto
195 ioctl dump auto quick
196 quota auto quick
197 dir auto quick
198 auto quick clone
199 mount auto quick
@@ -255,7 +252,6 @@
258 auto quick clone
259 auto quick
261 auto quick quota
262 auto quick quota
263 auto quick quota
264 auto quick mount
265 auto clone