diff mbox

xfs/032: properly test for corruption from xfs_copy

Message ID 5554C010.7020300@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Sandeen May 14, 2015, 3:32 p.m. UTC
From the xfs_repair manpage:

    xfs_repair run without the -n option will always return
    a status code of 0.

So we must use "-n" to detect corruption in this test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
	


--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eryu Guan May 15, 2015, 6:15 a.m. UTC | #1
On Thu, May 14, 2015 at 10:32:32AM -0500, Eric Sandeen wrote:
> From the xfs_repair manpage:
> 
>     xfs_repair run without the -n option will always return
>     a status code of 0.
> 
> So we must use "-n" to detect corruption in this test.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good to me.

Reviewed-by: Eryu Guan <eguan@redhat.com>

> ---
> 	
> 
> diff --git a/tests/xfs/032 b/tests/xfs/032
> index 60c4662..a3fb89f 100755
> --- a/tests/xfs/032
> +++ b/tests/xfs/032
> @@ -68,7 +68,8 @@ while [ $SECTORSIZE -le $PAGESIZE ]; do
>  
>  		$XFS_COPY_PROG -d $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
>  			_fail "Copy failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
> -		$XFS_REPAIR_PROG $IMGFILE >> $seqres.full 2>&1 || \
> +		# Must use "-n" to get exit code; without it xfs_repair always returns 0
> +		$XFS_REPAIR_PROG -n $IMGFILE >> $seqres.full 2>&1 || \
>  			_fail "Copy corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
>  
>  		BLOCKSIZE=$(($BLOCKSIZE * 2));
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" 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/tests/xfs/032 b/tests/xfs/032
index 60c4662..a3fb89f 100755
--- a/tests/xfs/032
+++ b/tests/xfs/032
@@ -68,7 +68,8 @@  while [ $SECTORSIZE -le $PAGESIZE ]; do
 
 		$XFS_COPY_PROG -d $SCRATCH_DEV $IMGFILE >> $seqres.full 2>&1 || \
 			_fail "Copy failed for Sector size $SECTORSIZE Block size $BLOCKSIZE"
-		$XFS_REPAIR_PROG $IMGFILE >> $seqres.full 2>&1 || \
+		# Must use "-n" to get exit code; without it xfs_repair always returns 0
+		$XFS_REPAIR_PROG -n $IMGFILE >> $seqres.full 2>&1 || \
 			_fail "Copy corrupted for Sector size $SECTORSIZE Block size $BLOCKSIZE"
 
 		BLOCKSIZE=$(($BLOCKSIZE * 2));