Re: [PATCH 5/8] btrfs: convert some tests to new setup preamble

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



On Wed, Jun 27, 2018 at 02:30:13PM +0300, Amir Goldstein wrote:
> On Wed, Jun 27, 2018 at 11:21 AM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> >
> > Small initial batch to demonstrate conversion.
> >
> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> > ---
> [...]
> > diff --git a/tests/btrfs/007 b/tests/btrfs/007
> > index 09f2f011bc77..50ead03acf31 100755
> > --- a/tests/btrfs/007
> > +++ b/tests/btrfs/007
> > @@ -9,37 +9,23 @@
> >  # (incr) and send both snapshots to a temp file. Remake the file
> >  # system and receive from the files. Check both states with fssum.
> >  #
> > -# creator
> > -owner=list.btrfs@xxxxxxxxxxxxx
> > +. common/setup_test
> >
> > -seq=`basename $0`
> > -seqres=$RESULT_DIR/$seq
> > -echo "QA output created by $seq"
> > +# test exit cleanup goes here
> > +cleanup() { :; }
> >
> > -tmp=`mktemp -d`
> > -status=1
> > -
> > -_cleanup()
> > -{
> > -       echo "*** unmount"
> > -       _scratch_unmount 2>/dev/null
> > -       rm -f $tmp.*
> > -}
> 
> Bug in existing test - it does not cleanup $tmp.

Yup, because it creates a non-standard $tmp but then uses code that
assumes that tmp is the standard name prefix definition, not a
directory.  This is exactly the sort of bug I'm trying to eradicate.

And, FWIW, because the test is only using tmp files, it doesn't need
to use TEST_DIR to store them so no need for a working directory to
be defined.

> cleanup() { rm -rf $tmp }
> 
> -tmp=`mktemp -d`
> +mkdir -p $tmp

Again, no. $tmp is not a directory and there's infrastructure that
assumes it is not a directory.

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