generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / btrfs / 016
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/016
6 #
7 # btrfs send hole punch test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 tmp=`mktemp -d`
14 tmp_dir=send_temp_$seq
15
16 status=1        # failure is the default!
17
18 _cleanup()
19 {
20         $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/snap > /dev/null 2>&1
21         $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1
22         $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1
23         rm -rf $TEST_DIR/$tmp_dir
24         rm -f $tmp.*
25 }
26
27 trap "_cleanup ; exit \$status" 0 1 2 3 15
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # real QA test starts here
34 _supported_fs btrfs
35 _require_test
36 _require_scratch
37 _require_fssum
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 subvolume create"
51
52 _ddt of=$TEST_DIR/$tmp_dir/send/foo bs=1M count=10 >> $seqres.full \
53         2>&1 || _fail "dd failed"
54 $BTRFS_UTIL_PROG subvolume snapshot -r $TEST_DIR/$tmp_dir/send \
55         $TEST_DIR/$tmp_dir/snap >> $seqres.full 2>&1 || _fail "failed snap"
56 $XFS_IO_PROG -c "fpunch 1m 1m" $TEST_DIR/$tmp_dir/send/foo
57 $BTRFS_UTIL_PROG subvolume snapshot -r $TEST_DIR/$tmp_dir/send \
58         $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap"
59
60 $FSSUM_PROG -A -f -w $tmp/fssum.snap $TEST_DIR/$tmp_dir/snap >> $seqres.full \
61         2>&1 || _fail "fssum gen failed"
62 $FSSUM_PROG -A -f -w $tmp/fssum.snap1 $TEST_DIR/$tmp_dir/snap1 >> $seqres.full \
63         2>&1 || _fail "fssum gen failed"
64
65 $BTRFS_UTIL_PROG send -f $tmp/send.snap $TEST_DIR/$tmp_dir/snap >> \
66         $seqres.full 2>&1 || _fail "failed send"
67 $BTRFS_UTIL_PROG send -p $TEST_DIR/$tmp_dir/snap \
68         -f $tmp/send.snap1 $TEST_DIR/$tmp_dir/snap1 \
69         >> $seqres.full 2>&1 || _fail "failed send"
70
71 $BTRFS_UTIL_PROG receive -f $tmp/send.snap $SCRATCH_MNT >> $seqres.full 2>&1 \
72         || _fail "failed recv"
73 $BTRFS_UTIL_PROG receive -f $tmp/send.snap1 $SCRATCH_MNT >> $seqres.full 2>&1 \
74         || _fail "failed recv"
75
76 $FSSUM_PROG -r $tmp/fssum.snap $SCRATCH_MNT/snap >> $seqres.full 2>&1 \
77         || _fail "fssum failed"
78 $FSSUM_PROG -r $tmp/fssum.snap1 $SCRATCH_MNT/snap1 >> $seqres.full 2>&1 \
79         || _fail "fssum failed"
80
81 echo "Silence is golden"
82 status=0 ; exit