[PATCH 13/22] tests/functional: switch over to using self.socket_dir(...)

Daniel P. Berrangé posted 22 patches 3 weeks, 5 days ago
There is a newer version of this series
[PATCH 13/22] tests/functional: switch over to using self.socket_dir(...)
Posted by Daniel P. Berrangé 3 weeks, 5 days ago
This removes direct creation of temporary dirs

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/test_arm_aspeed.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
index c4869011db..ca223ac8f0 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -9,7 +9,6 @@
 import os
 import time
 import subprocess
-import tempfile
 
 from qemu_test import (LinuxKernelTest, Asset,
                        exec_command_and_wait_for_pattern,
@@ -228,8 +227,8 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
 
         tpmstate_dir = self.scratch_file('swtpmstate')
         os.mkdir(tpmstate_dir)
-        socket_dir = tempfile.TemporaryDirectory(prefix="qemu_")
-        socket = os.path.join(tpmstate_dir.name, 'swtpm-socket')
+        socket_dir = self.socket_dir()
+        socket = os.path.join(socket_dir.name, 'swtpm-socket')
 
         # We must put the TPM state dir in /tmp/, not the build dir,
         # because some distros use AppArmor to lock down swtpm and
-- 
2.46.0


Re: [PATCH 13/22] tests/functional: switch over to using self.socket_dir(...)
Posted by Thomas Huth 3 weeks, 3 days ago
On 29/11/2024 18.31, Daniel P. Berrangé wrote:
> This removes direct creation of temporary dirs
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   tests/functional/test_arm_aspeed.py | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
> index c4869011db..ca223ac8f0 100755
> --- a/tests/functional/test_arm_aspeed.py
> +++ b/tests/functional/test_arm_aspeed.py
> @@ -9,7 +9,6 @@
>   import os
>   import time
>   import subprocess
> -import tempfile
>   
>   from qemu_test import (LinuxKernelTest, Asset,
>                          exec_command_and_wait_for_pattern,
> @@ -228,8 +227,8 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
>   
>           tpmstate_dir = self.scratch_file('swtpmstate')
>           os.mkdir(tpmstate_dir)
> -        socket_dir = tempfile.TemporaryDirectory(prefix="qemu_")
> -        socket = os.path.join(tpmstate_dir.name, 'swtpm-socket')
> +        socket_dir = self.socket_dir()
> +        socket = os.path.join(socket_dir.name, 'swtpm-socket')

Ah, here it gets fixed again! ... maybe squash this into the previous patch?

  Thomas