2 # FS QA Test No. btrfs/008
4 # btrfs send ENOENT regression test, from a user report on linux-btrfs
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/send/snapshots/backup2 > /dev/null 2>&1
38 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup3 > /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 subvol create"
68 work_dir="$TEST_DIR/$tmp_dir/send"
69 mkdir $work_dir/testdir
70 mkdir $work_dir/testdir/1/
71 mkdir $work_dir/testdir/2/
72 dd if=/dev/urandom of=$work_dir/testdir/aa count=16 > /dev/null 2>&1
73 dd if=/dev/urandom of=$work_dir/testdir/bb count=16 > /dev/null 2>&1
75 mkdir $work_dir/snapshots
76 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup2 \
77 >> $seqres.full 2>&1 || _fail "failed backup2"
78 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup3 \
79 >> $seqres.full 2>&1 || _fail "failed backup3"
80 $BTRFS_UTIL_PROG send $work_dir/snapshots/backup3/ -f $TEST_DIR/$tmp_dir/blah \
81 >> $seqres.full 2>&1 || _fail "send failed"
82 $BTRFS_UTIL_PROG receive $SCRATCH_MNT -vvvv -f $TEST_DIR/$tmp_dir/blah \
83 >> $seqres.full 2>&1 || _fail "receive failed"
85 echo "Silence is golden"