Files
apfstests/106
T
Dmitry Monakhov d14981fa53 xfstests: hardcode fops for determinable fsstests runs
106,107 and 117 are frozen tests which use known seed, it is
reasonable to explicitly hardcode file operations in order to avoid
implicit changes caused by future changes in fsstress.

NOTE: options generated like follows: fsstress -S c $ORIG_ARGS

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
2013-03-01 10:09:07 -06:00

241 lines
6.0 KiB
Bash
Executable File

#! /bin/bash
# FS QA Test No. 106
#
# Exercise basic xfs_quota functionality (user/group/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
#
#-----------------------------------------------------------------------
#
# creator
owner=nathans@sgi.com
seq=`basename $0`
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
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.quota
_supported_fs xfs
_supported_os Linux #IRIX
_require_scratch
_require_xfs_quota
# real QA test starts here
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
cat $tmp.mkfs >$seq.full
. $tmp.mkfs
# setup a default run
if [ -z "$MOUNT_OPTIONS" ]; then
export MOUNT_OPTIONS="-o pquota,sync"
else
export MOUNT_OPTIONS="$MOUNT_OPTIONS -o sync"
fi
_qmount
_require_prjquota $SCRATCH_DEV
# initial populate
target=$SCRATCH_MNT/target
$FSSTRESS_PROG -z -s 57069 -m 8 -n 1000 -p 4 \
-f allocsp=1 \
-f chown=3 \
-f creat=4 \
-f dwrite=4 \
-f fallocate=1 \
-f fdatasync=1 \
-f fiemap=1 \
-f freesp=1 \
-f fsync=1 \
-f link=1 \
-f mkdir=2 \
-f mknod=2 \
-f punch=1 \
-f rename=2 \
-f resvsp=1 \
-f rmdir=1 \
-f setxattr=1 \
-f symlink=2 \
-f sync=1 \
-f truncate=2 \
-f unlink=1 \
-f unresvsp=1 \
-f write=4 \
-d $target
$FSSTRESS_PROG -z -s 57069 -m 8 -n 1000 -p 4 \
-f chown=500 \
-f setxattr=500 \
-d $target
# also use space, to be able to go over/under limits easily
uid=255
gid=254
prid=253
rm -f $SCRATCH_MNT/resv
$XFS_IO_PROG -fc "resvsp 0 200m" -c "chproj $prid" $SCRATCH_MNT/resv
chown $uid $SCRATCH_MNT/resv
chgrp $gid $SCRATCH_MNT/resv
_qmount
filter_xfs_quota()
{
perl -ne "
s,$SCRATCH_MNT,[SCR_MNT],;
s,$SCRATCH_DEV,[SCR_DEV],;
s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
print;"
}
test_quot()
{
echo "checking quot command (type=$type)" # not deterministic on blks
xfs_quota -x -c "quot -n -$type" $SCRATCH_MNT >>$seq.full 2>&1
}
test_report()
{
echo "checking report command (type=$type)"
xfs_quota -x -c "report -h -$type -U 256" $SCRATCH_MNT
}
test_limit1()
{
echo "checking limit command, pass 1 (type=$type)"
xfs_quota -x -c "limit -$type bsoft=100m bhard=100m ihard=2 $id" \
$SCRATCH_MNT
xfs_quota -x -c "limit -$type isoft=1 rtbsoft=100m rtbhard=110m $id"\
$SCRATCH_MNT
sleep 2 # let the timer day transition happen
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_limit2()
{
# push limits up high, so that timers are cleared, etc. (for later)
echo "checking limit command, pass2 (type=$type)"
xfs_quota -x -c "limit -$type bsoft=300m bhard=400m ihard=8800 $id" \
$SCRATCH_MNT
xfs_quota -x -c "limit -$type isoft=8000 rtbsoft=310m rtbhard=410m $id"\
$SCRATCH_MNT
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_warn()
{
echo "checking warn command (type=$type)"
xfs_quota -x -c "warn -$type -b 4 $id" $SCRATCH_MNT
xfs_quota -x -c "warn -$type -i 3 $id" $SCRATCH_MNT
#xfs_quota -x -c "warn -$type -r 2 $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -b -hnv $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
#xfs_quota -x -c "quota -$type -r -hnv $id" $SCRATCH_MNT
}
test_timer()
{
echo "checking timer command (type=$type)"
xfs_quota -x -c "timer -$type -b 3days" $SCRATCH_MNT
xfs_quota -x -c "timer -$type -i 2days" $SCRATCH_MNT
#xfs_quota -x -c "timer -$type -r 1day" $SCRATCH_MNT
}
test_state()
{
echo "checking state command (type=$type)"
xfs_quota -x -c "state -$type" $SCRATCH_MNT
# not yet working properly?
#echo "checking disable command (type=$type)"
#xfs_quota -x -c "disable -$type -v" $SCRATCH_MNT
#echo "checking enable command (type=$type)"
#xfs_quota -x -c "enable -$type -v" $SCRATCH_MNT
#echo "checking off command (type=$type)"
#xfs_quota -x -c "off -$type -v" $SCRATCH_MNT
#echo "checking remove command (type=$type)"
#xfs_quota -x -c "remove -$type -v" $SCRATCH_MNT
}
test_backup()
{
echo "checking dump command (type=$type)"
rm -f $tmp.backup
xfs_quota -x -c "dump -$type -f $tmp.backup -U 256" $SCRATCH_MNT
cat $tmp.backup
echo "changing limits (type=$type)"
xfs_quota -x -c "limit -$type isoft=1000 ihard=1100 $id" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
echo "checking restore command (type=$type)"
xfs_quota -x -c "restore -$type -f $tmp.backup" $SCRATCH_MNT
xfs_quota -x -c "quota -$type -i -hnv $id" $SCRATCH_MNT
rm -f $tmp.backup
}
test_xfs_quota()
{
test_quot ; echo
test_report ; echo
test_timer ; echo
test_limit1 ; echo
test_warn ; echo
test_limit2 ; echo
test_backup ; echo
test_state ; echo
echo ; echo
}
# real QA test starts here
export MOUNT_OPTIONS="-ouquota,sync"
_qmount
type=u
id=$uid
test_xfs_quota | filter_xfs_quota
export MOUNT_OPTIONS="-ogquota,sync"
_qmount
type=g
id=$gid
test_xfs_quota | filter_xfs_quota
export MOUNT_OPTIONS="-opquota,sync"
_qmount
type=p
id=$prid
test_xfs_quota | filter_xfs_quota
umount $SCRATCH_DEV
status=0
exit