generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
10 _begin_fstest auto quick send
11
12 tmp_dir=send_temp_$seq
13
14 # Override the default cleanup function.
15 _cleanup()
16 {
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
21         rm -f $tmp.*
22 }
23
24 # Import common functions.
25 . ./common/filter
26
27 # real QA test starts here
28 _supported_fs btrfs
29 _require_test
30 _require_scratch
31
32 _scratch_mkfs > /dev/null 2>&1
33
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=""
38
39 _scratch_mount
40
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
50
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"
60
61 echo "Silence is golden"
62 status=0 ; exit