The first step to debug a thing is to know what created the thing in
the first place. Add some prefixes so random tmpdir's have something
grep in the code.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v2
- fix long lines
---
python/qemu/machine.py | 3 ++-
tests/acceptance/avocado_qemu/__init__.py | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 6420f01bed..64d966aeeb 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -303,7 +303,8 @@ class QEMUMachine:
return args
def _pre_launch(self) -> None:
- self._temp_dir = tempfile.mkdtemp(dir=self._test_dir)
+ self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
+ dir=self._test_dir)
self._qemu_log_path = os.path.join(self._temp_dir, self._name + ".log")
self._qemu_log_file = open(self._qemu_log_path, 'wb')
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 4cda037187..3033b2cabe 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -171,7 +171,8 @@ class Test(avocado.Test):
self.cancel("No QEMU binary defined or found in the build tree")
def _new_vm(self, *args):
- vm = QEMUMachine(self.qemu_bin, sock_dir=tempfile.mkdtemp())
+ sd = tempfile.mkdtemp(prefix="avocado_qemu_sock_")
+ vm = QEMUMachine(self.qemu_bin, sock_dir=sd)
if args:
vm.add_args(*args)
return vm
--
2.20.1
On 11/17/20 6:36 PM, Alex Bennée wrote: > The first step to debug a thing is to know what created the thing in > the first place. Add some prefixes so random tmpdir's have something > grep in the code. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > > --- > v2 > - fix long lines > --- > python/qemu/machine.py | 3 ++- > tests/acceptance/avocado_qemu/__init__.py | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
On 17/11/2020 18.36, Alex Bennée wrote:
> The first step to debug a thing is to know what created the thing in
> the first place. Add some prefixes so random tmpdir's have something
> grep in the code.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> ---
> v2
> - fix long lines
> ---
> python/qemu/machine.py | 3 ++-
> tests/acceptance/avocado_qemu/__init__.py | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 6420f01bed..64d966aeeb 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -303,7 +303,8 @@ class QEMUMachine:
> return args
>
> def _pre_launch(self) -> None:
> - self._temp_dir = tempfile.mkdtemp(dir=self._test_dir)
> + self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
> + dir=self._test_dir)
> self._qemu_log_path = os.path.join(self._temp_dir, self._name + ".log")
> self._qemu_log_file = open(self._qemu_log_path, 'wb')
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index 4cda037187..3033b2cabe 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -171,7 +171,8 @@ class Test(avocado.Test):
> self.cancel("No QEMU binary defined or found in the build tree")
>
> def _new_vm(self, *args):
> - vm = QEMUMachine(self.qemu_bin, sock_dir=tempfile.mkdtemp())
> + sd = tempfile.mkdtemp(prefix="avocado_qemu_sock_")
> + vm = QEMUMachine(self.qemu_bin, sock_dir=sd)
> if args:
> vm.add_args(*args)
> return vm
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
On 11/17/20 2:36 PM, Alex Bennée wrote:
> The first step to debug a thing is to know what created the thing in
> the first place. Add some prefixes so random tmpdir's have something
> grep in the code.
Yeah, it indeed helps.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> ---
> v2
> - fix long lines
> ---
> python/qemu/machine.py | 3 ++-
> tests/acceptance/avocado_qemu/__init__.py | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 6420f01bed..64d966aeeb 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -303,7 +303,8 @@ class QEMUMachine:
> return args
>
> def _pre_launch(self) -> None:
> - self._temp_dir = tempfile.mkdtemp(dir=self._test_dir)
> + self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
> + dir=self._test_dir)
> self._qemu_log_path = os.path.join(self._temp_dir, self._name + ".log")
> self._qemu_log_file = open(self._qemu_log_path, 'wb')
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index 4cda037187..3033b2cabe 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -171,7 +171,8 @@ class Test(avocado.Test):
> self.cancel("No QEMU binary defined or found in the build tree")
>
> def _new_vm(self, *args):
> - vm = QEMUMachine(self.qemu_bin, sock_dir=tempfile.mkdtemp())
> + sd = tempfile.mkdtemp(prefix="avocado_qemu_sock_")
> + vm = QEMUMachine(self.qemu_bin, sock_dir=sd)
> if args:
> vm.add_args(*args)
> return vm
© 2016 - 2025 Red Hat, Inc.