xfs: Add test for too-small device with stripe geometry
[xfstests-dev.git] / tests / btrfs / 008
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fusion IO.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/008
6 #
7 # btrfs send ENOENT regression test, from a user report on linux-btrfs
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 tmp_dir=send_temp_$seq
16
17 status=1        # failure is the default!
18
19 _cleanup()
20 {
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
25         rm -f $tmp.*
26 }
27
28 trap "_cleanup ; exit \$status" 0 1 2 3 15
29
30 # get standard environment, filters and checks
31 . ./common/rc
32 . ./common/filter
33
34 # real QA test starts here
35 _supported_fs btrfs
36 _require_test
37 _require_scratch
38
39 _scratch_mkfs > /dev/null 2>&1
40
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=""
45
46 _scratch_mount
47
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
57
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"
67
68 echo "Silence is golden"
69 status=0 ; exit