Re: [PATCH 1/2] fstests: generic test setup preamble

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



On Sun, Jun 03, 2018 at 09:53:16PM +0800, Eryu Guan wrote:
> On Tue, May 29, 2018 at 10:47:51AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > 
> > So many tests chop random bits out of the mandaotry test setup
> > preamble which leads to subtle problems and stray files being dumped
> > all over the place. Create a common test preamble with hooks for
> > local cleanup functions so we can prevent this in future.
> > 
> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> > ---
....

> > --- a/new
> > +++ b/new
> > @@ -181,31 +181,15 @@ cat <<End-of-File >$tdir/$id
> >  #-----------------------------------------------------------------------
> >  #
> >  
> > -seq=\`basename \$0\`
> > -seqres=\$RESULT_DIR/\$seq
> > -echo "QA output created by \$seq"
> > +. common/setup_test
> >  
> > -here=\`pwd\`
> > -tmp=/tmp/\$\$
> > -status=1	# failure is the default!
> > -trap "_cleanup; exit \\\$status" 0 1 2 3 15
> > -
> > -_cleanup()
> > -{
> > -	cd /
> > -	rm -f \$tmp.*
> > -}
> > -
> > -# get standard environment, filters and checks
> > -. ./common/rc
> > -. ./common/filter
> > +# test exit cleanup goes here
> > +local_cleanup() { true }
> 
> Should be just "cleanup" here.

Fixed.

> > diff --git a/tests/xfs/001 b/tests/xfs/001
> > index 2c205f064e2e..1b5a1020e173 100755
> > --- a/tests/xfs/001
> > +++ b/tests/xfs/001
> > @@ -23,44 +23,17 @@
> >  #-----------------------------------------------------------------------
> >  #
> >  
> > -seq=`basename $0`
> > -seqres=$RESULT_DIR/$seq
> > -echo "QA output created by $seq"
> > +. common/setup_test
> >  
> > -here=`pwd`
> > -tmp=/tmp/$$
> > -status=1	# failure is the default!
> > -trap "_cleanup; exit \$status" 0 1 2 3 15
> > -
> > -_cleanup()
> > -{
> > -    cd /
> > -    rm -f $tmp.*
> > +# test exit cleanup goes here
> > +cleanup() {
> > +	rm -rf $TEST_DIR/$$
> >  }
> >  
> > -_do_bit_test()
> 
> Removed by mistake? Test fails without it.

Hmmm - there's a hunk missing from this patch - I moved that
function down further into the test. it's in my current local
version and the test passes just fine. Not sure what went wrong
here...

Cheers,

Dave.

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



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux