All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: John Snow <jsnow@redhat.com>, Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, kwolf@redhat.com, armbru@redhat.com,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 4/5] qemu-iotests: make python tests attempt to leave intermediate files
Date: Mon, 4 Sep 2017 10:51:24 +0100	[thread overview]
Message-ID: <20170904095124.GB21280@stefanha-x1.localdomain> (raw)
In-Reply-To: <20170831154759.GN4770@localhost.localdomain>

On Thu, Aug 31, 2017 at 11:47:59AM -0400, Jeff Cody wrote:
> On Thu, Aug 31, 2017 at 04:39:49PM +0100, Stefan Hajnoczi wrote:
> > On Wed, Aug 30, 2017 at 06:40:29PM -0400, John Snow wrote:
> > > 
> > > 
> > > On 08/30/2017 06:35 PM, Eric Blake wrote:
> > > > On 08/30/2017 05:28 PM, John Snow wrote:
> > > > 
> > > >> I'm a little iffy on this patch; I know that ./check can take care of
> > > >> our temp files for us now, but because each python test is itself a
> > > >> little mini-harness, I'm a little leery of moving the teardown to setup
> > > >> and trying to pre-clean the confetti before the test begins.
> > > >>
> > > >> What's the benefit? We still have to clean up these files per-test, but
> > > >> now it's slightly more error-prone and in a weird place.
> > > >>
> > > >> If we want to try to preserve the most-recent-failure-files, perhaps we
> > > >> can define a setting in the python test-runner that allows us to
> > > >> globally skip file cleanup.
> > > > 
> > > > On the other hand, since each test is a mini-harness, globally skipping
> > > > cleanup will make a two-part test fail on the second because of garbage
> > > > left behind by the first.
> > > > 
> > > 
> > > subtext was to have per-subtest files.
> > > 
> > > > Patch 5 adds a comment with another possible solution: teach the python
> > > > mini-harness to either clean all files in the directory, or to relocate
> > > > the directory according to test name, so that each mini-test starts with
> > > > a fresh location, and cleanup is then handled by the harness rather than
> > > > spaghetti pre-cleanup.  But any solution is better than our current
> > > > situation of nothing, so that's why I'm still okay with this patch as-is
> > > > as offering more (even if not perfect) than before.
> > > > 
> > > 
> > > I guess where I am unsure is really if this is better than what we
> > > currently do, which is to (try) to clean up after each test as best as
> > > we can. I don't see it as too different from trying to clean up before
> > > each test.
> > > 
> > > It does give us the ability to leave behind a little detritus after a
> > > failed run, but it's so imperfect that I wonder if it's worth shifting
> > > this code around to change not much.
> > 
> > An alternative is to define iotests.QMPTestCase.setUp() so it clears out
> > iotests.test_dir.  Unfortunately this still requires touching up all
> > setUp() methods so that they call super(TheClass, self).setUp().
> > 
> > At least there would be no need to delete specific files by name (e.g.
> > blind_remove(my_img)).
> > 
> 
> One reason to only remove specific files used in the test, is that it
> increases the chance that intermediate files will be left behind in case of
> test failure of a different test case.
> 
> I think the real long-term solution is to run each unittest test case in its
> own subdirectory, so that no intermediate file removal is necessary, and
> each test case is self-contained.

That could be achieved in the same way:

Modify iotests.QMPTestCase.setUp() to create a new directory and chdir()
into it.  This still requires touching up all existing setUp() methods
to call their superclass.

Stefan

  reply	other threads:[~2017-09-04  9:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 16:52 [Qemu-devel] [PATCH v3 0/5] qemu-iotests: place output in unique dir Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 1/5] qemu-iotests: set TEST_DIR to a unique dir for each test Jeff Cody
2017-08-30 22:15   ` John Snow
2017-08-30 22:39     ` Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 2/5] qemu-iotests: remove file cleanup from bash tests Jeff Cody
2017-08-30 22:17   ` John Snow
2017-09-05 11:17   ` Kevin Wolf
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 3/5] qemu-iotests: add 'blind_remove' for python tests Jeff Cody
2017-08-30 18:13   ` Eric Blake
2017-08-30 22:21     ` John Snow
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 4/5] qemu-iotests: make python tests attempt to leave intermediate files Jeff Cody
2017-08-30 18:33   ` Eric Blake
2017-08-30 22:28     ` John Snow
2017-08-30 22:35       ` Eric Blake
2017-08-30 22:40         ` John Snow
2017-08-31 15:39           ` Stefan Hajnoczi
2017-08-31 15:47             ` Jeff Cody
2017-09-04  9:51               ` Stefan Hajnoczi [this message]
2017-09-04 14:42                 ` Jeff Cody
2017-08-30 16:52 ` [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add option to save temp files on error Jeff Cody
2017-08-30 18:49   ` Eric Blake
2017-08-30 22:38   ` John Snow

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=20170904095124.GB21280@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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 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.