2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensure that punch-hole doesn't clobber CoW.
10 _begin_fstest auto quick clone punch
12 # Override the default cleanup function.
16 rm -rf $tmp.* $testdir
19 # Import common functions.
23 # real QA test starts here
26 _require_xfs_io_command "fpunch"
28 testdir=$TEST_DIR/test-$seq
32 echo "Create the original files"
35 filesize=$((blksz * nr))
36 _pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
38 _cp_reflink $testdir/file1 $testdir/file2
41 md5sum $testdir/file1 | _filter_test_dir
42 md5sum $testdir/file2 | _filter_test_dir
44 echo "Write and punch"
45 _pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
46 $XFS_IO_PROG -f -c "fpunch $blksz $((blksz * 254))" $testdir/file2
49 echo "Compare results"
50 md5sum $testdir/file1 | _filter_test_dir
51 md5sum $testdir/file2 | _filter_test_dir