All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Theodore Ts'o <tytso@mit.edu>, fstests@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH] generic: fix cleanup function for test 490
Date: Mon, 21 May 2018 10:54:00 +0800	[thread overview]
Message-ID: <20180521025400.GJ29080@desktop.hz.ali.com> (raw)
In-Reply-To: <20180521024144.GO10363@dastard>

On Mon, May 21, 2018 at 12:41:44PM +1000, Dave Chinner wrote:
> On Sun, May 20, 2018 at 02:45:17PM -0400, Theodore Ts'o wrote:
> > generic/490 fails because cleanup tries to delete . and .. since $tmp
> > is left unset, and so "rm -f $tmp.*" does nothing useful.  Instead
> > delete temp files created by seek_sanity_test.
> > 
> > Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> > ---
> >  tests/generic/490 | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/generic/490 b/tests/generic/490
> > index b5042c2e..c0335ca0 100755
> > --- a/tests/generic/490
> > +++ b/tests/generic/490
> > @@ -49,7 +49,7 @@ _require_test_program "seek_sanity_test"
> >  _cleanup()
> >  {
> >  	cd /
> > -	rm -f $tmp.*
> > +	rm -f $base_test_file*
> >  }
> >  
> >  $here/src/seek_sanity_test -s 19 -e 20 $base_test_file > $seqres.full 2>&1 ||
> 
> This is wrong. $tmp must always be set in a test, as the
> infrastructure uses it. Failing to set $tmp will result in stray
> files being spewed around the place by the test and not cleaned up.
> Hence the "rm -f $tmp.*" line must stay, the normal tmp=/tmp/$$ line
> added to the test preamble, and then you can remove the base test
> file...

Yeah, I wanted to point that out too. So always using the './new' script
is the recommended way to write new test, it already puts all the common
setups (including the 'tmp=/tmp/$$' definition and 'rm -f $tmp.*'
cleanup) in the test template.

Thanks,
Eryu

  reply	other threads:[~2018-05-21  2:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 18:45 [PATCH] generic: fix cleanup function for test 490 Theodore Ts'o
2018-05-21  2:29 ` Eryu Guan
2018-05-21  2:41 ` Dave Chinner
2018-05-21  2:54   ` Eryu Guan [this message]
2018-05-25  0:29     ` Dave Chinner
2018-05-25  0:59       ` Widespread test setup template problems (was Re: [PATCH] generic: fix cleanup function for test 490) Dave Chinner
2018-05-25  1:23         ` Dave Chinner
2018-05-25  4:17           ` Eric Biggers
2018-05-25  6:25             ` Dave Chinner
2018-05-25  8:06               ` Amir Goldstein
2018-05-25  8:45                 ` Dave Chinner
2018-05-25 22:33                   ` Eric Biggers
2018-05-25 23:25                     ` Dave Chinner
2018-05-27 12:38           ` Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180521025400.GJ29080@desktop.hz.ali.com \
    --to=guaneryu@gmail.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.