xfsqa: make hole tests independent of speculative allocation patterns

Many of the "count-the-holes" tests (008, 012, etc) do writes that extend the
file and hence allocation patterns are dependent on speculative allocation
beyond EOF behaviour. Hence if we change that behaviour, these tests all fail
because there is a different pattern of holes.

Make the tests independent of EOF preallocation behaviour by first truncating
the file to the size the test is defined to use. This prevents speculative
prealocation from occurring, and hence changes in such behaviour will not cause
the tests to fail.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Dave Chinner
2011-01-07 23:59:15 +11:00
committed by Dave Chinner
parent 03292c4f37
commit 815637a2da
3 changed files with 25 additions and 0 deletions
+4
View File
@@ -36,6 +36,10 @@ _write_holes()
file=$1
holes=$2
let writes=$holes+1
let fsize=$(($writes * 0x100000))
# prevent EOF preallocation from affecting results
xfs_io -f $file -c "truncate $fsize"
offset=0
for i in `seq 0 $writes`; do