xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 144
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/144
6 #
7 # Test that an incremental send operation works correctly when an inode A is
8 # renamed, a new hard link added to it and some other inode B is renamed to
9 # the old name of inode A.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -fr $send_files_dir
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs btrfs
32 _supported_os Linux
33 _require_test
34 _require_scratch
35 _require_fssum
36
37 send_files_dir=$TEST_DIR/btrfs-test-$seq
38
39 rm -f $seqres.full
40 rm -fr $send_files_dir
41 mkdir $send_files_dir
42
43 _scratch_mkfs >>$seqres.full 2>&1
44 _scratch_mount
45
46 touch $SCRATCH_MNT/f1
47 touch $SCRATCH_MNT/f2
48 touch $SCRATCH_MNT/f3
49
50 # Filesystem looks like:
51 #
52 # .                                                             (ino 256)
53 # |
54 # |--- f1                                                       (ino 257)
55 # |--- f2                                                       (ino 258)
56 # |--- f3                                                       (ino 259)
57 #
58 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
59         $SCRATCH_MNT/mysnap1 > /dev/null
60
61 $BTRFS_UTIL_PROG send -f $send_files_dir/1.snap \
62         $SCRATCH_MNT/mysnap1 2>&1 1>/dev/null | _filter_scratch
63
64 mv $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
65 ln $SCRATCH_MNT/f2 $SCRATCH_MNT/f5
66 mv $SCRATCH_MNT/f2 $SCRATCH_MNT/f3
67 mv $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
68
69 # Filesystem now looks like:
70 #
71 # .                                                             (ino 256)
72 # |
73 # |--- f2                                                       (ino 257)
74 # |--- f3                                                       (ino 258)
75 # |--- f4                                                       (ino 259)
76 # |--- f5                                                       (ino 258)
77 #
78
79 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
80                  $SCRATCH_MNT/mysnap2 > /dev/null
81
82 $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
83                  $SCRATCH_MNT/mysnap2 2>&1 1>/dev/null | _filter_scratch
84
85 $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
86 $FSSUM_PROG -A -f -w $send_files_dir/2.fssum \
87         -x $SCRATCH_MNT/mysnap2/mysnap1 $SCRATCH_MNT/mysnap2
88
89 # Now recreate the filesystem by receiving both send streams and verify we get
90 # the same content that the original filesystem had.
91 _scratch_unmount
92 _scratch_mkfs >>$seqres.full 2>&1
93 _scratch_mount
94
95 $BTRFS_UTIL_PROG receive -f $send_files_dir/1.snap $SCRATCH_MNT > /dev/null
96 $BTRFS_UTIL_PROG receive -f $send_files_dir/2.snap $SCRATCH_MNT > /dev/null
97 $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
98 $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
99
100 status=0
101 exit