3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # Dump the same holey file using both xfs_bmap and
6 # dump_allocinfo (a C wrapper for get_allocinfo).
7 # Run awk on the xfs_bmap output, since xfs_bmap
8 # gives specific block allocation info that get_allocinfo
9 # does not. Then diff the two outputs.
12 then print "USAGE: ${0##*/} bindir testdir"
16 # Check bindir for needed programs.
17 if [[ ! ( -r "$1/wf" ) ]]
18 then print "Aborting: necessary program wf is not in $1/."
19 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
20 then print " necessary program dump_allocinfo is also missing."
24 if [[ ! ( -r "$1/dump_allocinfo" ) ]]
25 then print "Aborting: necessary program dump_allocinfo is not in $1/."
29 print "Comparison test (get_allocinfo vs. xfs_bmap) beginning..."
39 filename=DMAPI_test_allocinfo
41 # Create a random holey file
44 $1/wf -l $length -L $offset -b 512 $2/$filename > /dev/null
45 (( offset = RANDOM * 512 + offset + length ))
47 (( count = count - 1 ))
50 # Get output from xfs_bmap
51 xfs_bmap $2/DMAPI_test_allocinfo > $2/$filename.xfs
53 # Get output from dump_allocinfo (DMAPI)
54 $1/dump_allocinfo $2/DMAPI_test_allocinfo > $2/$filename.da
56 # Alter xfs_bmap ouput to match get_allocinfo
62 }' $2/DMAPI_test_allocinfo.xfs > $2/$filename.ok
65 diff -w $2/$filename.ok $2/$filename.da
67 # Remove the test file
70 print "Test complete."