2013-08-13 17:24:18 +00:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:50 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (C) 2013 STRATO. All rights reserved.
|
|
|
|
|
#
|
2013-08-13 17:24:18 +00:00
|
|
|
# FSQA Test No. 007
|
|
|
|
|
#
|
|
|
|
|
# Run fsstress to create a reasonably strange file system, make a
|
|
|
|
|
# snapshot (base) and run more fsstress. Then take another snapshot
|
|
|
|
|
# (incr) and send both snapshots to a temp file. Remake the file
|
|
|
|
|
# system and receive from the files. Check both states with fssum.
|
|
|
|
|
#
|
|
|
|
|
# creator
|
|
|
|
|
owner=list.btrfs@jan-o-sch.net
|
|
|
|
|
|
|
|
|
|
seq=`basename $0`
|
|
|
|
|
seqres=$RESULT_DIR/$seq
|
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
tmp=/tmp/$$
|
2013-08-13 17:24:18 +00:00
|
|
|
status=1
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
2018-10-15 10:22:46 +01:00
|
|
|
cd /
|
2013-08-13 17:24:18 +00:00
|
|
|
rm -f $tmp.*
|
2018-10-15 10:22:46 +01:00
|
|
|
rm -fr $send_files_dir
|
2013-08-13 17:24:18 +00:00
|
|
|
}
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs btrfs
|
|
|
|
|
_supported_os Linux
|
|
|
|
|
_require_scratch
|
2014-03-13 15:17:44 +11:00
|
|
|
_require_fssum
|
2013-08-13 17:24:18 +00:00
|
|
|
_require_seek_data_hole
|
|
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
send_files_dir=$TEST_DIR/btrfs-test-$seq
|
|
|
|
|
|
2013-08-13 17:24:18 +00:00
|
|
|
rm -f $seqres.full
|
2018-10-15 10:22:46 +01:00
|
|
|
rm -fr $send_files_dir
|
|
|
|
|
mkdir $send_files_dir
|
2013-08-13 17:24:18 +00:00
|
|
|
|
|
|
|
|
workout()
|
|
|
|
|
{
|
|
|
|
|
fsz=$1
|
|
|
|
|
ops=$2
|
|
|
|
|
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount >/dev/null 2>&1
|
2013-08-13 17:24:18 +00:00
|
|
|
echo "*** mkfs -dsize=$fsz" >>$seqres.full
|
|
|
|
|
echo "" >>$seqres.full
|
|
|
|
|
_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
|
|
|
|
|
|| _fail "size=$fsz mkfs failed"
|
2018-02-07 17:31:36 +08:00
|
|
|
_scratch_mount "-o noatime"
|
2013-08-13 17:24:18 +00:00
|
|
|
|
|
|
|
|
run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
|
2014-01-24 12:06:14 +11:00
|
|
|
"$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/base"
|
2013-08-13 17:24:18 +00:00
|
|
|
|
2014-03-13 15:17:44 +11:00
|
|
|
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr
|
2013-08-13 17:24:18 +00:00
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > ${send_files_dir}/base.snap" \
|
2013-08-13 17:24:18 +00:00
|
|
|
>> $seqres.full
|
2018-10-15 10:22:46 +01:00
|
|
|
$BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $send_files_dir/base.snap 2>> $seqres.full \
|
2013-08-13 17:24:18 +00:00
|
|
|
|| _fail "failed: '$@'"
|
|
|
|
|
echo "# $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base\
|
2018-10-15 10:22:46 +01:00
|
|
|
$SCRATCH_MNT/incr > ${send_files_dir}/incr.snap" >> $seqres.full
|
2013-08-13 17:24:18 +00:00
|
|
|
$BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base \
|
2018-10-15 10:22:46 +01:00
|
|
|
$SCRATCH_MNT/incr > $send_files_dir/incr.snap 2>> $seqres.full \
|
2013-08-13 17:24:18 +00:00
|
|
|
|| _fail "failed: '$@'"
|
|
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
run_check $FSSUM_PROG -A -f -w $send_files_dir/base.fssum \
|
|
|
|
|
$SCRATCH_MNT/base
|
|
|
|
|
run_check $FSSUM_PROG -A -f -w $send_files_dir/incr.fssum \
|
|
|
|
|
-x $SCRATCH_MNT/incr/base $SCRATCH_MNT/incr
|
2013-08-13 17:24:18 +00:00
|
|
|
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount >/dev/null 2>&1
|
2013-08-13 17:24:18 +00:00
|
|
|
echo "*** mkfs -dsize=$fsz" >>$seqres.full
|
|
|
|
|
echo "" >>$seqres.full
|
|
|
|
|
_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
|
|
|
|
|
|| _fail "size=$fsz mkfs failed"
|
2018-02-07 17:31:36 +08:00
|
|
|
_scratch_mount "-o noatime"
|
2013-08-13 17:24:18 +00:00
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
_run_btrfs_util_prog receive $SCRATCH_MNT < $send_files_dir/base.snap
|
|
|
|
|
run_check $FSSUM_PROG -r $send_files_dir/base.fssum $SCRATCH_MNT/base
|
2013-08-13 17:24:18 +00:00
|
|
|
|
2018-10-15 10:22:46 +01:00
|
|
|
_run_btrfs_util_prog receive $SCRATCH_MNT < $send_files_dir/incr.snap
|
|
|
|
|
run_check $FSSUM_PROG -r $send_files_dir/incr.fssum $SCRATCH_MNT/incr
|
2013-08-13 17:24:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "*** test send / receive"
|
|
|
|
|
|
|
|
|
|
fssize=`expr 2000 \* 1024 \* 1024`
|
|
|
|
|
ops=200
|
|
|
|
|
|
|
|
|
|
workout $fssize $ops
|
|
|
|
|
|
|
|
|
|
echo "*** done"
|
|
|
|
|
status=0
|
|
|
|
|
exit
|