xfstests: make test btrfs/025 more robust
diff mbox

Message ID 1390920396-20311-1-git-send-email-fdmanana@gmail.com
State Not Applicable
Headers show

Commit Message

Filipe Manana Jan. 28, 2014, 2:46 p.m. UTC
Make the test btrfs/025 not depend on the output of the btrfs tools
subvolume, send, receive and filesystem commands output. The output
of these commands has changed several times in the past, and it can
change again in the future. Therefore just test for failure/success
and not for the exact output on the success case.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 tests/btrfs/025     |   34 +++++++++++++++++-----------------
 tests/btrfs/025.out |   12 ------------
 2 files changed, 17 insertions(+), 29 deletions(-)

Comments

Josef Bacik Jan. 28, 2014, 2:51 p.m. UTC | #1
On 01/28/2014 09:46 AM, Filipe David Borba Manana wrote:
> Make the test btrfs/025 not depend on the output of the btrfs tools
> subvolume, send, receive and filesystem commands output. The output
> of these commands has changed several times in the past, and it can
> change again in the future. Therefore just test for failure/success
> and not for the exact output on the success case.
>
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>

Wow sorry didn't realize this already got taken, but still a good change 
to have anyway.

Reviewed-by: Josef Bacik <jbacik@fb.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

Patch
diff mbox

diff --git a/tests/btrfs/025 b/tests/btrfs/025
index 482467f..01b1f86 100755
--- a/tests/btrfs/025
+++ b/tests/btrfs/025
@@ -54,27 +54,27 @@  rm -f $seqres.full
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
-$XFS_IO_PROG -f -c "truncate 819200" $SCRATCH_MNT/foo | _filter_xfs_io
-$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
+run_check $XFS_IO_PROG -f -c "truncate 819200" $SCRATCH_MNT/foo
+run_check $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
 
-$XFS_IO_PROG -c "falloc -k 819200 667648" $SCRATCH_MNT/foo | _filter_xfs_io
-$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
+run_check $XFS_IO_PROG -c "falloc -k 819200 667648" $SCRATCH_MNT/foo
+run_check $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
 
-$XFS_IO_PROG -f -c "pwrite 1482752 2978" $SCRATCH_MNT/foo | _filter_xfs_io
-$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
+run_check $XFS_IO_PROG -c "pwrite 1482752 2978" $SCRATCH_MNT/foo
+run_check $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
 
-$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1 | \
-    _filter_scratch
+run_check $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
+    $SCRATCH_MNT/mysnap1
 
-$XFS_IO_PROG -f -c "truncate 883305" $SCRATCH_MNT/foo | _filter_xfs_io
-$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
+run_check $XFS_IO_PROG -c "truncate 883305" $SCRATCH_MNT/foo
+run_check $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT
 
-$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2 | \
-    _filter_scratch
+run_check $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
+    $SCRATCH_MNT/mysnap2
 
-$BTRFS_UTIL_PROG send $SCRATCH_MNT/mysnap1 -f $tmp/1.snap 2>&1 | _filter_scratch
-$BTRFS_UTIL_PROG send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
-    -f $tmp/2.snap 2>&1 | _filter_scratch
+run_check $BTRFS_UTIL_PROG send $SCRATCH_MNT/mysnap1 -f $tmp/1.snap
+run_check $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
+    -f $tmp/2.snap 2>&1
 
 md5sum $SCRATCH_MNT/foo | _filter_scratch
 md5sum $SCRATCH_MNT/mysnap1/foo | _filter_scratch
@@ -85,10 +85,10 @@  _check_btrfs_filesystem $SCRATCH_DEV
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
-$BTRFS_UTIL_PROG receive $SCRATCH_MNT -f $tmp/1.snap
+run_check $BTRFS_UTIL_PROG receive $SCRATCH_MNT -f $tmp/1.snap
 md5sum $SCRATCH_MNT/mysnap1/foo | _filter_scratch
 
-$BTRFS_UTIL_PROG receive $SCRATCH_MNT -f $tmp/2.snap
+run_check $BTRFS_UTIL_PROG receive $SCRATCH_MNT -f $tmp/2.snap
 md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
 
 _scratch_unmount
diff --git a/tests/btrfs/025.out b/tests/btrfs/025.out
index aaad4ab..9921aea 100644
--- a/tests/btrfs/025.out
+++ b/tests/btrfs/025.out
@@ -1,18 +1,6 @@ 
 QA output created by 025
-FSSync 'SCRATCH_MNT'
-FSSync 'SCRATCH_MNT'
-wrote 2978/2978 bytes at offset 1482752
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-FSSync 'SCRATCH_MNT'
-Create a readonly snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/mysnap1'
-FSSync 'SCRATCH_MNT'
-Create a readonly snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/mysnap2'
-At subvol SCRATCH_MNT/mysnap1
-At subvol SCRATCH_MNT/mysnap2
 129b8eaee8d3c2bcad49bec596591cb3  SCRATCH_MNT/foo
 42b6369eae2a8725c1aacc0440e597aa  SCRATCH_MNT/mysnap1/foo
 129b8eaee8d3c2bcad49bec596591cb3  SCRATCH_MNT/mysnap2/foo
-At subvol mysnap1
 42b6369eae2a8725c1aacc0440e597aa  SCRATCH_MNT/mysnap1/foo
-At snapshot mysnap2
 129b8eaee8d3c2bcad49bec596591cb3  SCRATCH_MNT/mysnap2/foo