2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fusion IO. All Rights Reserved.
5 # FS QA Test No. btrfs/008
7 # btrfs send ENOENT regression test, from a user report on linux-btrfs
10 _begin_fstest auto quick send
12 tmp_dir=send_temp_$seq
14 # Override the default cleanup function.
17 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup2 > /dev/null 2>&1
18 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup3 > /dev/null 2>&1
19 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1
20 rm -rf $TEST_DIR/$tmp_dir
24 # Import common functions.
27 # real QA test starts here
32 _scratch_mkfs > /dev/null 2>&1
34 #receive needs to be able to setxattrs, including the selinux context, if we use
35 #the normal nfs context thing it screws up our ability to set the
36 #security.selinux xattrs so we need to disable this for this test
37 export SELINUX_MOUNT_OPTIONS=""
41 mkdir $TEST_DIR/$tmp_dir
42 $BTRFS_UTIL_PROG subvolume create $TEST_DIR/$tmp_dir/send \
43 > $seqres.full 2>&1 || _fail "failed subvol create"
44 work_dir="$TEST_DIR/$tmp_dir/send"
45 mkdir $work_dir/testdir
46 mkdir $work_dir/testdir/1/
47 mkdir $work_dir/testdir/2/
48 _ddt of=$work_dir/testdir/aa count=16 > /dev/null 2>&1
49 _ddt of=$work_dir/testdir/bb count=16 > /dev/null 2>&1
51 mkdir $work_dir/snapshots
52 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup2 \
53 >> $seqres.full 2>&1 || _fail "failed backup2"
54 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup3 \
55 >> $seqres.full 2>&1 || _fail "failed backup3"
56 $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/blah $work_dir/snapshots/backup3 \
57 >> $seqres.full 2>&1 || _fail "send failed"
58 $BTRFS_UTIL_PROG receive -vvvv -f $TEST_DIR/$tmp_dir/blah $SCRATCH_MNT \
59 >> $seqres.full 2>&1 || _fail "receive failed"
61 echo "Silence is golden"