generic: inconsistent initial state for test_generic_punch
[xfstests-dev.git] / common / punch
index 4ed8406787d5010754a02a088f8760e24c1c25f6..49715a741571cb2d2de4163a8483ead45e12d57d 100644 (file)
@@ -318,10 +318,11 @@ _test_generic_punch()
        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