4 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like. Any license provided herein, whether implied or
17 # otherwise, applies only to this software file. Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA 94043, or:
30 # For further information regarding this notice, see:
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
34 # Dump the same holey file a random number of times, each time
35 # using one less extent structure than the previous time.
36 # The grep and diff code checks to make sure that you get the
37 # same answer each time, no matter how many extents you use.
43 # Verify correct usage
45 then print "usage: ${0##*/} bindir testdir"
49 # Check bindir for needed programs.
50 if [[ ! ( -r "$1/wf" ) ]]
51 then print "Aborting: necessary program wf is not in $1/."
52 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
53 then print " necessary program dump_allocinfo is also missing."
57 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
58 then print "Aborting: necessary program dump_allocinfo is not in $1/."
62 print "Multiple-buffer-sizes test of get_allocinfo beginning..."
67 filename=DMAPI_alloc_test_2
71 # Holey file creation: put about $max holes into the file.
74 $1/wf -l $length -L $offset -b 512 $2/$filename > /dev/null
75 (( offset = RANDOM * 512 + offset + length ))
77 (( count = count - 1 ))
81 # Now count down from $max to 1 and try dump_allocinfo with a buffer that
82 # can hold that many dm_extent_t structures.
83 while [[ $count > 0 ]]
85 $1/dump_allocinfo -n $count $2/$filename | grep '\[' > $2/x.$count
87 then diff $2/x.$count $2/x.$max > /dev/null
89 then print "ERROR in trial #$count:"
90 diff $2/x.$count $2/x.$max
94 (( count = count - 1 ))
100 print "Test complete."