xfs/432: fix this test when external devices are in use
PATCH 1/1 xfs/432: fix this test when external devices are in use
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.
--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +10 -1
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1 +repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?" # success, all done status=0
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-1@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1
tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 10 lines
tests/xfs/432 +10
-0+repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"
Make sense to me, I don't have better idea. One question, is xfs_metadump and xfs_mdrestore support rtdev? Due to I didn't find xfs_metadump have a "-r" option, although it has "-l logdev" :)
About the "$res", I don't know why we need this extra variable, as it's not used in other place.
Thanks,
Zorro
Quoted 4 lines
tests/xfs/432 +0
-0# success, all done status=0
Quoted 21 lines · Zorro Lang
Quoted 20 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-0@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img
Quoted 16 lines
tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 12 lines
tests/xfs/432 +10
-1echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1 +repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"Make sense to me, I don't have better idea. One question, is
xfs_metadumpandxfs_mdrestoresupport rtdev? Due to I didn't findxfs_metadumphave a "-r" option, although it has "-l logdev" :)
Oops, no it doesn't, so I'll remove that.
Quoted 2 lines
About the "$res", I don't know why we need this extra variable, as it's not used in other place.
If you don't pass the correct arguments to xfs_repair or the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.
--D
Quoted 8 lines
Thanks,
ZorroQuoted 4 lines
tests/xfs/432 +0
-0# success, all done status=0
Quoted 39 lines · Darrick J. Wong
Quoted 21 lines · Zorro Lang
Quoted 20 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-0@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_imgQuoted 16 lines
tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 12 lines
tests/xfs/432 +10
-1echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1 +repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"Make sense to me, I don't have better idea. One question, is
xfs_metadumpandxfs_mdrestoresupport rtdev? Due to I didn't findxfs_metadumphave a "-r" option, although it has "-l logdev" :)
Quoted 1 line
Oops, no it doesn't, so I'll remove that.
Hmm... it doesn't for now or won't for future?
So all test cases about xfs_metadump can't run with SCRATCH_RTDEV? Do we need something likes _require_nortdev?
Quoted 8 lines
Quoted 3 lines
About the "$res", I don't know why we need this extra variable, as it's not used in other place.
If you don't pass the correct arguments to
xfs_repairor the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.
Oh, I mean why not use the "$?" directly? Or :
$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 || \
echo "xfs_repair on restored fs returned $res?"
Looks like we don't need to save this return status and use it on other place. The "$res" looks redundant, although it's not wrong :)
Thanks,
Zorro
Quoted 12 lines
--D
Quoted 8 lines
Thanks,
ZorroQuoted 4 lines
tests/xfs/432 +0
-0# success, all done status=0
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-1@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1
tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 10 lines
tests/xfs/432 +10
-0+repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"
I don't like open coding external device support into individual tests.
i.e. Shouldn't this use a wrapper around check_xfs_filesystem() similar to _check_xfs_test_fs()? Call it check_xfs_scratch_fs() that uses SCRATCH_DEV by default, but if $1 is passed in use that as the scratch device instead?
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 37 lines · Dave Chinner
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-1@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 10 lines
tests/xfs/432 +10
-0+repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"I don't like open coding external device support into individual tests.
Quoted 4 lines
i.e. Shouldn't this use a wrapper around
check_xfs_filesystem()similar to_check_xfs_test_fs()? Call itcheck_xfs_scratch_fs()that usesSCRATCH_DEVby default, but if $1 is passed in use that as the scratch device instead?
Yeah, that would also work. IIRC there's one other fstest that does something similar to this.
--D
Quoted 6 lines
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH] xfs/432: fix this test when external devices are in useOM
In reply to Zorro LangQuoted 40 lines · Zorro Lang
Quoted 39 lines · Darrick J. Wong
Quoted 37 lines · Zorro Lang
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-1@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 10 lines
tests/xfs/432 +10
-0+repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"Make sense to me, I don't have better idea. One question, is
xfs_metadumpandxfs_mdrestoresupport rtdev? Due to I didn't findxfs_metadumphave a "-r" option, although it has "-l logdev" :)
Quoted 6 lines
Quoted 1 line
Oops, no it doesn't, so I'll remove that.
Hmm... it doesn't for now or won't for future?
So all test cases about
xfs_metadumpcan't run withSCRATCH_RTDEV? Do we need something likes_require_nortdev?
There's no need for metadump to touch the realtime device since it contains only file data.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
About the "$res", I don't know why we need this extra variable, as it's not used in other place.
If you don't pass the correct arguments to
xfs_repairor the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.
Quoted 6 lines
Oh, I mean why not use the "$?" directly? Or :
$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 || \
echo "xfs_repairon restored fs returned $res?"Looks like we don't need to save this return status and use it on other place. The "$res" looks redundant, although it's not wrong :)
Oh, yeah, I can do that too.
--D
Quoted 16 lines
Thanks,
ZorroQuoted 12 lines
--D
Quoted 8 lines
Thanks,
ZorroQuoted 4 lines
tests/xfs/432 +0
-0# success, all done status=0
Quoted 38 lines · Darrick J. Wong
Quoted 37 lines · Dave Chinner
Quoted 22 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to
xfs_repair-n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/432 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)tests/xfs/432 +0
-1@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" -$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101
Quoted 10 lines
tests/xfs/432 +10
-0+repair_args=('-n') +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + repair_args+=('-l' "$SCRATCH_LOGDEV") + +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + repair_args+=('-r' "$SCRATCH_RTDEV") + +$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 +res=$? +test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"I don't like open coding external device support into individual tests.
Quoted 7 lines
Quoted 4 lines
i.e. Shouldn't this use a wrapper around
check_xfs_filesystem()similar to_check_xfs_test_fs()? Call itcheck_xfs_scratch_fs()that usesSCRATCH_DEVby default, but if $1 is passed in use that as the scratch device instead?Yeah, that would also work. IIRC there's one other fstest that does something similar to this.
Actually, there already is a _scratch_xfs_repair, so I think I'll just re(ab)use it:
SCRATCH_DEV=$metadump_img _scratch_xfs_repair -n &>> $seqres.full || \
echo "xfs_repair on restored fs returned $?"
--D
Quoted 8 lines
--D
Quoted 6 lines
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]