diff mbox

xfstests btrfs/314: test send / receive

Message ID 1370532033-20561-1-git-send-email-list.xfs@jan-o-sch.net (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jan Schmidt June 6, 2013, 3:20 p.m. UTC
Basic send / receive functionality test for btrfs. Requires current
version of fsstress built (-x support). Relies on fssum tool, which is
not part of the test suite but can skip the test if it is missing.

Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
---
 README              |    3 +
 common/config       |    2 +
 tests/btrfs/314     |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/314.out |    4 ++
 tests/btrfs/group   |    1 +
 5 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100755 tests/btrfs/314
 create mode 100644 tests/btrfs/314.out

Comments

Josef Bacik June 6, 2013, 5:49 p.m. UTC | #1
On Thu, Jun 06, 2013 at 09:20:33AM -0600, Jan Schmidt wrote:
> Basic send / receive functionality test for btrfs. Requires current
> version of fsstress built (-x support). Relies on fssum tool, which is
> not part of the test suite but can skip the test if it is missing.
> 
> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
> ---
>  README              |    3 +
>  common/config       |    2 +
>  tests/btrfs/314     |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/314.out |    4 ++
>  tests/btrfs/group   |    1 +
>  5 files changed, 123 insertions(+), 0 deletions(-)
>  create mode 100755 tests/btrfs/314
>  create mode 100644 tests/btrfs/314.out
> 
> diff --git a/README b/README
> index d4d4f31..56b31f0 100644
> --- a/README
> +++ b/README
> @@ -26,6 +26,9 @@ Preparing system for tests (IRIX and Linux):
>        http://www.extra.research.philips.com/udf/, then copy the udf_test 
>        binary to xfstests/src/. If you wish to disable UDF verification test
>        set the environment variable DISABLE_UDF_TEST to 1.
> +    - If you wish to run the btrfs send / receive components of the suite
> +      install fssum from
> +        git://git.kernel.org/pub/scm/linux/kernel/git/arne/far-progs.git
>  	
>      
>      - create one or two partitions to use for testing
> diff --git a/common/config b/common/config
> index 67c1498..1c11da3 100644
> --- a/common/config
> +++ b/common/config
> @@ -146,6 +146,8 @@ export SED_PROG="`set_prog_path sed`"
>  export BC_PROG="`set_prog_path bc`"
>  [ "$BC_PROG" = "" ] && _fatal "bc not found"
>  
> +export FSSUM_PROG="`set_prog_path fssum`"
> +
>  export PS_ALL_FLAGS="-ef"
>  
>  export DF_PROG="`set_prog_path df`"
> diff --git a/tests/btrfs/314 b/tests/btrfs/314
> new file mode 100755
> index 0000000..2e86428
> --- /dev/null
> +++ b/tests/btrfs/314
> @@ -0,0 +1,113 @@
> +#! /bin/bash
> +# FSQA Test No. 314
> +#
> +# 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_command $FSSUM_PROG fssum
> +
> +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/314.out b/tests/btrfs/314.out
> new file mode 100644
> index 0000000..3d491da
> --- /dev/null
> +++ b/tests/btrfs/314.out
> @@ -0,0 +1,4 @@
> +QA output created by 314
> +*** test send / receive
> +*** done
> +*** unmount
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index bc6c256..3ce34b2 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -9,3 +9,4 @@
>  276 auto rw metadata
>  284 auto
>  307 auto quick
> +314 auto rw metadata
> -- 
> 1.7.2.2
> 

It applys and runs fine with fssum and exits cleanly if it's not there.  The
test itself looks sane, so 

Reviewed-by: Josef Bacik <jbacik@fusionio.com>

Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen June 6, 2013, 5:54 p.m. UTC | #2
On 6/6/13 10:20 AM, Jan Schmidt wrote:
> Basic send / receive functionality test for btrfs. Requires current
> version of fsstress built (-x support). Relies on fssum tool, which is
> not part of the test suite but can skip the test if it is missing.
> 
> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>

w/o commenting on the test itself, I'm a little uneasy about requiring
some external, not-widely-installed tool for this to run.  The fear is
that it won't be run as often as it could/should be.

Could the same test be done w/o fssum, or should we maybe put a copy
of fssum into xfstests/src/fssum.c ?

Or does fssum exist in any standard distro package?

Thanks,
-Eric

> ---
>  README              |    3 +
>  common/config       |    2 +
>  tests/btrfs/314     |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/314.out |    4 ++
>  tests/btrfs/group   |    1 +
>  5 files changed, 123 insertions(+), 0 deletions(-)
>  create mode 100755 tests/btrfs/314
>  create mode 100644 tests/btrfs/314.out
> 
> diff --git a/README b/README
> index d4d4f31..56b31f0 100644
> --- a/README
> +++ b/README
> @@ -26,6 +26,9 @@ Preparing system for tests (IRIX and Linux):
>        http://www.extra.research.philips.com/udf/, then copy the udf_test 
>        binary to xfstests/src/. If you wish to disable UDF verification test
>        set the environment variable DISABLE_UDF_TEST to 1.
> +    - If you wish to run the btrfs send / receive components of the suite
> +      install fssum from
> +        git://git.kernel.org/pub/scm/linux/kernel/git/arne/far-progs.git
>  	
>      
>      - create one or two partitions to use for testing
> diff --git a/common/config b/common/config
> index 67c1498..1c11da3 100644
> --- a/common/config
> +++ b/common/config
> @@ -146,6 +146,8 @@ export SED_PROG="`set_prog_path sed`"
>  export BC_PROG="`set_prog_path bc`"
>  [ "$BC_PROG" = "" ] && _fatal "bc not found"
>  
> +export FSSUM_PROG="`set_prog_path fssum`"
> +
>  export PS_ALL_FLAGS="-ef"
>  
>  export DF_PROG="`set_prog_path df`"
> diff --git a/tests/btrfs/314 b/tests/btrfs/314
> new file mode 100755
> index 0000000..2e86428
> --- /dev/null
> +++ b/tests/btrfs/314
> @@ -0,0 +1,113 @@
> +#! /bin/bash
> +# FSQA Test No. 314
> +#
> +# 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_command $FSSUM_PROG fssum
> +
> +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/314.out b/tests/btrfs/314.out
> new file mode 100644
> index 0000000..3d491da
> --- /dev/null
> +++ b/tests/btrfs/314.out
> @@ -0,0 +1,4 @@
> +QA output created by 314
> +*** test send / receive
> +*** done
> +*** unmount
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index bc6c256..3ce34b2 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -9,3 +9,4 @@
>  276 auto rw metadata
>  284 auto
>  307 auto quick
> +314 auto rw metadata
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Schmidt June 7, 2013, 7:18 a.m. UTC | #3
(cc Arne for far-progs discussion)

On Thu, June 06, 2013 at 19:54 (+0200), Eric Sandeen wrote:
> On 6/6/13 10:20 AM, Jan Schmidt wrote:
>> Basic send / receive functionality test for btrfs. Requires current
>> version of fsstress built (-x support). Relies on fssum tool, which is
>> not part of the test suite but can skip the test if it is missing.
>>
>> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
> 
> w/o commenting on the test itself, I'm a little uneasy about requiring
> some external, not-widely-installed tool for this to run.  The fear is
> that it won't be run as often as it could/should be.

The main purpose is to have it run by developers changing something around btrfs
send / receive and probably the backref walker (while there exists a separate
test not requiring fssum for backrefs). I think we can get them to install fssum.

> Could the same test be done w/o fssum, or should we maybe put a copy
> of fssum into xfstests/src/fssum.c ?

I don't know any adequate replacement for fssum in this case. The purpose is to
build a checksum for a whole file system tree, including data and partly metadata.

I don't feel like copying fssum from far-progs into xfstests, though it probably
won't hurt much. However, I cannot promise we won't make changes to it for
far-progs, probably creating two incompatible versions of fssum in the wild. Arne?

> Or does fssum exist in any standard distro package?

It doesn't. Perhaps Josef can hurry and make a Fedora package for it, if that
prevents a separate copy to xfstests :-)

Thanks,
-Jan

> Thanks,
> -Eric
> 
>> ---
>>  README              |    3 +
>>  common/config       |    2 +
>>  tests/btrfs/314     |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/btrfs/314.out |    4 ++
>>  tests/btrfs/group   |    1 +
>>  5 files changed, 123 insertions(+), 0 deletions(-)
>>  create mode 100755 tests/btrfs/314
>>  create mode 100644 tests/btrfs/314.out
>>
>> diff --git a/README b/README
>> index d4d4f31..56b31f0 100644
>> --- a/README
>> +++ b/README
>> @@ -26,6 +26,9 @@ Preparing system for tests (IRIX and Linux):
>>        http://www.extra.research.philips.com/udf/, then copy the udf_test 
>>        binary to xfstests/src/. If you wish to disable UDF verification test
>>        set the environment variable DISABLE_UDF_TEST to 1.
>> +    - If you wish to run the btrfs send / receive components of the suite
>> +      install fssum from
>> +        git://git.kernel.org/pub/scm/linux/kernel/git/arne/far-progs.git
>>  	
>>      
>>      - create one or two partitions to use for testing
>> diff --git a/common/config b/common/config
>> index 67c1498..1c11da3 100644
>> --- a/common/config
>> +++ b/common/config
>> @@ -146,6 +146,8 @@ export SED_PROG="`set_prog_path sed`"
>>  export BC_PROG="`set_prog_path bc`"
>>  [ "$BC_PROG" = "" ] && _fatal "bc not found"
>>  
>> +export FSSUM_PROG="`set_prog_path fssum`"
>> +
>>  export PS_ALL_FLAGS="-ef"
>>  
>>  export DF_PROG="`set_prog_path df`"
>> diff --git a/tests/btrfs/314 b/tests/btrfs/314
>> new file mode 100755
>> index 0000000..2e86428
>> --- /dev/null
>> +++ b/tests/btrfs/314
>> @@ -0,0 +1,113 @@
>> +#! /bin/bash
>> +# FSQA Test No. 314
>> +#
>> +# 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_command $FSSUM_PROG fssum
>> +
>> +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/314.out b/tests/btrfs/314.out
>> new file mode 100644
>> index 0000000..3d491da
>> --- /dev/null
>> +++ b/tests/btrfs/314.out
>> @@ -0,0 +1,4 @@
>> +QA output created by 314
>> +*** test send / receive
>> +*** done
>> +*** unmount
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index bc6c256..3ce34b2 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -9,3 +9,4 @@
>>  276 auto rw metadata
>>  284 auto
>>  307 auto quick
>> +314 auto rw metadata
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Chinner June 7, 2013, 10:29 a.m. UTC | #4
On Fri, Jun 07, 2013 at 09:18:58AM +0200, Jan Schmidt wrote:
> (cc Arne for far-progs discussion)
> 
> On Thu, June 06, 2013 at 19:54 (+0200), Eric Sandeen wrote:
> > On 6/6/13 10:20 AM, Jan Schmidt wrote:
> >> Basic send / receive functionality test for btrfs. Requires current
> >> version of fsstress built (-x support). Relies on fssum tool, which is
> >> not part of the test suite but can skip the test if it is missing.
> >>
> >> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
> > 
> > w/o commenting on the test itself, I'm a little uneasy about requiring
> > some external, not-widely-installed tool for this to run.  The fear is
> > that it won't be run as often as it could/should be.
> 
> The main purpose is to have it run by developers changing something around btrfs
> send / receive and probably the backref walker (while there exists a separate
> test not requiring fssum for backrefs). I think we can get them to install fssum.

There's no point in having tests that require you to go find
something else before the tests can be run. That's been tried
before, and it doesn't work - the test just won't get run by
the majority of people who run xfstests.

> > Could the same test be done w/o fssum, or should we maybe put a copy
> > of fssum into xfstests/src/fssum.c ?
> 
> I don't know any adequate replacement for fssum in this case. The purpose is to
> build a checksum for a whole file system tree, including data and partly metadata.
> 
> I don't feel like copying fssum from far-progs into xfstests, though it probably
> won't hurt much. However, I cannot promise we won't make changes to it for
> far-progs, probably creating two incompatible versions of fssum in the wild. Arne?
> 
> > Or does fssum exist in any standard distro package?
> 
> It doesn't. Perhaps Josef can hurry and make a Fedora package for it, if that
> prevents a separate copy to xfstests :-)

No, it doesn't. Packages would be needed for debian, suse, SLES,
RHEL, etc for that to be a useful method of distribution. Just dump
a snapshot of the utility in the xfstests src dir so we don't have
to care about distribution issues...

Cheers,

Dave.
Eric Sandeen June 7, 2013, 2:50 p.m. UTC | #5
On 6/7/13 5:29 AM, Dave Chinner wrote:
> On Fri, Jun 07, 2013 at 09:18:58AM +0200, Jan Schmidt wrote:
>> (cc Arne for far-progs discussion)
>>
>> On Thu, June 06, 2013 at 19:54 (+0200), Eric Sandeen wrote:
>>> On 6/6/13 10:20 AM, Jan Schmidt wrote:
>>>> Basic send / receive functionality test for btrfs. Requires current
>>>> version of fsstress built (-x support). Relies on fssum tool, which is
>>>> not part of the test suite but can skip the test if it is missing.
>>>>
>>>> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
>>>
>>> w/o commenting on the test itself, I'm a little uneasy about requiring
>>> some external, not-widely-installed tool for this to run.  The fear is
>>> that it won't be run as often as it could/should be.
>>
>> The main purpose is to have it run by developers changing something around btrfs
>> send / receive and probably the backref walker (while there exists a separate
>> test not requiring fssum for backrefs). I think we can get them to install fssum.
> 
> There's no point in having tests that require you to go find
> something else before the tests can be run. That's been tried
> before, and it doesn't work - the test just won't get run by
> the majority of people who run xfstests.
> 
>>> Could the same test be done w/o fssum, or should we maybe put a copy
>>> of fssum into xfstests/src/fssum.c ?
>>
>> I don't know any adequate replacement for fssum in this case. The purpose is to
>> build a checksum for a whole file system tree, including data and partly metadata.
>>
>> I don't feel like copying fssum from far-progs into xfstests, though it probably
>> won't hurt much. However, I cannot promise we won't make changes to it for
>> far-progs, probably creating two incompatible versions of fssum in the wild. Arne?
>>
>>> Or does fssum exist in any standard distro package?
>>
>> It doesn't. Perhaps Josef can hurry and make a Fedora package for it, if that
>> prevents a separate copy to xfstests :-)
> 
> No, it doesn't. Packages would be needed for debian, suse, SLES,
> RHEL, etc for that to be a useful method of distribution. Just dump
> a snapshot of the utility in the xfstests src dir so we don't have
> to care about distribution issues...

Yup I agree with this, if it's not widely available or replaceable by more
common tools, let's just put a snapshot in xfstests.

-Eric

> Cheers,
> 
> Dave.
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arne Jansen June 7, 2013, 2:51 p.m. UTC | #6
On 07.06.2013 16:50, Eric Sandeen wrote:
> On 6/7/13 5:29 AM, Dave Chinner wrote:
>> On Fri, Jun 07, 2013 at 09:18:58AM +0200, Jan Schmidt wrote:
>>> (cc Arne for far-progs discussion)
>>>
>>> On Thu, June 06, 2013 at 19:54 (+0200), Eric Sandeen wrote:
>>>> On 6/6/13 10:20 AM, Jan Schmidt wrote:
>>>>> Basic send / receive functionality test for btrfs. Requires current
>>>>> version of fsstress built (-x support). Relies on fssum tool, which is
>>>>> not part of the test suite but can skip the test if it is missing.
>>>>>
>>>>> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
>>>>
>>>> w/o commenting on the test itself, I'm a little uneasy about requiring
>>>> some external, not-widely-installed tool for this to run.  The fear is
>>>> that it won't be run as often as it could/should be.
>>>
>>> The main purpose is to have it run by developers changing something around btrfs
>>> send / receive and probably the backref walker (while there exists a separate
>>> test not requiring fssum for backrefs). I think we can get them to install fssum.
>>
>> There's no point in having tests that require you to go find
>> something else before the tests can be run. That's been tried
>> before, and it doesn't work - the test just won't get run by
>> the majority of people who run xfstests.
>>
>>>> Could the same test be done w/o fssum, or should we maybe put a copy
>>>> of fssum into xfstests/src/fssum.c ?
>>>
>>> I don't know any adequate replacement for fssum in this case. The purpose is to
>>> build a checksum for a whole file system tree, including data and partly metadata.
>>>
>>> I don't feel like copying fssum from far-progs into xfstests, though it probably
>>> won't hurt much. However, I cannot promise we won't make changes to it for
>>> far-progs, probably creating two incompatible versions of fssum in the wild. Arne?
>>>
>>>> Or does fssum exist in any standard distro package?
>>>
>>> It doesn't. Perhaps Josef can hurry and make a Fedora package for it, if that
>>> prevents a separate copy to xfstests :-)
>>
>> No, it doesn't. Packages would be needed for debian, suse, SLES,
>> RHEL, etc for that to be a useful method of distribution. Just dump
>> a snapshot of the utility in the xfstests src dir so we don't have
>> to care about distribution issues...
> 
> Yup I agree with this, if it's not widely available or replaceable by more
> common tools, let's just put a snapshot in xfstests.

I'm fine with that, too.

-Arne

> 
> -Eric
> 
>> Cheers,
>>
>> Dave.
>>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Schmidt June 7, 2013, 2:53 p.m. UTC | #7
On Fri, June 07, 2013 at 16:51 (+0200), Arne Jansen wrote:
> On 07.06.2013 16:50, Eric Sandeen wrote:
>> On 6/7/13 5:29 AM, Dave Chinner wrote:
>>> On Fri, Jun 07, 2013 at 09:18:58AM +0200, Jan Schmidt wrote:
>>>> (cc Arne for far-progs discussion)
>>>>
>>>> On Thu, June 06, 2013 at 19:54 (+0200), Eric Sandeen wrote:
>>>>> On 6/6/13 10:20 AM, Jan Schmidt wrote:
>>>>>> Basic send / receive functionality test for btrfs. Requires current
>>>>>> version of fsstress built (-x support). Relies on fssum tool, which is
>>>>>> not part of the test suite but can skip the test if it is missing.
>>>>>>
>>>>>> Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
>>>>>
>>>>> w/o commenting on the test itself, I'm a little uneasy about requiring
>>>>> some external, not-widely-installed tool for this to run.  The fear is
>>>>> that it won't be run as often as it could/should be.
>>>>
>>>> The main purpose is to have it run by developers changing something around btrfs
>>>> send / receive and probably the backref walker (while there exists a separate
>>>> test not requiring fssum for backrefs). I think we can get them to install fssum.
>>>
>>> There's no point in having tests that require you to go find
>>> something else before the tests can be run. That's been tried
>>> before, and it doesn't work - the test just won't get run by
>>> the majority of people who run xfstests.
>>>
>>>>> Could the same test be done w/o fssum, or should we maybe put a copy
>>>>> of fssum into xfstests/src/fssum.c ?
>>>>
>>>> I don't know any adequate replacement for fssum in this case. The purpose is to
>>>> build a checksum for a whole file system tree, including data and partly metadata.
>>>>
>>>> I don't feel like copying fssum from far-progs into xfstests, though it probably
>>>> won't hurt much. However, I cannot promise we won't make changes to it for
>>>> far-progs, probably creating two incompatible versions of fssum in the wild. Arne?
>>>>
>>>>> Or does fssum exist in any standard distro package?
>>>>
>>>> It doesn't. Perhaps Josef can hurry and make a Fedora package for it, if that
>>>> prevents a separate copy to xfstests :-)
>>>
>>> No, it doesn't. Packages would be needed for debian, suse, SLES,
>>> RHEL, etc for that to be a useful method of distribution. Just dump
>>> a snapshot of the utility in the xfstests src dir so we don't have
>>> to care about distribution issues...
>>
>> Yup I agree with this, if it's not widely available or replaceable by more
>> common tools, let's just put a snapshot in xfstests.
> 
> I'm fine with that, too.

To prevent more agreement mails: I'll send a v2 including fssum.c, but probably
not today.

-Jan

> -Arne
> 
>>
>> -Eric
>>
>>> Cheers,
>>>
>>> Dave.
>>>
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/README b/README
index d4d4f31..56b31f0 100644
--- a/README
+++ b/README
@@ -26,6 +26,9 @@  Preparing system for tests (IRIX and Linux):
       http://www.extra.research.philips.com/udf/, then copy the udf_test 
       binary to xfstests/src/. If you wish to disable UDF verification test
       set the environment variable DISABLE_UDF_TEST to 1.
+    - If you wish to run the btrfs send / receive components of the suite
+      install fssum from
+        git://git.kernel.org/pub/scm/linux/kernel/git/arne/far-progs.git
 	
     
     - create one or two partitions to use for testing
diff --git a/common/config b/common/config
index 67c1498..1c11da3 100644
--- a/common/config
+++ b/common/config
@@ -146,6 +146,8 @@  export SED_PROG="`set_prog_path sed`"
 export BC_PROG="`set_prog_path bc`"
 [ "$BC_PROG" = "" ] && _fatal "bc not found"
 
+export FSSUM_PROG="`set_prog_path fssum`"
+
 export PS_ALL_FLAGS="-ef"
 
 export DF_PROG="`set_prog_path df`"
diff --git a/tests/btrfs/314 b/tests/btrfs/314
new file mode 100755
index 0000000..2e86428
--- /dev/null
+++ b/tests/btrfs/314
@@ -0,0 +1,113 @@ 
+#! /bin/bash
+# FSQA Test No. 314
+#
+# 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_command $FSSUM_PROG fssum
+
+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/314.out b/tests/btrfs/314.out
new file mode 100644
index 0000000..3d491da
--- /dev/null
+++ b/tests/btrfs/314.out
@@ -0,0 +1,4 @@ 
+QA output created by 314
+*** test send / receive
+*** done
+*** unmount
diff --git a/tests/btrfs/group b/tests/btrfs/group
index bc6c256..3ce34b2 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -9,3 +9,4 @@ 
 276 auto rw metadata
 284 auto
 307 auto quick
+314 auto rw metadata