generic/611: Use _getfattr instead of GETFATTR_PROG
[xfstests-dev.git] / tests / generic / 374
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 374
6 #
7 # Check that cross-mountpoint dedupe doesn't work.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
17
18 _cleanup()
19 {
20         cd /
21         rm -rf $tmp.*
22         wait
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/reflink
29
30 # real QA test starts here
31 _supported_fs generic
32 _require_scratch_dedupe
33
34 echo "Format and mount"
35 _scratch_mkfs > $seqres.full 2>&1
36 _scratch_mount >> $seqres.full 2>&1
37
38 testdir=$SCRATCH_MNT/test-$seq
39 mkdir $testdir
40 otherdir=/tmp/m.$seq
41 othertestdir=$otherdir/test-$seq
42 rm -rf $otherdir
43 mkdir $otherdir
44
45 blocks=1
46 blksz=65536
47 sz=$((blocks * blksz))
48
49 echo "Mount otherdir"
50 $MOUNT_PROG --bind $SCRATCH_MNT $otherdir
51
52 echo "Create file"
53 _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full
54 _pwrite_byte 0x61 0 $sz $testdir/otherfile >> $seqres.full
55
56 echo "Dedupe one file to another"
57 _dedupe_range $testdir/file 0 $othertestdir/otherfile 0 $sz 2>&1 | _filter_dedupe_error
58
59 filter_md5()
60 {
61         _filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g"
62 }
63 echo "Check output"
64 md5sum $testdir/file $othertestdir/otherfile | filter_md5
65
66 echo "Unmount otherdir"
67 $UMOUNT_PROG $otherdir
68 rm -rf $otherdir
69
70 # success, all done
71 status=0
72 exit