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 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
21 rm -rf $tmp.* $testdir
24 # get standard environment, filters and checks
29 # real QA test starts here
33 _require_xfs_io_command "fpunch"
37 testdir=$TEST_DIR/test-$seq
41 echo "Create the original files"
44 filesize=$((blksz * nr))
45 _pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full
47 _cp_reflink $testdir/file1 $testdir/file2
50 md5sum $testdir/file1 | _filter_test_dir
51 md5sum $testdir/file2 | _filter_test_dir
53 echo "Write and punch"
54 _pwrite_byte 0x62 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
55 $XFS_IO_PROG -f -c "fpunch $blksz $((blksz * 254))" $testdir/file2
58 echo "Compare results"
59 md5sum $testdir/file1 | _filter_test_dir
60 md5sum $testdir/file2 | _filter_test_dir