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 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 tmp_dir=send_temp_$seq
17 status=1 # failure is the default!
21 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup2 > /dev/null 2>&1
22 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup3 > /dev/null 2>&1
23 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1
24 rm -rf $TEST_DIR/$tmp_dir
28 trap "_cleanup ; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
34 # real QA test starts here
39 _scratch_mkfs > /dev/null 2>&1
41 #receive needs to be able to setxattrs, including the selinux context, if we use
42 #the normal nfs context thing it screws up our ability to set the
43 #security.selinux xattrs so we need to disable this for this test
44 export SELINUX_MOUNT_OPTIONS=""
48 mkdir $TEST_DIR/$tmp_dir
49 $BTRFS_UTIL_PROG subvolume create $TEST_DIR/$tmp_dir/send \
50 > $seqres.full 2>&1 || _fail "failed subvol create"
51 work_dir="$TEST_DIR/$tmp_dir/send"
52 mkdir $work_dir/testdir
53 mkdir $work_dir/testdir/1/
54 mkdir $work_dir/testdir/2/
55 _ddt of=$work_dir/testdir/aa count=16 > /dev/null 2>&1
56 _ddt of=$work_dir/testdir/bb count=16 > /dev/null 2>&1
58 mkdir $work_dir/snapshots
59 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup2 \
60 >> $seqres.full 2>&1 || _fail "failed backup2"
61 $BTRFS_UTIL_PROG subvolume snapshot -r $work_dir $work_dir/snapshots/backup3 \
62 >> $seqres.full 2>&1 || _fail "failed backup3"
63 $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/blah $work_dir/snapshots/backup3 \
64 >> $seqres.full 2>&1 || _fail "send failed"
65 $BTRFS_UTIL_PROG receive -vvvv -f $TEST_DIR/$tmp_dir/blah $SCRATCH_MNT \
66 >> $seqres.full 2>&1 || _fail "receive failed"
68 echo "Silence is golden"