3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # Dump the same holey file a random number of times, each time
6 # using one less extent structure than the previous time.
7 # The grep and diff code checks to make sure that you get the
8 # same answer each time, no matter how many extents you use.
14 # Verify correct usage
16 then print "usage: ${0##*/} bindir testdir"
20 # Check bindir for needed programs.
21 if [[ ! ( -r "$1/wf" ) ]]
22 then print "Aborting: necessary program wf is not in $1/."
23 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
24 then print " necessary program dump_allocinfo is also missing."
28 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
29 then print "Aborting: necessary program dump_allocinfo is not in $1/."
33 print "Multiple-buffer-sizes test of get_allocinfo beginning..."
38 filename=DMAPI_alloc_test_2
42 # Holey file creation: put about $max holes into the file.
45 $1/wf -l $length -L $offset -b 512 $2/$filename > /dev/null
46 (( offset = RANDOM * 512 + offset + length ))
48 (( count = count - 1 ))
52 # Now count down from $max to 1 and try dump_allocinfo with a buffer that
53 # can hold that many dm_extent_t structures.
54 while [[ $count > 0 ]]
56 $1/dump_allocinfo -n $count $2/$filename | grep '\[' > $2/x.$count
58 then diff $2/x.$count $2/x.$max > /dev/null
60 then print "ERROR in trial #$count:"
61 diff $2/x.$count $2/x.$max
65 (( count = count - 1 ))
71 print "Test complete."