Skip to contentSkip to conversation

xfs/032: properly test for corruption from xfs_copy

PATCH In review Eric Sandeen 2 participants 2 messages May 14, 2015 – May 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/032: properly test for corruption from xfs_copy

Quoted 1 line

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.

---

tests/xfs/032 +2 -1
index 60c4662..a3fb89f 100755
@@ -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));
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Sandeen

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.

Looks good to me.

Quoted 22 lines

---

tests/xfs/032 +2 -2
index 60c4662..a3fb89f 100755
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html