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)"
$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
File: "SCRATCH_MNT/mmap"
Size: 49152 Filetype: Regular File
Mode: (0644/-rw-r--r--) Uid: (1) Gid: (2)
-*** Report for user quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
- Block limits File limits
-User used soft hard grace used soft hard grace
-----------------------------------------------------------------------
-#1 -- 144 0 0 3 0 0
-
-
+Usage OK (type=u)
### test group accounting
File: "SCRATCH_MNT/mmap"
Size: 49152 Filetype: Regular File
Mode: (0644/-rw-r--r--) Uid: (1) Gid: (2)
-*** Report for group quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
- Block limits File limits
-Group used soft hard grace used soft hard grace
-----------------------------------------------------------------------
-#2 -- 144 0 0 3 0 0
-
-
+Usage OK (type=g)