diff mbox

[v2,for-2.11,1/3] qemu-iotests: set TEST_DIR to a unique dir for each test

Message ID 3064c6292e5771533bab598210f7cbb791faa384.1501508049.git.jcody@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Cody July 31, 2017, 1:47 p.m. UTC
Right now, all qemu-iotests output data into the same scratch directory,
and so each tests needs to be responsible for cleanup 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(-)

Comments

Eric Blake July 31, 2017, 2:44 p.m. UTC | #1
On 07/31/2017 08:47 AM, Jeff Cody wrote:
> Right now, all qemu-iotests output data into the same scratch directory,
> and so each tests needs to be responsible for cleanup up its own files.

s/cleanup up/cleaning up/

> 
> 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(-)

R-b stands (thanks for adding the && fix from v1).
Jeff Cody July 31, 2017, 3:07 p.m. UTC | #2
On Mon, Jul 31, 2017 at 09:44:13AM -0500, Eric Blake wrote:
> On 07/31/2017 08:47 AM, Jeff Cody wrote:
> > Right now, all qemu-iotests output data into the same scratch directory,
> > and so each tests needs to be responsible for cleanup up its own files.
> 
> s/cleanup up/cleaning up/
>

Thanks - I'll send a v3 with that change after a while, in case there are more
comments. Or if someone applies it to their branch, they can just fix up the
commit message if they want.


(Hmm... I guess also s/each tests/each test as well, to be grammatically
correct)


> > 
> > 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(-)
> 
> R-b stands (thanks for adding the && fix from v1).
> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
>
diff mbox

Patch

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 2a55ec9..7a21ef6 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -254,6 +254,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
@@ -300,13 +301,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"
+            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
@@ -370,6 +381,8 @@  do
             fi
         fi
 
+        rm -rf "$TEST_DIR_SEQ"
+
     fi
 
     # come here for each test, except when $showme is true