Re: [PATCH] xfs/432: fix this test when external devices are in use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 27, 2022 at 07:59:55AM -0700, Darrick J. Wong wrote:
> On Wed, Jul 27, 2022 at 08:21:42PM +0800, Zorro Lang wrote:
> > On Tue, Jul 26, 2022 at 12:51:31PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@xxxxxxxxxx>
> > > 
> > > 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 <djwong@xxxxxxxxxx>
> > > ---
> > >  tests/xfs/432 |   11 ++++++++++-
> > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tests/xfs/432 b/tests/xfs/432
> > > index 86012f0b..5c6744ce 100755
> > > --- a/tests/xfs/432
> > > +++ b/tests/xfs/432
> > > @@ -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?"
> > 
> > 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" :)
> 
> 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?

> 
> > 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.

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

> 
> --D
> 
> > Thanks,
> > Zorro
> > 
> > >  
> > >  # success, all done
> > >  status=0
> > > 
> > 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux