xfstests: Improve test 219 to work with different filesystems

Different filesystems account different amount of metadata in quota.
Thus it is impractical to check for a particular amount of space
occupied by a file because there is no right value. Change the test
to verify whether the amount of space is between the expected amount
of space and the expected amount +5%.  The number of files is
checked exactly as previously.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
Jan Kara
2011-06-29 16:04:40 +00:00
committed by Alex Elder
parent b55fb0807c
commit 7f4a2e30b2
2 changed files with 25 additions and 18 deletions
+23 -2
View File
@@ -58,6 +58,23 @@ test_files()
done
}
check_usage()
{
wroteblocks=$1
wrotefiles=$2
read id exceed blocks bsoft bhard inodes isoft ihard
if [ "$blocks" -lt "$wroteblocks" ]; then
echo "Too few blocks used (type=$type)"
# Save 5% for overhead of metadata or different block size
elif [ "$blocks" -gt $((wroteblocks+wroteblocks/20)) ]; then
echo "Too many blocks used (type=$type)"
elif [ "$inodes" != "$wrotefiles" ]; then
echo "Bad number of inodes used (type=$type)"
else
echo "Usage OK (type=$type)"
fi
}
test_accounting()
{
echo "### some controlled buffered, direct and mmapd IO (type=$type)"
@@ -77,8 +94,12 @@ test_accounting()
$here/src/lstat64 $file | head -3 | _filter_scratch
done
repquota -$type -n $SCRATCH_MNT | grep -v "^#0" | _filter_scratch |
awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'
if [ $type == 'u' ]; then
id=$uid
else
id=$gid
fi
repquota -$type -n $SCRATCH_MNT | grep "^#$id" | check_usage 144 3
}
# real QA test starts here