2 # FS QA Test No. btrfs/144
4 # Test that an incremental send operation works correctly when an inode A is
5 # renamed, a new hard link added to it and some other inode B is renamed to
6 # the old name of inode A.
8 #-----------------------------------------------------------------------
10 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
11 # Author: Filipe Manana <fdmanana@suse.com>
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
39 rm -fr $send_files_dir
43 # get standard environment, filters and checks
47 # real QA test starts here
54 send_files_dir=$TEST_DIR/btrfs-test-$seq
57 rm -fr $send_files_dir
60 _scratch_mkfs >>$seqres.full 2>&1
67 # Filesystem looks like:
75 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
76 $SCRATCH_MNT/mysnap1 > /dev/null
78 $BTRFS_UTIL_PROG send -f $send_files_dir/1.snap \
79 $SCRATCH_MNT/mysnap1 2>&1 1>/dev/null | _filter_scratch
81 mv $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
82 ln $SCRATCH_MNT/f2 $SCRATCH_MNT/f5
83 mv $SCRATCH_MNT/f2 $SCRATCH_MNT/f3
84 mv $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
86 # Filesystem now looks like:
96 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
97 $SCRATCH_MNT/mysnap2 > /dev/null
99 $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
100 $SCRATCH_MNT/mysnap2 2>&1 1>/dev/null | _filter_scratch
102 $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
103 $FSSUM_PROG -A -f -w $send_files_dir/2.fssum \
104 -x $SCRATCH_MNT/mysnap2/mysnap1 $SCRATCH_MNT/mysnap2
106 # Now recreate the filesystem by receiving both send streams and verify we get
107 # the same content that the original filesystem had.
109 _scratch_mkfs >>$seqres.full 2>&1
112 $BTRFS_UTIL_PROG receive -f $send_files_dir/1.snap $SCRATCH_MNT > /dev/null
113 $BTRFS_UTIL_PROG receive -f $send_files_dir/2.snap $SCRATCH_MNT > /dev/null
114 $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
115 $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2