public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: cleanup tmp files in tests
Date: Fri, 6 Jan 2017 20:57:31 -0800	[thread overview]
Message-ID: <20170107045731.GC575@zzz> (raw)
In-Reply-To: <20170106034507.5915-1-eguan@redhat.com>

Hi Eryu,

On Fri, Jan 06, 2017 at 11:45:07AM +0800, Eryu Guan wrote:
> $tmp.* files should be removed in _cleanup() even if the test is not
> using any $tmp.* file explicitly, because common helper functions
> may take use of them too.
> 
> So cleanup tmp files properly in tests, and add a _cleanup()
> function and trap it on exit if the test doesn't do so, to make all
> tests consistent on the way they do cleanup.
> 
> Also remove other tmp files used by the tests and the harness so
> that we leave no new tmp files in /tmp dir after a full test run.
> 

Why exactly can't the boilerplate go in a preamble file which is sourced by all
the tests?  For example common/preamble containing something like:

	seq=`basename $0`
	seqres=$RESULT_DIR/$seq
	echo "QA output created by $seq"

	_cleanup()
	{
		cd /
		rm -f $tmp.*
	}

	here=`pwd`
	tmp=/tmp/$$
	status=1        # failure is the default!
	trap "_cleanup; exit \$status" 0 1 2 3 15

	. ./common/rc

Tests that need to do more cleanup could override the default trap.

Eric

  reply	other threads:[~2017-01-07  4:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06  3:45 [PATCH] fstests: cleanup tmp files in tests Eryu Guan
2017-01-07  4:57 ` Eric Biggers [this message]
2017-01-09 10:17   ` Eryu Guan
2017-01-09 10:46     ` Amir Goldstein
2017-01-12  4:24       ` Eryu Guan
2017-01-08 13:06 ` Amir Goldstein

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=20170107045731.GC575@zzz \
    --to=ebiggers3@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox