don't assume that the pagesize is 4K.

This commit is contained in:
Nathan Scott
2002-04-04 01:20:23 +00:00
parent 2bd2a2b7b3
commit 004ff5d963
2 changed files with 26 additions and 23 deletions
+15 -12
View File
@@ -46,6 +46,7 @@ here=`pwd`
tmp=/tmp/$$ tmp=/tmp/$$
status=1 # failure is the default! status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15 trap "_cleanup; exit \$status" 0 1 2 3 15
bsize=`$here/src/getpagesize`
_cleanup() _cleanup()
{ {
@@ -55,7 +56,9 @@ _cleanup()
_block_filter() _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() _init()
@@ -102,20 +105,20 @@ out=$SCRATCH_MNT/$$.tmp
echo "*** test 1 - reservations cleared on O_TRUNC" echo "*** test 1 - reservations cleared on O_TRUNC"
rm -f $out 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 r 0 1000b
m m
EOF EOF
_filesize $out _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 m
EOF EOF
_filesize $out _filesize $out
echo "*** test 2 - reserve & filesize" echo "*** test 2 - reserve & filesize"
rm -f $out 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 r 0 1000b
EOF EOF
@@ -123,7 +126,7 @@ _filesize $out
echo "*** test 3 - alloc & filesize" echo "*** test 3 - alloc & filesize"
rm -f $out 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 a 1000b
EOF EOF
@@ -131,19 +134,19 @@ _filesize $out
echo "*** test 4 - allocations cleared on O_TRUNC" echo "*** test 4 - allocations cleared on O_TRUNC"
rm -f $out 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 a 1000b
EOF EOF
_filesize $out _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 m
EOF EOF
_filesize $out _filesize $out
echo "*** test 5 - reserve / unreserve" echo "*** test 5 - reserve / unreserve"
rm -f $out 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 r 0 100b
u 100b 500b u 100b 500b
m m
@@ -153,7 +156,7 @@ EOF
echo "*** test 6 - reserve adjacent" echo "*** test 6 - reserve adjacent"
rm -f $out 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 0 100b
r 100b 100b r 100b 100b
m m
@@ -161,7 +164,7 @@ EOF
echo "*** test 7 - alloc" echo "*** test 7 - alloc"
rm -f $out 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 a 1000b
m m
a 2000b a 2000b
@@ -172,7 +175,7 @@ _filesize $out
echo "*** test 8 - alloc & truncate" echo "*** test 8 - alloc & truncate"
rm -f $out 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 a 1000b
m m
t 500b t 500b
@@ -183,7 +186,7 @@ _filesize $out
echo "*** test 9 - reserve & truncate" echo "*** test 9 - reserve & truncate"
rm -f $out 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 r 0 1000b
m m
t 500b t 500b
+11 -11
View File
@@ -2,7 +2,7 @@ QA output created by 009
*** mkfs *** mkfs
*** mount *** mount
*** test 1 - reservations cleared on O_TRUNC *** test 1 - reservations cleared on O_TRUNC
blocksize 4096 blocksize BSIZE
CMD resvsp, off=0, len=4096000 CMD resvsp, off=0, len=4096000
MAP off=0, len=4096000 [0,1000] MAP off=0, len=4096000 [0,1000]
[ofs,count]: start..end [ofs,count]: start..end
@@ -11,35 +11,35 @@ QA output created by 009
[ofs,count]: start..end [ofs,count]: start..end
[0,1000]: BLOCKRANGE [0,1000]: BLOCKRANGE
filesize = 0 filesize = 0
blocksize 4096 blocksize BSIZE
MAP off=0, len=-1 [0-] MAP off=0, len=-1 [0-]
[ofs,count]: start..end [ofs,count]: start..end
filesize = 0 filesize = 0
*** test 2 - reserve & filesize *** test 2 - reserve & filesize
blocksize 4096 blocksize BSIZE
CMD resvsp, off=0, len=4096000 CMD resvsp, off=0, len=4096000
MAP off=0, len=4096000 [0,1000] MAP off=0, len=4096000 [0,1000]
[ofs,count]: start..end [ofs,count]: start..end
[0,1000]: BLOCKRANGE [0,1000]: BLOCKRANGE
filesize = 0 filesize = 0
*** test 3 - alloc & filesize *** test 3 - alloc & filesize
blocksize 4096 blocksize BSIZE
CMD allocsp, off=4096000, len=-1 CMD allocsp, off=4096000, len=-1
MAP off=4096000, len=-1 [1000-] MAP off=4096000, len=-1 [1000-]
[ofs,count]: start..end [ofs,count]: start..end
filesize = 4096000 filesize = 4096000
*** test 4 - allocations cleared on O_TRUNC *** test 4 - allocations cleared on O_TRUNC
blocksize 4096 blocksize BSIZE
CMD allocsp, off=4096000, len=-1 CMD allocsp, off=4096000, len=-1
MAP off=4096000, len=-1 [1000-] MAP off=4096000, len=-1 [1000-]
[ofs,count]: start..end [ofs,count]: start..end
filesize = 4096000 filesize = 4096000
blocksize 4096 blocksize BSIZE
MAP off=0, len=-1 [0-] MAP off=0, len=-1 [0-]
[ofs,count]: start..end [ofs,count]: start..end
filesize = 0 filesize = 0
*** test 5 - reserve / unreserve *** test 5 - reserve / unreserve
blocksize 4096 blocksize BSIZE
CMD resvsp, off=0, len=409600 CMD resvsp, off=0, len=409600
MAP off=0, len=409600 [0,100] MAP off=0, len=409600 [0,100]
[ofs,count]: start..end [ofs,count]: start..end
@@ -57,7 +57,7 @@ filesize = 0
[ofs,count]: start..end [ofs,count]: start..end
[0,100]: BLOCKRANGE [0,100]: BLOCKRANGE
*** test 6 - reserve adjacent *** test 6 - reserve adjacent
blocksize 4096 blocksize BSIZE
CMD resvsp, off=0, len=409600 CMD resvsp, off=0, len=409600
MAP off=0, len=409600 [0,100] MAP off=0, len=409600 [0,100]
[ofs,count]: start..end [ofs,count]: start..end
@@ -70,7 +70,7 @@ filesize = 0
[ofs,count]: start..end [ofs,count]: start..end
[0,200]: BLOCKRANGE [0,200]: BLOCKRANGE
*** test 7 - alloc *** test 7 - alloc
blocksize 4096 blocksize BSIZE
CMD allocsp, off=4096000, len=-1 CMD allocsp, off=4096000, len=-1
MAP off=4096000, len=-1 [1000-] MAP off=4096000, len=-1 [1000-]
[ofs,count]: start..end [ofs,count]: start..end
@@ -85,7 +85,7 @@ filesize = 0
[0,2000]: BLOCKRANGE [0,2000]: BLOCKRANGE
filesize = 8192000 filesize = 8192000
*** test 8 - alloc & truncate *** test 8 - alloc & truncate
blocksize 4096 blocksize BSIZE
CMD allocsp, off=4096000, len=-1 CMD allocsp, off=4096000, len=-1
MAP off=4096000, len=-1 [1000-] MAP off=4096000, len=-1 [1000-]
[ofs,count]: start..end [ofs,count]: start..end
@@ -98,7 +98,7 @@ filesize = 8192000
[0,500]: BLOCKRANGE [0,500]: BLOCKRANGE
filesize = 2048000 filesize = 2048000
*** test 9 - reserve & truncate *** test 9 - reserve & truncate
blocksize 4096 blocksize BSIZE
CMD resvsp, off=0, len=4096000 CMD resvsp, off=0, len=4096000
MAP off=0, len=4096000 [0,1000] MAP off=0, len=4096000 [0,1000]
[ofs,count]: start..end [ofs,count]: start..end