The first test may start with the file from the previous test, and
that is in an unknown state. Hence always remove the test file
before the first test so that it doesn't have extents inside the
test range as it is supposed to be testing into a hole.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
filter_cmd=$5
testfile=$6
+ # initial test state must be defined, otherwise the first test can fail
+ # due ot stale file state left from previous tests.
+ rm -f $testfile
+
echo " 1. into a hole"
- if [ "$remove_testfile" ]; then
- rm -f $testfile
- fi
$XFS_IO_PROG -f -c "truncate 20k" \
-c "$zero_cmd 4k 8k" \
-c "$map_cmd -v" $testfile | $filter_cmd
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: extent
1: [8..23]: hole
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: extent
1: [8..23]: hole
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: extent
1: [8..23]: hole
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: extent
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: extent
1: [8..23]: hole
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: data
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: data
1: [8..23]: hole
0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
*
1. into a hole
-0: [0..7]: data
-1: [8..39]: hole
-5a58e46082be047d0f13bee7974015b9
+daa100df6e6711906b61c9ab5aa16032
2. into allocated space
0: [0..7]: data
1: [8..23]: hole