4 # Run fsstress to create a reasonably strange file system, make a
5 # snapshot (base) and run more fsstress. Then take another snapshot
6 # (incr) and send both snapshots to a temp file. Remake the file
7 # system and receive from the files. Check both states with fssum.
9 #-----------------------------------------------------------------------
10 # Copyright (C) 2013 STRATO. All rights reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
28 owner=list.btrfs@jan-o-sch.net
31 seqres=$RESULT_DIR/$seq
32 echo "QA output created by $seq"
40 _scratch_unmount 2>/dev/null
43 trap "_cleanup; exit \$status" 0 1 2 3 15
45 # get standard environment, filters and checks
49 # real QA test starts here
54 _require_seek_data_hole
63 _scratch_unmount >/dev/null 2>&1
64 echo "*** mkfs -dsize=$fsz" >>$seqres.full
65 echo "" >>$seqres.full
66 _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
67 || _fail "size=$fsz mkfs failed"
68 _scratch_mount "-o noatime"
70 run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
71 "$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/base"
73 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr
75 echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap" \
77 $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap 2>> $seqres.full \
78 || _fail "failed: '$@'"
79 echo "# $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base\
80 $SCRATCH_MNT/incr > $tmp/incr.snap" >> $seqres.full
81 $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base \
82 $SCRATCH_MNT/incr > $tmp/incr.snap 2>> $seqres.full \
83 || _fail "failed: '$@'"
85 run_check $FSSUM_PROG -A -f -w $tmp/base.fssum $SCRATCH_MNT/base
86 run_check $FSSUM_PROG -A -f -w $tmp/incr.fssum -x $SCRATCH_MNT/incr/base \
89 _scratch_unmount >/dev/null 2>&1
90 echo "*** mkfs -dsize=$fsz" >>$seqres.full
91 echo "" >>$seqres.full
92 _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
93 || _fail "size=$fsz mkfs failed"
94 _scratch_mount "-o noatime"
96 _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/base.snap
97 run_check $FSSUM_PROG -r $tmp/base.fssum $SCRATCH_MNT/base
99 _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/incr.snap
100 run_check $FSSUM_PROG -r $tmp/incr.fssum $SCRATCH_MNT/incr
103 echo "*** test send / receive"
105 fssize=`expr 2000 \* 1024 \* 1024`