Skip to contentSkip to conversation

qemu-iotests: stop using /tmp directly

PATCH In review Peter Wu 3 participants 5 messages Aug 22, 2014 – Aug 25, 2014

lore
Share & tools
lore

Peter Wu

author
#0 lore raw

PATCH 1/1 qemu-iotests: stop using /tmp directly

Before this patch you could not run multiple tests concurrently as they might clobber each other test files. This patch solves that by using random temporary directory instead of /tmp (for writing output in the individual tests and valgrind logs).

Furthermore, this patch stops removing everything in /tmp/ matching a certain pattern (/tmp/*.{err,out,time}). These might not be a property of QEMU.

Running multiple concurrent tests in the same object directory is still not supported though as the scratch directory and .bad and .notrun files still interfere with each other. Also not touched is the situation that /tmp/check.log and /tmp/check.sts are hard-coded (and thus unusable in concurrent tests).

---
Hi,

This patch introduces a dependency on mktemp of coreutils. I could still not get concurrent tests to work fully reliably (test 030 failed randomly with QED):

FAIL: test_ignore (__main__.TestEIO)
----------------------------------------------------------------------
Traceback (most recent call last):
File "030", line 223, in test_ignore
self.assert_qmp(result, 'return[0]/paused', False)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 233, in assert_qmp
result = self.dictpath(d, path)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 221, in dictpath
self.fail('invalid index "%s" in path "%s" in "%s"' % (idx, path, str(d)))
AssertionError: invalid index "0" in path "return[0]/paused" in "[]"

I still think that the patches are valuable though, it reduces predictable file names.

Kind regards,
Peter

---
 tests/qemu-iotests/001       | 2 +-
 tests/qemu-iotests/002       | 2 +-
 tests/qemu-iotests/003       | 2 +-
 tests/qemu-iotests/004       | 2 +-
 tests/qemu-iotests/005       | 2 +-
 tests/qemu-iotests/006       | 2 +-
 tests/qemu-iotests/007       | 2 +-
 tests/qemu-iotests/008       | 2 +-
 tests/qemu-iotests/009       | 2 +-
 tests/qemu-iotests/010       | 2 +-
 tests/qemu-iotests/011       | 2 +-
 tests/qemu-iotests/012       | 2 +-
 tests/qemu-iotests/013       | 2 +-
 tests/qemu-iotests/014       | 2 +-
 tests/qemu-iotests/015       | 2 +-
 tests/qemu-iotests/016       | 2 +-
 tests/qemu-iotests/017       | 2 +-
 tests/qemu-iotests/018       | 2 +-
 tests/qemu-iotests/019       | 2 +-
 tests/qemu-iotests/020       | 2 +-
 tests/qemu-iotests/021       | 2 +-
 tests/qemu-iotests/022       | 2 +-
 tests/qemu-iotests/023       | 2 +-
 tests/qemu-iotests/024       | 2 +-
 tests/qemu-iotests/025       | 2 +-
 tests/qemu-iotests/026       | 2 +-
 tests/qemu-iotests/027       | 2 +-
 tests/qemu-iotests/028       | 2 +-
 tests/qemu-iotests/029       | 2 +-
 tests/qemu-iotests/031       | 2 +-
 tests/qemu-iotests/032       | 2 +-
 tests/qemu-iotests/033       | 2 +-
 tests/qemu-iotests/034       | 2 +-
 tests/qemu-iotests/035       | 2 +-
 tests/qemu-iotests/036       | 2 +-
 tests/qemu-iotests/037       | 2 +-
 tests/qemu-iotests/038       | 2 +-
 tests/qemu-iotests/039       | 2 +-
 tests/qemu-iotests/042       | 2 +-
 tests/qemu-iotests/043       | 2 +-
 tests/qemu-iotests/046       | 2 +-
 tests/qemu-iotests/047       | 2 +-
 tests/qemu-iotests/049       | 2 +-
 tests/qemu-iotests/050       | 2 +-
 tests/qemu-iotests/051       | 2 +-
 tests/qemu-iotests/052       | 2 +-
 tests/qemu-iotests/053       | 2 +-
 tests/qemu-iotests/054       | 2 +-
 tests/qemu-iotests/058       | 2 +-
 tests/qemu-iotests/059       | 2 +-
 tests/qemu-iotests/060       | 2 +-
 tests/qemu-iotests/061       | 2 +-
 tests/qemu-iotests/062       | 2 +-
 tests/qemu-iotests/063       | 2 +-
 tests/qemu-iotests/064       | 2 +-
 tests/qemu-iotests/066       | 2 +-
 tests/qemu-iotests/067       | 2 +-
 tests/qemu-iotests/068       | 2 +-
 tests/qemu-iotests/069       | 2 +-
 tests/qemu-iotests/070       | 2 +-
 tests/qemu-iotests/071       | 2 +-
 tests/qemu-iotests/072       | 2 +-
 tests/qemu-iotests/073       | 2 +-
 tests/qemu-iotests/075       | 2 +-
 tests/qemu-iotests/076       | 2 +-
 tests/qemu-iotests/077       | 2 +-
 tests/qemu-iotests/078       | 2 +-
 tests/qemu-iotests/079       | 2 +-
 tests/qemu-iotests/080       | 2 +-
 tests/qemu-iotests/081       | 2 +-
 tests/qemu-iotests/082       | 2 +-
 tests/qemu-iotests/083       | 2 +-
 tests/qemu-iotests/084       | 2 +-
 tests/qemu-iotests/086       | 2 +-
 tests/qemu-iotests/087       | 2 +-
 tests/qemu-iotests/088       | 2 +-
 tests/qemu-iotests/089       | 2 +-
 tests/qemu-iotests/090       | 2 +-
 tests/qemu-iotests/092       | 2 +-
 tests/qemu-iotests/check     | 9 ++++++---
 tests/qemu-iotests/common.rc | 7 ++++---
 81 files changed, 89 insertions(+), 85 deletions(-)
tests/qemu-iotests/001 +1 -1
index 4e16469..6472c67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/002 +1 -1
index 6a865aa..112280a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/003 +1 -1
index 98638d4..f60b6d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/004 +1 -1
index 651072e..d878351 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/005 +1 -1
index ba1236d..e18d1c5 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/006 +1 -1
index 0c0cf5d..84589b7 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/007 +1 -1
index fe1a743..bbbe0fc 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/008 +1 -1
index 2d28efd..c0e6774 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/009 +1 -1
index 57a43f5..2cf52f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/010 +1 -1
index 896a005..e9c32e1 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/011 +1 -1
index 1c5158a..da7fc70 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/012 +1 -1
index 7c5b689..d1d59b1 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/013 +1 -1
index ea3cab9..6943933 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/014 +1 -1
index b23c2db..2398864 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/015 +1 -1
index 099d757..ea96464 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/016 +1 -1
index 7ea9e94..f1864b7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/017 +1 -1
index 3af3cdf..4f46bb7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/018 +1 -1
index d8a7d43..8da2304 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/019 +1 -1
index f5ecbf5..537912f 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/020 +1 -1
index 2f258dc..e190043 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/021 +1 -1
index 1c69024..66089d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/022 +1 -1
index d35b816..df6c537 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/023 +1 -1
index 9ad06b9..76692ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/024 +1 -1
index 9bf99e1..b75dcf2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/025 +1 -1
index a5f45b4..528d822 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/026 +1 -1
index df2884b..8be5d42 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/027 +1 -1
index 3fa81b8..5feba32 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/028 +1 -1
index a1f4423..ee1272d 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/029 +1 -1
index fa46ace..2de8ec5 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/031 +1 -1
index 2a77ba8..4ce2be3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/032 +1 -1
index b1ba5c3..60523b8 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/033 +1 -1
index ea3351c..00ee111 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/034 +1 -1
index 69c7858..539d0c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/035 +1 -1
index ebe9b8c..6778c70 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/036 +1 -1
index 392f1ef..65c6b66 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/037 +1 -1
index 9171d8c..aa5f8f3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/038 +1 -1
index cfaf00a..817ea4e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/039 +1 -1
index 84c9167..d34968b 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/042 +1 -1
index 94ce3a9..674e529 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/043 +1 -1
index b316b97..dcceaf6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/046 +1 -1
index e0be46c..740ed48 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/047 +1 -1
index c35cd09..6bc0b78 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/049 +1 -1
index 93aa0ea..e8880a9 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/050 +1 -1
index 07802bc..5ed97cf 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/051 +1 -1
index a41334e..3d67f90 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/052 +1 -1
index 6bdae92..b849f1b 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/053 +1 -1
index e589e5f..9fb1e93 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/054 +1 -1
index bd94153..316b8a2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/058 +1 -1
index 14584cd..5602bff 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
tests/qemu-iotests/059 +1 -1
index 3c053c2..82d94d3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/060 +1 -1
index 830386f..b79578f 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/061 +1 -1
index ab98def..49c08ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/062 +1 -1
index 0511246..06bcfe5 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/063 +1 -1
index a47493a..43d37d6 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/064 +1 -1
index 1c74c31..be791c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/066 +1 -1
index 1c2452b..e079845 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/067 +1 -1
index d025192..d3ac7d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/068 +1 -1
index b72e555..9fa5ef2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/069 +1 -1
index e661598..c41312a 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/070 +1 -1
index ea0dae7..ef1b28f 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/071 +1 -1
index 3924e51..a6fd2a2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/072 +1 -1
index 58faa8b..61ad7f4 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/073 +1 -1
index 392db54..d8b61a6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/075 +1 -1
index 40032c5..c835a02 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/076 +1 -1
index b614a7d..3950e5a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/077 +1 -1
index 4dd1bdd..d6e5dcb 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/078 +1 -1
index d4d6da7..88cc7d4 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/079 +1 -1
index 2142bbb..df546ed 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/080 +1 -1
index 6b3a3e7..d470d8a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/081 +1 -1
index 7ae4be2..5f688a3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/082 +1 -1
index f6eb75f..eeab7f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/083 +1 -1
index 991a9d9..4d81160 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/084 +1 -1
index ae33c2c..bbd06b1 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/086 +1 -1
index d9a80cf..763fc67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/087 +1 -1
index 82c56b1..b5e8d7c 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/088 +1 -1
index c09adf8..5b05f3e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/089 +1 -1
index dffc977..0e2dd91 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/090 +1 -1
index 8d032f8..2cffc46 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/092 +1 -1
index a8c0c9c..7f55083 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/check +6 -3
index 8ca4011..8e1061e 100755
@@ -19,7 +19,6 @@
 # Control script for QA
 #
 
-tmp=/tmp/$$
 status=0
 needwrap=true
 try=0
@@ -121,6 +120,10 @@ then
     _init_error "failed to source common.rc"
 fi
 
+# Temporary directory to store test results, will be removed by _wrapup
+QEMU_IOTESTS_TMPDIR=$(mktemp -d --tmpdir qemu-iotests.XXXXXXXX)
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
+
 # we need common
 . "$source_iotests/common"
 
@@ -197,9 +200,8 @@ END        { if (NR > 0) {
         needwrap=false
     fi
 
-    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
     rm -f /tmp/check.pid /tmp/check.sts
-    rm -f $tmp.*
+    rm -rf "$QEMU_IOTESTS_TMPDIR"
 }
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
@@ -349,6 +351,7 @@ do
                 fi
             fi
         fi
+        rm -f "$tmp.out"
 
     fi
 
tests/qemu-iotests/common.rc +4 -3
index 9c49deb..51762c2 100644
@@ -72,11 +72,12 @@ fi
 
 function valgrind_qemu_io()
 {
-    valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
+    local vgtmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$.valgrind
+    valgrind --log-file="$vgtmp" --error-exitcode=99 $REAL_QEMU_IO "$@"
     if [ $? != 0 ]; then
-        cat /tmp/$$.valgrind
+        cat "$vgtmp"
     fi
-    rm -f /tmp/$$.valgrind
+    rm -f "$vgtmp"
 }
 
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 15 lines · Peter Wu

Before this patch you could not run multiple tests concurrently as they might clobber each other test files. This patch solves that by using random temporary directory instead of /tmp (for writing output in the individual tests and valgrind logs).

Furthermore, this patch stops removing everything in /tmp/ matching a certain pattern (/tmp/*.{err,out,time}). These might not be a property of QEMU.

Running multiple concurrent tests in the same object directory is still not supported though as the scratch directory and .bad and .notrun files still interfere with each other. Also not touched is the situation that /tmp/check.log and /tmp/check.sts are hard-coded (and thus unusable in concurrent tests).

Quoted 6 lines

---
Hi,

This patch introduces a dependency on mktemp of coreutils. I could still not get concurrent tests to work fully reliably (test 030 failed randomly with QED):

Do we care about the BSDs ?

See the link in the anwser of: http://stackoverflow.com/questions/2792675/how-portable-is-mktemp1

--tmpdir seems to be a GNUism.

Best regards

Benoît

Quoted 1,194 lines

FAIL: test_ignore (__main__.TestEIO)
----------------------------------------------------------------------
Traceback (most recent call last):
File "030", line 223, in test_ignore
self.assert_qmp(result, 'return[0]/paused', False)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 233, in assert_qmp
result = self.dictpath(d, path)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 221, in dictpath
self.fail('invalid index "%s" in path "%s" in "%s"' % (idx, path, str(d)))
AssertionError: invalid index "0" in path "return[0]/paused" in "[]"

I still think that the patches are valuable though, it reduces predictable file names.

Kind regards,
Peter

---
 tests/qemu-iotests/001       | 2 +-
 tests/qemu-iotests/002       | 2 +-
 tests/qemu-iotests/003       | 2 +-
 tests/qemu-iotests/004       | 2 +-
 tests/qemu-iotests/005       | 2 +-
 tests/qemu-iotests/006       | 2 +-
 tests/qemu-iotests/007       | 2 +-
 tests/qemu-iotests/008       | 2 +-
 tests/qemu-iotests/009       | 2 +-
 tests/qemu-iotests/010       | 2 +-
 tests/qemu-iotests/011       | 2 +-
 tests/qemu-iotests/012       | 2 +-
 tests/qemu-iotests/013       | 2 +-
 tests/qemu-iotests/014       | 2 +-
 tests/qemu-iotests/015       | 2 +-
 tests/qemu-iotests/016       | 2 +-
 tests/qemu-iotests/017       | 2 +-
 tests/qemu-iotests/018       | 2 +-
 tests/qemu-iotests/019       | 2 +-
 tests/qemu-iotests/020       | 2 +-
 tests/qemu-iotests/021       | 2 +-
 tests/qemu-iotests/022       | 2 +-
 tests/qemu-iotests/023       | 2 +-
 tests/qemu-iotests/024       | 2 +-
 tests/qemu-iotests/025       | 2 +-
 tests/qemu-iotests/026       | 2 +-
 tests/qemu-iotests/027       | 2 +-
 tests/qemu-iotests/028       | 2 +-
 tests/qemu-iotests/029       | 2 +-
 tests/qemu-iotests/031       | 2 +-
 tests/qemu-iotests/032       | 2 +-
 tests/qemu-iotests/033       | 2 +-
 tests/qemu-iotests/034       | 2 +-
 tests/qemu-iotests/035       | 2 +-
 tests/qemu-iotests/036       | 2 +-
 tests/qemu-iotests/037       | 2 +-
 tests/qemu-iotests/038       | 2 +-
 tests/qemu-iotests/039       | 2 +-
 tests/qemu-iotests/042       | 2 +-
 tests/qemu-iotests/043       | 2 +-
 tests/qemu-iotests/046       | 2 +-
 tests/qemu-iotests/047       | 2 +-
 tests/qemu-iotests/049       | 2 +-
 tests/qemu-iotests/050       | 2 +-
 tests/qemu-iotests/051       | 2 +-
 tests/qemu-iotests/052       | 2 +-
 tests/qemu-iotests/053       | 2 +-
 tests/qemu-iotests/054       | 2 +-
 tests/qemu-iotests/058       | 2 +-
 tests/qemu-iotests/059       | 2 +-
 tests/qemu-iotests/060       | 2 +-
 tests/qemu-iotests/061       | 2 +-
 tests/qemu-iotests/062       | 2 +-
 tests/qemu-iotests/063       | 2 +-
 tests/qemu-iotests/064       | 2 +-
 tests/qemu-iotests/066       | 2 +-
 tests/qemu-iotests/067       | 2 +-
 tests/qemu-iotests/068       | 2 +-
 tests/qemu-iotests/069       | 2 +-
 tests/qemu-iotests/070       | 2 +-
 tests/qemu-iotests/071       | 2 +-
 tests/qemu-iotests/072       | 2 +-
 tests/qemu-iotests/073       | 2 +-
 tests/qemu-iotests/075       | 2 +-
 tests/qemu-iotests/076       | 2 +-
 tests/qemu-iotests/077       | 2 +-
 tests/qemu-iotests/078       | 2 +-
 tests/qemu-iotests/079       | 2 +-
 tests/qemu-iotests/080       | 2 +-
 tests/qemu-iotests/081       | 2 +-
 tests/qemu-iotests/082       | 2 +-
 tests/qemu-iotests/083       | 2 +-
 tests/qemu-iotests/084       | 2 +-
 tests/qemu-iotests/086       | 2 +-
 tests/qemu-iotests/087       | 2 +-
 tests/qemu-iotests/088       | 2 +-
 tests/qemu-iotests/089       | 2 +-
 tests/qemu-iotests/090       | 2 +-
 tests/qemu-iotests/092       | 2 +-
 tests/qemu-iotests/check     | 9 ++++++---
 tests/qemu-iotests/common.rc | 7 ++++---
 81 files changed, 89 insertions(+), 85 deletions(-)
tests/qemu-iotests/001 +1 -1
index 4e16469..6472c67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/002 +1 -1
index 6a865aa..112280a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/003 +1 -1
index 98638d4..f60b6d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/004 +1 -1
index 651072e..d878351 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/005 +1 -1
index ba1236d..e18d1c5 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/006 +1 -1
index 0c0cf5d..84589b7 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/007 +1 -1
index fe1a743..bbbe0fc 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/008 +1 -1
index 2d28efd..c0e6774 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/009 +1 -1
index 57a43f5..2cf52f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/010 +1 -1
index 896a005..e9c32e1 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/011 +1 -1
index 1c5158a..da7fc70 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/012 +1 -1
index 7c5b689..d1d59b1 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/013 +1 -1
index ea3cab9..6943933 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/014 +1 -1
index b23c2db..2398864 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/015 +1 -1
index 099d757..ea96464 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/016 +1 -1
index 7ea9e94..f1864b7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/017 +1 -1
index 3af3cdf..4f46bb7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/018 +1 -1
index d8a7d43..8da2304 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/019 +1 -1
index f5ecbf5..537912f 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/020 +1 -1
index 2f258dc..e190043 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/021 +1 -1
index 1c69024..66089d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/022 +1 -1
index d35b816..df6c537 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/023 +1 -1
index 9ad06b9..76692ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/024 +1 -1
index 9bf99e1..b75dcf2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/025 +1 -1
index a5f45b4..528d822 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/026 +1 -1
index df2884b..8be5d42 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/027 +1 -1
index 3fa81b8..5feba32 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/028 +1 -1
index a1f4423..ee1272d 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/029 +1 -1
index fa46ace..2de8ec5 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/031 +1 -1
index 2a77ba8..4ce2be3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/032 +1 -1
index b1ba5c3..60523b8 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/033 +1 -1
index ea3351c..00ee111 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/034 +1 -1
index 69c7858..539d0c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/035 +1 -1
index ebe9b8c..6778c70 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/036 +1 -1
index 392f1ef..65c6b66 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/037 +1 -1
index 9171d8c..aa5f8f3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/038 +1 -1
index cfaf00a..817ea4e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/039 +1 -1
index 84c9167..d34968b 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/042 +1 -1
index 94ce3a9..674e529 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/043 +1 -1
index b316b97..dcceaf6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/046 +1 -1
index e0be46c..740ed48 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/047 +1 -1
index c35cd09..6bc0b78 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/049 +1 -1
index 93aa0ea..e8880a9 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/050 +1 -1
index 07802bc..5ed97cf 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/051 +1 -1
index a41334e..3d67f90 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/052 +1 -1
index 6bdae92..b849f1b 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/053 +1 -1
index e589e5f..9fb1e93 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/054 +1 -1
index bd94153..316b8a2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/058 +1 -1
index 14584cd..5602bff 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
tests/qemu-iotests/059 +1 -1
index 3c053c2..82d94d3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/060 +1 -1
index 830386f..b79578f 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/061 +1 -1
index ab98def..49c08ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/062 +1 -1
index 0511246..06bcfe5 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/063 +1 -1
index a47493a..43d37d6 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/064 +1 -1
index 1c74c31..be791c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/066 +1 -1
index 1c2452b..e079845 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/067 +1 -1
index d025192..d3ac7d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/068 +1 -1
index b72e555..9fa5ef2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/069 +1 -1
index e661598..c41312a 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/070 +1 -1
index ea0dae7..ef1b28f 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/071 +1 -1
index 3924e51..a6fd2a2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/072 +1 -1
index 58faa8b..61ad7f4 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/073 +1 -1
index 392db54..d8b61a6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/075 +1 -1
index 40032c5..c835a02 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/076 +1 -1
index b614a7d..3950e5a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/077 +1 -1
index 4dd1bdd..d6e5dcb 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/078 +1 -1
index d4d6da7..88cc7d4 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/079 +1 -1
index 2142bbb..df546ed 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/080 +1 -1
index 6b3a3e7..d470d8a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/081 +1 -1
index 7ae4be2..5f688a3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/082 +1 -1
index f6eb75f..eeab7f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/083 +1 -1
index 991a9d9..4d81160 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/084 +1 -1
index ae33c2c..bbd06b1 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/086 +1 -1
index d9a80cf..763fc67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/087 +1 -1
index 82c56b1..b5e8d7c 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/088 +1 -1
index c09adf8..5b05f3e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/089 +1 -1
index dffc977..0e2dd91 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/090 +1 -1
index 8d032f8..2cffc46 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/092 +1 -1
index a8c0c9c..7f55083 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/check +6 -3
index 8ca4011..8e1061e 100755
@@ -19,7 +19,6 @@
 # Control script for QA
 #
 
-tmp=/tmp/$$
 status=0
 needwrap=true
 try=0
@@ -121,6 +120,10 @@ then
     _init_error "failed to source common.rc"
 fi
 
+# Temporary directory to store test results, will be removed by _wrapup
+QEMU_IOTESTS_TMPDIR=$(mktemp -d --tmpdir qemu-iotests.XXXXXXXX)
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
+
 # we need common
 . "$source_iotests/common"
 
@@ -197,9 +200,8 @@ END        { if (NR > 0) {
         needwrap=false
     fi
 
-    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
     rm -f /tmp/check.pid /tmp/check.sts
-    rm -f $tmp.*
+    rm -rf "$QEMU_IOTESTS_TMPDIR"
 }
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
@@ -349,6 +351,7 @@ do
                 fi
             fi
         fi
+        rm -f "$tmp.out"
 
     fi
 
tests/qemu-iotests/common.rc +4 -3
index 9c49deb..51762c2 100644
@@ -72,11 +72,12 @@ fi
 
 function valgrind_qemu_io()
 {
-    valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
+    local vgtmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$.valgrind
+    valgrind --log-file="$vgtmp" --error-exitcode=99 $REAL_QEMU_IO "$@"
     if [ $? != 0 ]; then
-        cat /tmp/$$.valgrind
+        cat "$vgtmp"
     fi
-    rm -f /tmp/$$.valgrind
+    rm -f "$vgtmp"
 }
 
 
Signature · 1 line
2.1.0
author
#2 lore raw
Quoted 20 lines · On Friday 22 August 2014 20:58:34 Benoît Canet wrote:
Quoted 19 lines · Peter Wu

Before this patch you could not run multiple tests concurrently as they might clobber each other test files. This patch solves that by using random temporary directory instead of /tmp (for writing output in the individual tests and valgrind logs).

Furthermore, this patch stops removing everything in /tmp/ matching a certain pattern (/tmp/*.{err,out,time}). These might not be a property of QEMU.

Running multiple concurrent tests in the same object directory is still not supported though as the scratch directory and .bad and .notrun files still interfere with each other. Also not touched is the situation that /tmp/check.log and /tmp/check.sts are hard-coded (and thus unusable in concurrent tests).

---
Hi,

Quoted 8 lines
Quoted 2 lines

This patch introduces a dependency on mktemp of coreutils. I could still not get concurrent tests to work fully reliably (test 030 failed randomly with QED):

Do we care about the BSDs ?

See the link in the anwser of: http://stackoverflow.com/questions/2792675/how-portable-is-mktemp1

--tmpdir seems to be a GNUism.

And -t differs between FreeBSD and others too. There is probably nobody who cares about locations other than /tmp, so what about:

    QEMU_IOTESTS_TMPDIR=$(mktemp -d /tmp/qemu-iotests.XXXXXXXX)

What do you think of the idea of the patch in general?

Kind regards,
Peter
https://lekensteyn.nl

Quoted 1,189 lines
Quoted 1,189 lines

FAIL: test_ignore (__main__.TestEIO)
----------------------------------------------------------------------
Traceback (most recent call last):
File "030", line 223, in test_ignore
self.assert_qmp(result, 'return[0]/paused', False)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 233, in assert_qmp
result = self.dictpath(d, path)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 221, in dictpath
self.fail('invalid index "%s" in path "%s" in "%s"' % (idx, path, str(d)))
AssertionError: invalid index "0" in path "return[0]/paused" in "[]"

I still think that the patches are valuable though, it reduces predictable file names.

Kind regards,
Peter

---
 tests/qemu-iotests/001       | 2 +-
 tests/qemu-iotests/002       | 2 +-
 tests/qemu-iotests/003       | 2 +-
 tests/qemu-iotests/004       | 2 +-
 tests/qemu-iotests/005       | 2 +-
 tests/qemu-iotests/006       | 2 +-
 tests/qemu-iotests/007       | 2 +-
 tests/qemu-iotests/008       | 2 +-
 tests/qemu-iotests/009       | 2 +-
 tests/qemu-iotests/010       | 2 +-
 tests/qemu-iotests/011       | 2 +-
 tests/qemu-iotests/012       | 2 +-
 tests/qemu-iotests/013       | 2 +-
 tests/qemu-iotests/014       | 2 +-
 tests/qemu-iotests/015       | 2 +-
 tests/qemu-iotests/016       | 2 +-
 tests/qemu-iotests/017       | 2 +-
 tests/qemu-iotests/018       | 2 +-
 tests/qemu-iotests/019       | 2 +-
 tests/qemu-iotests/020       | 2 +-
 tests/qemu-iotests/021       | 2 +-
 tests/qemu-iotests/022       | 2 +-
 tests/qemu-iotests/023       | 2 +-
 tests/qemu-iotests/024       | 2 +-
 tests/qemu-iotests/025       | 2 +-
 tests/qemu-iotests/026       | 2 +-
 tests/qemu-iotests/027       | 2 +-
 tests/qemu-iotests/028       | 2 +-
 tests/qemu-iotests/029       | 2 +-
 tests/qemu-iotests/031       | 2 +-
 tests/qemu-iotests/032       | 2 +-
 tests/qemu-iotests/033       | 2 +-
 tests/qemu-iotests/034       | 2 +-
 tests/qemu-iotests/035       | 2 +-
 tests/qemu-iotests/036       | 2 +-
 tests/qemu-iotests/037       | 2 +-
 tests/qemu-iotests/038       | 2 +-
 tests/qemu-iotests/039       | 2 +-
 tests/qemu-iotests/042       | 2 +-
 tests/qemu-iotests/043       | 2 +-
 tests/qemu-iotests/046       | 2 +-
 tests/qemu-iotests/047       | 2 +-
 tests/qemu-iotests/049       | 2 +-
 tests/qemu-iotests/050       | 2 +-
 tests/qemu-iotests/051       | 2 +-
 tests/qemu-iotests/052       | 2 +-
 tests/qemu-iotests/053       | 2 +-
 tests/qemu-iotests/054       | 2 +-
 tests/qemu-iotests/058       | 2 +-
 tests/qemu-iotests/059       | 2 +-
 tests/qemu-iotests/060       | 2 +-
 tests/qemu-iotests/061       | 2 +-
 tests/qemu-iotests/062       | 2 +-
 tests/qemu-iotests/063       | 2 +-
 tests/qemu-iotests/064       | 2 +-
 tests/qemu-iotests/066       | 2 +-
 tests/qemu-iotests/067       | 2 +-
 tests/qemu-iotests/068       | 2 +-
 tests/qemu-iotests/069       | 2 +-
 tests/qemu-iotests/070       | 2 +-
 tests/qemu-iotests/071       | 2 +-
 tests/qemu-iotests/072       | 2 +-
 tests/qemu-iotests/073       | 2 +-
 tests/qemu-iotests/075       | 2 +-
 tests/qemu-iotests/076       | 2 +-
 tests/qemu-iotests/077       | 2 +-
 tests/qemu-iotests/078       | 2 +-
 tests/qemu-iotests/079       | 2 +-
 tests/qemu-iotests/080       | 2 +-
 tests/qemu-iotests/081       | 2 +-
 tests/qemu-iotests/082       | 2 +-
 tests/qemu-iotests/083       | 2 +-
 tests/qemu-iotests/084       | 2 +-
 tests/qemu-iotests/086       | 2 +-
 tests/qemu-iotests/087       | 2 +-
 tests/qemu-iotests/088       | 2 +-
 tests/qemu-iotests/089       | 2 +-
 tests/qemu-iotests/090       | 2 +-
 tests/qemu-iotests/092       | 2 +-
 tests/qemu-iotests/check     | 9 ++++++---
 tests/qemu-iotests/common.rc | 7 ++++---
 81 files changed, 89 insertions(+), 85 deletions(-)
tests/qemu-iotests/001 +1 -1
index 4e16469..6472c67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/002 +1 -1
index 6a865aa..112280a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/003 +1 -1
index 98638d4..f60b6d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/004 +1 -1
index 651072e..d878351 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/005 +1 -1
index ba1236d..e18d1c5 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/006 +1 -1
index 0c0cf5d..84589b7 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/007 +1 -1
index fe1a743..bbbe0fc 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/008 +1 -1
index 2d28efd..c0e6774 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/009 +1 -1
index 57a43f5..2cf52f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/010 +1 -1
index 896a005..e9c32e1 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/011 +1 -1
index 1c5158a..da7fc70 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/012 +1 -1
index 7c5b689..d1d59b1 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/013 +1 -1
index ea3cab9..6943933 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/014 +1 -1
index b23c2db..2398864 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/015 +1 -1
index 099d757..ea96464 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/016 +1 -1
index 7ea9e94..f1864b7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/017 +1 -1
index 3af3cdf..4f46bb7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/018 +1 -1
index d8a7d43..8da2304 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/019 +1 -1
index f5ecbf5..537912f 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/020 +1 -1
index 2f258dc..e190043 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/021 +1 -1
index 1c69024..66089d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/022 +1 -1
index d35b816..df6c537 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/023 +1 -1
index 9ad06b9..76692ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/024 +1 -1
index 9bf99e1..b75dcf2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/025 +1 -1
index a5f45b4..528d822 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/026 +1 -1
index df2884b..8be5d42 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/027 +1 -1
index 3fa81b8..5feba32 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/028 +1 -1
index a1f4423..ee1272d 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/029 +1 -1
index fa46ace..2de8ec5 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/031 +1 -1
index 2a77ba8..4ce2be3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/032 +1 -1
index b1ba5c3..60523b8 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/033 +1 -1
index ea3351c..00ee111 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/034 +1 -1
index 69c7858..539d0c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/035 +1 -1
index ebe9b8c..6778c70 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/036 +1 -1
index 392f1ef..65c6b66 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/037 +1 -1
index 9171d8c..aa5f8f3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/038 +1 -1
index cfaf00a..817ea4e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/039 +1 -1
index 84c9167..d34968b 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/042 +1 -1
index 94ce3a9..674e529 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/043 +1 -1
index b316b97..dcceaf6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/046 +1 -1
index e0be46c..740ed48 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/047 +1 -1
index c35cd09..6bc0b78 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/049 +1 -1
index 93aa0ea..e8880a9 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/050 +1 -1
index 07802bc..5ed97cf 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/051 +1 -1
index a41334e..3d67f90 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/052 +1 -1
index 6bdae92..b849f1b 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/053 +1 -1
index e589e5f..9fb1e93 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/054 +1 -1
index bd94153..316b8a2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/058 +1 -1
index 14584cd..5602bff 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
tests/qemu-iotests/059 +1 -1
index 3c053c2..82d94d3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/060 +1 -1
index 830386f..b79578f 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/061 +1 -1
index ab98def..49c08ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/062 +1 -1
index 0511246..06bcfe5 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/063 +1 -1
index a47493a..43d37d6 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/064 +1 -1
index 1c74c31..be791c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/066 +1 -1
index 1c2452b..e079845 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/067 +1 -1
index d025192..d3ac7d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/068 +1 -1
index b72e555..9fa5ef2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/069 +1 -1
index e661598..c41312a 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/070 +1 -1
index ea0dae7..ef1b28f 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/071 +1 -1
index 3924e51..a6fd2a2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/072 +1 -1
index 58faa8b..61ad7f4 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/073 +1 -1
index 392db54..d8b61a6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/075 +1 -1
index 40032c5..c835a02 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/076 +1 -1
index b614a7d..3950e5a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/077 +1 -1
index 4dd1bdd..d6e5dcb 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/078 +1 -1
index d4d6da7..88cc7d4 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/079 +1 -1
index 2142bbb..df546ed 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/080 +1 -1
index 6b3a3e7..d470d8a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/081 +1 -1
index 7ae4be2..5f688a3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/082 +1 -1
index f6eb75f..eeab7f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/083 +1 -1
index 991a9d9..4d81160 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/084 +1 -1
index ae33c2c..bbd06b1 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/086 +1 -1
index d9a80cf..763fc67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/087 +1 -1
index 82c56b1..b5e8d7c 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/088 +1 -1
index c09adf8..5b05f3e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/089 +1 -1
index dffc977..0e2dd91 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/090 +1 -1
index 8d032f8..2cffc46 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/092 +1 -1
index a8c0c9c..7f55083 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/check +6 -3
index 8ca4011..8e1061e 100755
@@ -19,7 +19,6 @@
 # Control script for QA
 #
 
-tmp=/tmp/$$
 status=0
 needwrap=true
 try=0
@@ -121,6 +120,10 @@ then
     _init_error "failed to source common.rc"
 fi
 
+# Temporary directory to store test results, will be removed by _wrapup
+QEMU_IOTESTS_TMPDIR=$(mktemp -d --tmpdir qemu-iotests.XXXXXXXX)
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
+
 # we need common
 . "$source_iotests/common"
 
@@ -197,9 +200,8 @@ END        { if (NR > 0) {
         needwrap=false
     fi
 
-    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
     rm -f /tmp/check.pid /tmp/check.sts
-    rm -f $tmp.*
+    rm -rf "$QEMU_IOTESTS_TMPDIR"
 }
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
@@ -349,6 +351,7 @@ do
                 fi
             fi
         fi
+        rm -f "$tmp.out"
 
     fi
 
tests/qemu-iotests/common.rc +4 -3
index 9c49deb..51762c2 100644
@@ -72,11 +72,12 @@ fi
 
 function valgrind_qemu_io()
 {
-    valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
+    local vgtmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$.valgrind
+    valgrind --log-file="$vgtmp" --error-exitcode=99 $REAL_QEMU_IO "$@"
     if [ $? != 0 ]; then
-        cat /tmp/$$.valgrind
+        cat "$vgtmp"
     fi
-    rm -f /tmp/$$.valgrind
+    rm -f "$vgtmp"
 }
 
 
#3 lore raw
Quoted 28 lines · Peter Wu
Quoted 27 lines · On Friday 22 August 2014 20:58:34 Benoît Canet wrote:
Quoted 15 lines · Peter Wu

Before this patch you could not run multiple tests concurrently as they might clobber each other test files. This patch solves that by using random temporary directory instead of /tmp (for writing output in the individual tests and valgrind logs).

Furthermore, this patch stops removing everything in /tmp/ matching a certain pattern (/tmp/*.{err,out,time}). These might not be a property of QEMU.

Running multiple concurrent tests in the same object directory is still not supported though as the scratch directory and .bad and .notrun files still interfere with each other. Also not touched is the situation that /tmp/check.log and /tmp/check.sts are hard-coded (and thus unusable in concurrent tests).

Quoted 6 lines

---
Hi,

This patch introduces a dependency on mktemp of coreutils. I could still not get concurrent tests to work fully reliably (test 030 failed randomly with QED):

Do we care about the BSDs ?

See the link in the anwser of: http://stackoverflow.com/questions/2792675/how-portable-is-mktemp1

Quoted 8 lines
Quoted 1 line

--tmpdir seems to be a GNUism.

And -t differs between FreeBSD and others too. There is probably nobody who cares about locations other than /tmp, so what about:

    QEMU_IOTESTS_TMPDIR=$(mktemp -d /tmp/qemu-iotests.XXXXXXXX)

What do you think of the idea of the patch in general?

I think it could be usefull for continuous integration setup.

Best regards

Benoît

Quoted 1,195 lines

Kind regards,
Peter
https://lekensteyn.nl

Quoted 1,189 lines
Quoted 1,189 lines

FAIL: test_ignore (__main__.TestEIO)
----------------------------------------------------------------------
Traceback (most recent call last):
File "030", line 223, in test_ignore
self.assert_qmp(result, 'return[0]/paused', False)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 233, in assert_qmp
result = self.dictpath(d, path)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 221, in dictpath
self.fail('invalid index "%s" in path "%s" in "%s"' % (idx, path, str(d)))
AssertionError: invalid index "0" in path "return[0]/paused" in "[]"

I still think that the patches are valuable though, it reduces predictable file names.

Kind regards,
Peter

---
 tests/qemu-iotests/001       | 2 +-
 tests/qemu-iotests/002       | 2 +-
 tests/qemu-iotests/003       | 2 +-
 tests/qemu-iotests/004       | 2 +-
 tests/qemu-iotests/005       | 2 +-
 tests/qemu-iotests/006       | 2 +-
 tests/qemu-iotests/007       | 2 +-
 tests/qemu-iotests/008       | 2 +-
 tests/qemu-iotests/009       | 2 +-
 tests/qemu-iotests/010       | 2 +-
 tests/qemu-iotests/011       | 2 +-
 tests/qemu-iotests/012       | 2 +-
 tests/qemu-iotests/013       | 2 +-
 tests/qemu-iotests/014       | 2 +-
 tests/qemu-iotests/015       | 2 +-
 tests/qemu-iotests/016       | 2 +-
 tests/qemu-iotests/017       | 2 +-
 tests/qemu-iotests/018       | 2 +-
 tests/qemu-iotests/019       | 2 +-
 tests/qemu-iotests/020       | 2 +-
 tests/qemu-iotests/021       | 2 +-
 tests/qemu-iotests/022       | 2 +-
 tests/qemu-iotests/023       | 2 +-
 tests/qemu-iotests/024       | 2 +-
 tests/qemu-iotests/025       | 2 +-
 tests/qemu-iotests/026       | 2 +-
 tests/qemu-iotests/027       | 2 +-
 tests/qemu-iotests/028       | 2 +-
 tests/qemu-iotests/029       | 2 +-
 tests/qemu-iotests/031       | 2 +-
 tests/qemu-iotests/032       | 2 +-
 tests/qemu-iotests/033       | 2 +-
 tests/qemu-iotests/034       | 2 +-
 tests/qemu-iotests/035       | 2 +-
 tests/qemu-iotests/036       | 2 +-
 tests/qemu-iotests/037       | 2 +-
 tests/qemu-iotests/038       | 2 +-
 tests/qemu-iotests/039       | 2 +-
 tests/qemu-iotests/042       | 2 +-
 tests/qemu-iotests/043       | 2 +-
 tests/qemu-iotests/046       | 2 +-
 tests/qemu-iotests/047       | 2 +-
 tests/qemu-iotests/049       | 2 +-
 tests/qemu-iotests/050       | 2 +-
 tests/qemu-iotests/051       | 2 +-
 tests/qemu-iotests/052       | 2 +-
 tests/qemu-iotests/053       | 2 +-
 tests/qemu-iotests/054       | 2 +-
 tests/qemu-iotests/058       | 2 +-
 tests/qemu-iotests/059       | 2 +-
 tests/qemu-iotests/060       | 2 +-
 tests/qemu-iotests/061       | 2 +-
 tests/qemu-iotests/062       | 2 +-
 tests/qemu-iotests/063       | 2 +-
 tests/qemu-iotests/064       | 2 +-
 tests/qemu-iotests/066       | 2 +-
 tests/qemu-iotests/067       | 2 +-
 tests/qemu-iotests/068       | 2 +-
 tests/qemu-iotests/069       | 2 +-
 tests/qemu-iotests/070       | 2 +-
 tests/qemu-iotests/071       | 2 +-
 tests/qemu-iotests/072       | 2 +-
 tests/qemu-iotests/073       | 2 +-
 tests/qemu-iotests/075       | 2 +-
 tests/qemu-iotests/076       | 2 +-
 tests/qemu-iotests/077       | 2 +-
 tests/qemu-iotests/078       | 2 +-
 tests/qemu-iotests/079       | 2 +-
 tests/qemu-iotests/080       | 2 +-
 tests/qemu-iotests/081       | 2 +-
 tests/qemu-iotests/082       | 2 +-
 tests/qemu-iotests/083       | 2 +-
 tests/qemu-iotests/084       | 2 +-
 tests/qemu-iotests/086       | 2 +-
 tests/qemu-iotests/087       | 2 +-
 tests/qemu-iotests/088       | 2 +-
 tests/qemu-iotests/089       | 2 +-
 tests/qemu-iotests/090       | 2 +-
 tests/qemu-iotests/092       | 2 +-
 tests/qemu-iotests/check     | 9 ++++++---
 tests/qemu-iotests/common.rc | 7 ++++---
 81 files changed, 89 insertions(+), 85 deletions(-)
tests/qemu-iotests/001 +1 -1
index 4e16469..6472c67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/002 +1 -1
index 6a865aa..112280a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/003 +1 -1
index 98638d4..f60b6d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/004 +1 -1
index 651072e..d878351 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/005 +1 -1
index ba1236d..e18d1c5 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/006 +1 -1
index 0c0cf5d..84589b7 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/007 +1 -1
index fe1a743..bbbe0fc 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/008 +1 -1
index 2d28efd..c0e6774 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/009 +1 -1
index 57a43f5..2cf52f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/010 +1 -1
index 896a005..e9c32e1 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/011 +1 -1
index 1c5158a..da7fc70 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/012 +1 -1
index 7c5b689..d1d59b1 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/013 +1 -1
index ea3cab9..6943933 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/014 +1 -1
index b23c2db..2398864 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/015 +1 -1
index 099d757..ea96464 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/016 +1 -1
index 7ea9e94..f1864b7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/017 +1 -1
index 3af3cdf..4f46bb7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/018 +1 -1
index d8a7d43..8da2304 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/019 +1 -1
index f5ecbf5..537912f 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/020 +1 -1
index 2f258dc..e190043 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/021 +1 -1
index 1c69024..66089d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/022 +1 -1
index d35b816..df6c537 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/023 +1 -1
index 9ad06b9..76692ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/024 +1 -1
index 9bf99e1..b75dcf2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/025 +1 -1
index a5f45b4..528d822 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/026 +1 -1
index df2884b..8be5d42 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/027 +1 -1
index 3fa81b8..5feba32 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/028 +1 -1
index a1f4423..ee1272d 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/029 +1 -1
index fa46ace..2de8ec5 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/031 +1 -1
index 2a77ba8..4ce2be3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/032 +1 -1
index b1ba5c3..60523b8 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/033 +1 -1
index ea3351c..00ee111 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/034 +1 -1
index 69c7858..539d0c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/035 +1 -1
index ebe9b8c..6778c70 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/036 +1 -1
index 392f1ef..65c6b66 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/037 +1 -1
index 9171d8c..aa5f8f3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/038 +1 -1
index cfaf00a..817ea4e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/039 +1 -1
index 84c9167..d34968b 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/042 +1 -1
index 94ce3a9..674e529 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/043 +1 -1
index b316b97..dcceaf6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/046 +1 -1
index e0be46c..740ed48 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/047 +1 -1
index c35cd09..6bc0b78 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/049 +1 -1
index 93aa0ea..e8880a9 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/050 +1 -1
index 07802bc..5ed97cf 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/051 +1 -1
index a41334e..3d67f90 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/052 +1 -1
index 6bdae92..b849f1b 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/053 +1 -1
index e589e5f..9fb1e93 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/054 +1 -1
index bd94153..316b8a2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/058 +1 -1
index 14584cd..5602bff 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
tests/qemu-iotests/059 +1 -1
index 3c053c2..82d94d3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/060 +1 -1
index 830386f..b79578f 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/061 +1 -1
index ab98def..49c08ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/062 +1 -1
index 0511246..06bcfe5 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/063 +1 -1
index a47493a..43d37d6 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/064 +1 -1
index 1c74c31..be791c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/066 +1 -1
index 1c2452b..e079845 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/067 +1 -1
index d025192..d3ac7d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/068 +1 -1
index b72e555..9fa5ef2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/069 +1 -1
index e661598..c41312a 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/070 +1 -1
index ea0dae7..ef1b28f 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/071 +1 -1
index 3924e51..a6fd2a2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/072 +1 -1
index 58faa8b..61ad7f4 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/073 +1 -1
index 392db54..d8b61a6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/075 +1 -1
index 40032c5..c835a02 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/076 +1 -1
index b614a7d..3950e5a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/077 +1 -1
index 4dd1bdd..d6e5dcb 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/078 +1 -1
index d4d6da7..88cc7d4 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/079 +1 -1
index 2142bbb..df546ed 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/080 +1 -1
index 6b3a3e7..d470d8a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/081 +1 -1
index 7ae4be2..5f688a3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/082 +1 -1
index f6eb75f..eeab7f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/083 +1 -1
index 991a9d9..4d81160 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/084 +1 -1
index ae33c2c..bbd06b1 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/086 +1 -1
index d9a80cf..763fc67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/087 +1 -1
index 82c56b1..b5e8d7c 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/088 +1 -1
index c09adf8..5b05f3e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/089 +1 -1
index dffc977..0e2dd91 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/090 +1 -1
index 8d032f8..2cffc46 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/092 +1 -1
index a8c0c9c..7f55083 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/check +6 -3
index 8ca4011..8e1061e 100755
@@ -19,7 +19,6 @@
 # Control script for QA
 #
 
-tmp=/tmp/$$
 status=0
 needwrap=true
 try=0
@@ -121,6 +120,10 @@ then
     _init_error "failed to source common.rc"
 fi
 
+# Temporary directory to store test results, will be removed by _wrapup
+QEMU_IOTESTS_TMPDIR=$(mktemp -d --tmpdir qemu-iotests.XXXXXXXX)
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
+
 # we need common
 . "$source_iotests/common"
 
@@ -197,9 +200,8 @@ END        { if (NR > 0) {
         needwrap=false
     fi
 
-    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
     rm -f /tmp/check.pid /tmp/check.sts
-    rm -f $tmp.*
+    rm -rf "$QEMU_IOTESTS_TMPDIR"
 }
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
@@ -349,6 +351,7 @@ do
                 fi
             fi
         fi
+        rm -f "$tmp.out"
 
     fi
 
tests/qemu-iotests/common.rc +4 -3
index 9c49deb..51762c2 100644
@@ -72,11 +72,12 @@ fi
 
 function valgrind_qemu_io()
 {
-    valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
+    local vgtmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$.valgrind
+    valgrind --log-file="$vgtmp" --error-exitcode=99 $REAL_QEMU_IO "$@"
     if [ $? != 0 ]; then
-        cat /tmp/$$.valgrind
+        cat "$vgtmp"
     fi
-    rm -f /tmp/$$.valgrind
+    rm -f "$vgtmp"
 }
 
 
#4 lore raw
In reply to Peter Wu
Quoted 127 lines · Peter Wu

Before this patch you could not run multiple tests concurrently as they might clobber each other test files. This patch solves that by using random temporary directory instead of /tmp (for writing output in the individual tests and valgrind logs).

Furthermore, this patch stops removing everything in /tmp/ matching a certain pattern (/tmp/*.{err,out,time}). These might not be a property of QEMU.

Running multiple concurrent tests in the same object directory is still not supported though as the scratch directory and .bad and .notrun files still interfere with each other. Also not touched is the situation that /tmp/check.log and /tmp/check.sts are hard-coded (and thus unusable in concurrent tests).

---
Hi,

This patch introduces a dependency on mktemp of coreutils. I could still not get concurrent tests to work fully reliably (test 030 failed randomly with QED):

FAIL: test_ignore (__main__.TestEIO)
----------------------------------------------------------------------
Traceback (most recent call last):
File "030", line 223, in test_ignore
self.assert_qmp(result, 'return[0]/paused', False)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 233, in assert_qmp
result = self.dictpath(d, path)
File "/tmp/qemu/tests/qemu-iotests/iotests.py", line 221, in dictpath
self.fail('invalid index "%s" in path "%s" in "%s"' % (idx, path, str(d)))
AssertionError: invalid index "0" in path "return[0]/paused" in "[]"

I still think that the patches are valuable though, it reduces predictable file names.

Kind regards,
Peter

---
 tests/qemu-iotests/001       | 2 +-
 tests/qemu-iotests/002       | 2 +-
 tests/qemu-iotests/003       | 2 +-
 tests/qemu-iotests/004       | 2 +-
 tests/qemu-iotests/005       | 2 +-
 tests/qemu-iotests/006       | 2 +-
 tests/qemu-iotests/007       | 2 +-
 tests/qemu-iotests/008       | 2 +-
 tests/qemu-iotests/009       | 2 +-
 tests/qemu-iotests/010       | 2 +-
 tests/qemu-iotests/011       | 2 +-
 tests/qemu-iotests/012       | 2 +-
 tests/qemu-iotests/013       | 2 +-
 tests/qemu-iotests/014       | 2 +-
 tests/qemu-iotests/015       | 2 +-
 tests/qemu-iotests/016       | 2 +-
 tests/qemu-iotests/017       | 2 +-
 tests/qemu-iotests/018       | 2 +-
 tests/qemu-iotests/019       | 2 +-
 tests/qemu-iotests/020       | 2 +-
 tests/qemu-iotests/021       | 2 +-
 tests/qemu-iotests/022       | 2 +-
 tests/qemu-iotests/023       | 2 +-
 tests/qemu-iotests/024       | 2 +-
 tests/qemu-iotests/025       | 2 +-
 tests/qemu-iotests/026       | 2 +-
 tests/qemu-iotests/027       | 2 +-
 tests/qemu-iotests/028       | 2 +-
 tests/qemu-iotests/029       | 2 +-
 tests/qemu-iotests/031       | 2 +-
 tests/qemu-iotests/032       | 2 +-
 tests/qemu-iotests/033       | 2 +-
 tests/qemu-iotests/034       | 2 +-
 tests/qemu-iotests/035       | 2 +-
 tests/qemu-iotests/036       | 2 +-
 tests/qemu-iotests/037       | 2 +-
 tests/qemu-iotests/038       | 2 +-
 tests/qemu-iotests/039       | 2 +-
 tests/qemu-iotests/042       | 2 +-
 tests/qemu-iotests/043       | 2 +-
 tests/qemu-iotests/046       | 2 +-
 tests/qemu-iotests/047       | 2 +-
 tests/qemu-iotests/049       | 2 +-
 tests/qemu-iotests/050       | 2 +-
 tests/qemu-iotests/051       | 2 +-
 tests/qemu-iotests/052       | 2 +-
 tests/qemu-iotests/053       | 2 +-
 tests/qemu-iotests/054       | 2 +-
 tests/qemu-iotests/058       | 2 +-
 tests/qemu-iotests/059       | 2 +-
 tests/qemu-iotests/060       | 2 +-
 tests/qemu-iotests/061       | 2 +-
 tests/qemu-iotests/062       | 2 +-
 tests/qemu-iotests/063       | 2 +-
 tests/qemu-iotests/064       | 2 +-
 tests/qemu-iotests/066       | 2 +-
 tests/qemu-iotests/067       | 2 +-
 tests/qemu-iotests/068       | 2 +-
 tests/qemu-iotests/069       | 2 +-
 tests/qemu-iotests/070       | 2 +-
 tests/qemu-iotests/071       | 2 +-
 tests/qemu-iotests/072       | 2 +-
 tests/qemu-iotests/073       | 2 +-
 tests/qemu-iotests/075       | 2 +-
 tests/qemu-iotests/076       | 2 +-
 tests/qemu-iotests/077       | 2 +-
 tests/qemu-iotests/078       | 2 +-
 tests/qemu-iotests/079       | 2 +-
 tests/qemu-iotests/080       | 2 +-
 tests/qemu-iotests/081       | 2 +-
 tests/qemu-iotests/082       | 2 +-
 tests/qemu-iotests/083       | 2 +-
 tests/qemu-iotests/084       | 2 +-
 tests/qemu-iotests/086       | 2 +-
 tests/qemu-iotests/087       | 2 +-
 tests/qemu-iotests/088       | 2 +-
 tests/qemu-iotests/089       | 2 +-
 tests/qemu-iotests/090       | 2 +-
 tests/qemu-iotests/092       | 2 +-
 tests/qemu-iotests/check     | 9 ++++++---
 tests/qemu-iotests/common.rc | 7 ++++---
 81 files changed, 89 insertions(+), 85 deletions(-)
tests/qemu-iotests/001 +0 -0
index 4e16469..6472c67 100755

tests/qemu-iotests/001 seq=`basename $0` · line 28

Quoted 5 lines
tests/qemu-iotests/001 +1 -1
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$

Maybe we could simply drop this repetition and set tmp from check or common.rc?

Fam

Quoted 1,083 lines
tests/qemu-iotests/001 +0 -0
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/002 +1 -1
index 6a865aa..112280a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/003 +1 -1
index 98638d4..f60b6d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/004 +1 -1
index 651072e..d878351 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/005 +1 -1
index ba1236d..e18d1c5 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/006 +1 -1
index 0c0cf5d..84589b7 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/007 +1 -1
index fe1a743..bbbe0fc 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/008 +1 -1
index 2d28efd..c0e6774 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/009 +1 -1
index 57a43f5..2cf52f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/010 +1 -1
index 896a005..e9c32e1 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/011 +1 -1
index 1c5158a..da7fc70 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/012 +1 -1
index 7c5b689..d1d59b1 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/013 +1 -1
index ea3cab9..6943933 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/014 +1 -1
index b23c2db..2398864 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/015 +1 -1
index 099d757..ea96464 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/016 +1 -1
index 7ea9e94..f1864b7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/017 +1 -1
index 3af3cdf..4f46bb7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/018 +1 -1
index d8a7d43..8da2304 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/019 +1 -1
index f5ecbf5..537912f 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/020 +1 -1
index 2f258dc..e190043 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/021 +1 -1
index 1c69024..66089d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/022 +1 -1
index d35b816..df6c537 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/023 +1 -1
index 9ad06b9..76692ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/024 +1 -1
index 9bf99e1..b75dcf2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/025 +1 -1
index a5f45b4..528d822 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/026 +1 -1
index df2884b..8be5d42 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/027 +1 -1
index 3fa81b8..5feba32 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/028 +1 -1
index a1f4423..ee1272d 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/029 +1 -1
index fa46ace..2de8ec5 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/031 +1 -1
index 2a77ba8..4ce2be3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/032 +1 -1
index b1ba5c3..60523b8 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/033 +1 -1
index ea3351c..00ee111 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/034 +1 -1
index 69c7858..539d0c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/035 +1 -1
index ebe9b8c..6778c70 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/036 +1 -1
index 392f1ef..65c6b66 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/037 +1 -1
index 9171d8c..aa5f8f3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/038 +1 -1
index cfaf00a..817ea4e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/039 +1 -1
index 84c9167..d34968b 100755
@@ -28,7 +28,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/042 +1 -1
index 94ce3a9..674e529 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/043 +1 -1
index b316b97..dcceaf6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/046 +1 -1
index e0be46c..740ed48 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/047 +1 -1
index c35cd09..6bc0b78 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/049 +1 -1
index 93aa0ea..e8880a9 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/050 +1 -1
index 07802bc..5ed97cf 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/051 +1 -1
index a41334e..3d67f90 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/052 +1 -1
index 6bdae92..b849f1b 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/053 +1 -1
index e589e5f..9fb1e93 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/054 +1 -1
index bd94153..316b8a2 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/058 +1 -1
index 14584cd..5602bff 100755
@@ -27,7 +27,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
tests/qemu-iotests/059 +1 -1
index 3c053c2..82d94d3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/060 +1 -1
index 830386f..b79578f 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/061 +1 -1
index ab98def..49c08ef 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/062 +1 -1
index 0511246..06bcfe5 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/063 +1 -1
index a47493a..43d37d6 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/064 +1 -1
index 1c74c31..be791c7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/066 +1 -1
index 1c2452b..e079845 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/067 +1 -1
index d025192..d3ac7d7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/068 +1 -1
index b72e555..9fa5ef2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/069 +1 -1
index e661598..c41312a 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/070 +1 -1
index ea0dae7..ef1b28f 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/071 +1 -1
index 3924e51..a6fd2a2 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/072 +1 -1
index 58faa8b..61ad7f4 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/073 +1 -1
index 392db54..d8b61a6 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/075 +1 -1
index 40032c5..c835a02 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/076 +1 -1
index b614a7d..3950e5a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/077 +1 -1
index 4dd1bdd..d6e5dcb 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/078 +1 -1
index d4d6da7..88cc7d4 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/079 +1 -1
index 2142bbb..df546ed 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/080 +1 -1
index 6b3a3e7..d470d8a 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/081 +1 -1
index 7ae4be2..5f688a3 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/082 +1 -1
index f6eb75f..eeab7f7 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/083 +1 -1
index 991a9d9..4d81160 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/084 +1 -1
index ae33c2c..bbd06b1 100755
@@ -26,7 +26,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/086 +1 -1
index d9a80cf..763fc67 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/087 +1 -1
index 82c56b1..b5e8d7c 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 # get standard environment, filters and checks
tests/qemu-iotests/088 +1 -1
index c09adf8..5b05f3e 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/089 +1 -1
index dffc977..0e2dd91 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/090 +1 -1
index 8d032f8..2cffc46 100755
@@ -25,7 +25,7 @@ seq="$(basename $0)"
 echo "QA output created by $seq"
 
 here="$PWD"
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/092 +1 -1
index a8c0c9c..7f55083 100755
@@ -25,7 +25,7 @@ seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
-tmp=/tmp/$$
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
 status=1	# failure is the default!
 
 _cleanup()
tests/qemu-iotests/check +6 -3
index 8ca4011..8e1061e 100755
@@ -19,7 +19,6 @@
 # Control script for QA
 #
 
-tmp=/tmp/$$
 status=0
 needwrap=true
 try=0
@@ -121,6 +120,10 @@ then
     _init_error "failed to source common.rc"
 fi
 
+# Temporary directory to store test results, will be removed by _wrapup
+QEMU_IOTESTS_TMPDIR=$(mktemp -d --tmpdir qemu-iotests.XXXXXXXX)
+tmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$
+
 # we need common
 . "$source_iotests/common"
 
@@ -197,9 +200,8 @@ END        { if (NR > 0) {
         needwrap=false
     fi
 
-    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
     rm -f /tmp/check.pid /tmp/check.sts
-    rm -f $tmp.*
+    rm -rf "$QEMU_IOTESTS_TMPDIR"
 }
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
@@ -349,6 +351,7 @@ do
                 fi
             fi
         fi
+        rm -f "$tmp.out"
 
     fi
 
tests/qemu-iotests/common.rc +4 -3
index 9c49deb..51762c2 100644
@@ -72,11 +72,12 @@ fi
 
 function valgrind_qemu_io()
 {
-    valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
+    local vgtmp=${QEMU_IOTESTS_TMPDIR:-/tmp}/$$.valgrind
+    valgrind --log-file="$vgtmp" --error-exitcode=99 $REAL_QEMU_IO "$@"
     if [ $? != 0 ]; then
-        cat /tmp/$$.valgrind
+        cat "$vgtmp"
     fi
-    rm -f /tmp/$$.valgrind
+    rm -f "$vgtmp"
 }
 
 
Signature · 1 line
2.1.0