qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
	armbru@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 1/5] qemu-iotests: set TEST_DIR to a unique dir for each test
Date: Wed, 30 Aug 2017 18:39:11 -0400	[thread overview]
Message-ID: <20170830223911.GM4770@localhost.localdomain> (raw)
In-Reply-To: <cb493e5c-0604-e572-c7e4-2276e29a6bdb@redhat.com>

On Wed, Aug 30, 2017 at 06:15:05PM -0400, John Snow wrote:
> 
> 
> On 08/30/2017 12:52 PM, Jeff Cody wrote:
> > Right now, all qemu-iotests output data into the same scratch directory,
> > and so each test needs to be responsible for cleaning up its own files.
> > 
> > Have each test use 'scratch/$seq' as its temp directory, so the check
> > script can do simple cleanup of removing the whole temporary directory.
> > 
> > Reviewed-by: Eric Blake <eblake@redhat.com>
> > Signed-off-by: Jeff Cody <jcody@redhat.com>
> > ---
> >  tests/qemu-iotests/check | 21 +++++++++++++++++----
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> > index d504b6e..f6ca85d 100755
> > --- a/tests/qemu-iotests/check
> > +++ b/tests/qemu-iotests/check
> > @@ -243,6 +243,7 @@ seq="check"
> >  
> >  for seq in $list
> >  do
> > +    TEST_DIR_SEQ=$TEST_DIR/$seq
> >      err=false
> >      printf %s "$seq"
> >      if [ -n "$TESTS_REMAINING_LOG" ] ; then
> > @@ -289,13 +290,23 @@ do
> >          fi
> >          export OUTPUT_DIR=$PWD
> >          if $debug; then
> > -            (cd "$source_iotests";
> > +            (
> > +            export TEST_DIR=$TEST_DIR_SEQ
> > +            . "$source_iotests/common.config"
> > +            . "$source_iotests/common.rc"
> 
> What purpose do these serve?
>

This is setting $TEST_DIR according to the $seq number (test # being run) in
the bash subshell that the tests are being run from.  So that all the other
variables that are based on the $TEST_DIR are set appropriately, this also
sources them in the subshell prior to running the test.  That way their
environment is with $TEST_DIR_SEQ rather than the original base $TEST_DIR.

> > +            cd "$source_iotests" &&
> >              MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
> > -                    $run_command -d 2>&1 | tee $tmp.out)
> > +                    $run_command -d 2>&1 | tee $tmp.out
> > +            )
> >          else
> > -            (cd "$source_iotests";
> > +            (
> > +            export TEST_DIR=$TEST_DIR_SEQ
> > +            . "$source_iotests/common.config"
> > +            . "$source_iotests/common.rc"
> > +             cd "$source_iotests" &&
> >              MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
> > -                    $run_command >$tmp.out 2>&1)
> > +                    $run_command >$tmp.out 2>&1
> > +            )
> >          fi
> >          sts=$?
> >          $timestamp && _timestamp
> > @@ -359,6 +370,8 @@ do
> >              fi
> >          fi
> >  
> > +        rm -rf "$TEST_DIR_SEQ"
> > +
> >      fi
> >  
> >      # come here for each test, except when $showme is true
> > 
> 
> Seems OK to me, though I am not able to answer all doubts about exactly
> how this may effect the strange pipe/subshell arrangements that occur
> deeper in the bowels of the included files for launching QEMU and so
> on.. I suppose that might be related to the inclusion of those
> common.XYZ files?
> 
> Tested-by: John Snow <jsnow@redhat.com>
> Reviewed-by: John Snow <jsnow@redhat.com>

  reply	other threads:[~2017-08-30 22:39 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 [this message]
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
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=20170830223911.GM4770@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).