]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests btrfs/007: test send / receive
authorJan Schmidt <list.xfs@jan-o-sch.net>
Tue, 13 Aug 2013 17:24:18 +0000 (17:24 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 13 Aug 2013 22:17:03 +0000 (17:17 -0500)
Basic send / receive functionality test for btrfs. Requires current
version of fsstress built (-x support). Relies on fssum tool but can
skip the test if it failed to build.

Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston: renumbered test from 316 to 007]

tests/btrfs/007 [new file with mode: 0755]
tests/btrfs/007.out [new file with mode: 0644]
tests/btrfs/group

diff --git a/tests/btrfs/007 b/tests/btrfs/007
new file mode 100755 (executable)
index 0000000..1617977
--- /dev/null
@@ -0,0 +1,116 @@
+#! /bin/bash
+# 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.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2013 STRATO.  All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=list.btrfs@jan-o-sch.net
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=`mktemp -d`
+status=1
+
+_cleanup()
+{
+       echo "*** unmount"
+       umount $SCRATCH_MNT 2>/dev/null
+       rm -f $tmp.*
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_seek_data_hole
+
+FSSUM_PROG=$here/src/fssum
+[ -x $FSSUM_PROG ] || _notrun "fssum not built"
+
+rm -f $seqres.full
+
+workout()
+{
+       fsz=$1
+       ops=$2
+
+       umount $SCRATCH_DEV >/dev/null 2>&1
+       echo "*** mkfs -dsize=$fsz"    >>$seqres.full
+       echo ""                                     >>$seqres.full
+       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
+               || _fail "size=$fsz mkfs failed"
+       run_check _scratch_mount "-o noatime"
+
+       run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
+               "$BTRFS_UTIL_PROG subvol snap -r $SCRATCH_MNT $SCRATCH_MNT/base"
+
+       run_check $BTRFS_UTIL_PROG subvol snap -r $SCRATCH_MNT $SCRATCH_MNT/incr
+
+       echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap" \
+               >> $seqres.full
+       $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap 2>> $seqres.full \
+               || _fail "failed: '$@'"
+       echo "# $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base\
+               $SCRATCH_MNT/incr > $tmp/incr.snap" >> $seqres.full
+       $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base \
+               $SCRATCH_MNT/incr > $tmp/incr.snap 2>> $seqres.full \
+               || _fail "failed: '$@'"
+
+       run_check $FSSUM_PROG -A -f -w $tmp/base.fssum $SCRATCH_MNT/base
+       run_check $FSSUM_PROG -A -f -w $tmp/incr.fssum -x $SCRATCH_MNT/incr/base \
+               $SCRATCH_MNT/incr
+
+       umount $SCRATCH_DEV >/dev/null 2>&1
+       echo "*** mkfs -dsize=$fsz"    >>$seqres.full
+       echo ""                                     >>$seqres.full
+       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
+               || _fail "size=$fsz mkfs failed"
+       run_check _scratch_mount "-o noatime"
+
+       run_check $BTRFS_UTIL_PROG receive $SCRATCH_MNT < $tmp/base.snap
+       run_check $FSSUM_PROG -r $tmp/base.fssum $SCRATCH_MNT/base
+
+       run_check $BTRFS_UTIL_PROG receive $SCRATCH_MNT < $tmp/incr.snap
+       run_check $FSSUM_PROG -r $tmp/incr.fssum $SCRATCH_MNT/incr
+}
+
+echo "*** test send / receive"
+
+fssize=`expr 2000 \* 1024 \* 1024`
+ops=200
+
+workout $fssize $ops
+
+echo "*** done"
+status=0
+exit
diff --git a/tests/btrfs/007.out b/tests/btrfs/007.out
new file mode 100644 (file)
index 0000000..8f8cec7
--- /dev/null
@@ -0,0 +1,4 @@
+QA output created by 007
+*** test send / receive
+*** done
+*** unmount
index 6f9325e34429a8a724c15bc7dcec8b069cb5226d..2c364f424d99641a894578674a844c295fab4c75 100644 (file)
@@ -9,3 +9,4 @@
 004 auto rw metadata
 005 auto
 006 auto quick
+007 auto rw metadata