2 # FS QA Test No. btrfs/019
4 # btrfs send ENOENT regression test, kernel bugzilla 60673
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2013 Fusion IO. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 tmp_dir=send_temp_$seq
33 status=1 # failure is the default!
37 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1
38 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/snap2 > /dev/null 2>&1
39 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1
40 rm -rf $TEST_DIR/$tmp_dir
44 trap "_cleanup ; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
50 # real QA test starts here
56 _scratch_mkfs > /dev/null 2>&1
58 #receive needs to be able to setxattrs, including the selinux context, if we use
59 #the normal nfs context thing it screws up our ability to set the
60 #security.selinux xattrs so we need to disable this for this test
61 export SELINUX_MOUNT_OPTIONS=""
65 mkdir $TEST_DIR/$tmp_dir
66 $BTRFS_UTIL_PROG subvolume create $TEST_DIR/$tmp_dir/send \
67 > $seqres.full 2>&1 || _fail "failed subvolume create"
69 SEND_TEST_DIR=$TEST_DIR/$tmp_dir/send
71 mkdir $SEND_TEST_DIR/test
72 touch $SEND_TEST_DIR/test/baz
73 touch $SEND_TEST_DIR/test/blah
74 mkdir $SEND_TEST_DIR/test/foo
75 touch $SEND_TEST_DIR/test/foo/bar
77 $BTRFS_UTIL_PROG subvolume snapshot -r $TEST_DIR/$tmp_dir/send \
78 $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap1"
80 $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send1.dump \
81 $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed send"
83 $BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send1.dump $SCRATCH_MNT \
84 >> $seqres.full 2>&1 || _fail "failed receive"
86 #recreate everything exactly the way it was exceptn in a different order so we
87 #get different inode numbers
88 rm -rf $SEND_TEST_DIR/test
89 mkdir $SEND_TEST_DIR/test
90 touch $SEND_TEST_DIR/test/baz
91 mkdir $SEND_TEST_DIR/test/foo
92 touch $SEND_TEST_DIR/test/foo/bar
93 touch $SEND_TEST_DIR/test/blah
95 $BTRFS_UTIL_PROG subvolume snapshot -r $TEST_DIR/$tmp_dir/send \
96 $TEST_DIR/$tmp_dir/snap2 >> $seqres.full 2>&1 || _fail "failed snap2"
98 $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send2.dump \
99 $TEST_DIR/$tmp_dir/snap2 -p $TEST_DIR/$tmp_dir/snap1 \
100 >> $seqres.full 2>&1 || _fail "failed second send"
102 $BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send2.dump $SCRATCH_MNT \
103 >> $seqres.full 2>&1 || _fail "failed second receive"
105 echo "Silence is golden"