# alloc test
#
#-----------------------------------------------------------------------
-# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
+# This isn't really related to fs block size, it's just what
+# alloc uses for the "block" unit in it's input parameters...
+bsize=4096
_cleanup()
{
_block_filter()
{
- sed -e 's/[0-9][0-9]*\.\.[0-9][0-9]*/BLOCKRANGE/g'
+ sed \
+ -e 's/[0-9][0-9]*\.\.[0-9][0-9]*/BLOCKRANGE/g' \
+ -e "s/blocksize $bsize/blocksize BSIZE/g"
}
_init()
{
echo "*** mkfs"
- if ! mkfs_xfs -f $SCRATCH_DEV >$tmp.out 2>&1
+ if ! mkfs_xfs $SCRATCH_DEV >$tmp.out 2>&1
then
cat $tmp.out
echo "failed to mkfs $SCRATCH_DEV"
echo "*** test 1 - reservations cleared on O_TRUNC"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
r 0 1000b
m
EOF
_filesize $out
-cat <<EOF | src/alloc -n -b 4096 -f $out -t | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out -t | _block_filter
m
EOF
_filesize $out
echo "*** test 2 - reserve & filesize"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
r 0 1000b
EOF
echo "*** test 3 - alloc & filesize"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
a 1000b
EOF
echo "*** test 4 - allocations cleared on O_TRUNC"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
a 1000b
EOF
_filesize $out
-cat <<EOF | src/alloc -n -b 4096 -f $out -t | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out -t | _block_filter
m
EOF
_filesize $out
echo "*** test 5 - reserve / unreserve"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
r 0 100b
u 100b 500b
m
echo "*** test 6 - reserve adjacent"
rm -f $out
-cat <<EOF | src/alloc -t -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -t -n -b $bsize -f $out | _block_filter
r 0 100b
r 100b 100b
m
echo "*** test 7 - alloc"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
a 1000b
m
a 2000b
echo "*** test 8 - alloc & truncate"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
a 1000b
m
t 500b
echo "*** test 9 - reserve & truncate"
rm -f $out
-cat <<EOF | src/alloc -n -b 4096 -f $out | _block_filter
+cat <<EOF | src/alloc -n -b $bsize -f $out | _block_filter
r 0 1000b
m
t 500b