Skip to contentSkip to conversation

iotests: give tempdir an identifying name

PATCH Applied Daniel P. Berrangé 3 participants 3 messages Feb 5, 2024 – Feb 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests: give tempdir an identifying name

If something goes wrong causing the iotests not to cleanup their temporary directory, it is useful if the dir had an identifying name to show what is to blame.

---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testenv.py +1 -1
index 3ff38f2661..588f30a4f1 100644
@@ -126,7 +126,7 @@ def init_directories(self) -> None:
             self.tmp_sock_dir = False
             Path(self.sock_dir).mkdir(parents=True, exist_ok=True)
         except KeyError:
-            self.sock_dir = tempfile.mkdtemp()
+            self.sock_dir = tempfile.mkdtemp(prefix="qemu-iotests-")
             self.tmp_sock_dir = True
 
         self.sample_img_dir = os.getenv('SAMPLE_IMG_DIR',
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Daniel P. Berrangé

If something goes wrong causing the iotests not to cleanup their temporary directory, it is useful if the dir had an identifying name to show what is to blame.

Thank you again for the quick good work!

/mjt

Quoted 16 lines
  tests/qemu-iotests/testenv.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testenv.py +1 -1
index 3ff38f2661..588f30a4f1 100644
@@ -126,7 +126,7 @@ def init_directories(self) -> None:
              self.tmp_sock_dir = False
              Path(self.sock_dir).mkdir(parents=True, exist_ok=True)
          except KeyError:
-            self.sock_dir = tempfile.mkdtemp()
+            self.sock_dir = tempfile.mkdtemp(prefix="qemu-iotests-")
              self.tmp_sock_dir = True
 
          self.sample_img_dir = os.getenv('SAMPLE_IMG_DIR',