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/
35 # Dump the same holey file using both xfs_bmap and
36 # dump_allocinfo (a C wrapper for get_allocinfo).
37 # Run awk on the xfs_bmap output, since xfs_bmap
38 # gives specific block allocation info that get_allocinfo
39 # does not. Then diff the two outputs.
42 then print "USAGE: ${0##*/} bindir testdir"
46 # Check bindir for needed programs.
47 if [[ ! ( -r "$1/wf" ) ]]
48 then print "Aborting: necessary program wf is not in $1/."
49 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
50 then print " necessary program dump_allocinfo is also missing."
54 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
55 then print "Aborting: necessary program dump_allocinfo is not in $1/."
59 print "Comparison test (get_allocinfo vs. xfs_bmap) beginning..."
69 filename=DMAPI_test_allocinfo
71 # Create a random holey file
74 $1/wf -l $length -L $offset -b 512 $2/$filename > /dev/null
75 (( offset = RANDOM * 512 + offset + length ))
77 (( count = count - 1 ))
80 # Get output from xfs_bmap
81 xfs_bmap $2/DMAPI_test_allocinfo > $2/$filename.xfs
83 # Get output from dump_allocinfo (DMAPI)
84 $1/dump_allocinfo $2/DMAPI_test_allocinfo > $2/$filename.da
86 # Alter xfs_bmap ouput to match get_allocinfo
92 }' $2/DMAPI_test_allocinfo.xfs > $2/$filename.ok
95 diff -w $2/$filename.ok $2/$filename.da
97 # Remove the test file
100 print "Test complete."