qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [PULL 3/7] tests/avocado: clean-up socket directory after run
Date: Mon, 23 Nov 2020 11:25:14 +0000	[thread overview]
Message-ID: <20201123112518.13425-4-alex.bennee@linaro.org> (raw)
In-Reply-To: <20201123112518.13425-1-alex.bennee@linaro.org>

Previously we were leaving temporary directories behind. While the
QEMUMachine does make efforts to clean up after itself the directory
belongs to the calling function. We use TemporaryDirectory to wrap
this although we explicitly clear the reference in tearDown() as it
doesn't get cleaned up otherwise.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201117173635.29101-4-alex.bennee@linaro.org>

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 307020be45..bf54e419da 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -171,8 +171,8 @@ class Test(avocado.Test):
             self.cancel("No QEMU binary defined or found in the build tree")
 
     def _new_vm(self, *args):
-        sd = tempfile.mkdtemp(prefix="avo_qemu_sock_")
-        vm = QEMUMachine(self.qemu_bin, sock_dir=sd)
+        self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
+        vm = QEMUMachine(self.qemu_bin, sock_dir=self._sd.name)
         if args:
             vm.add_args(*args)
         return vm
@@ -193,6 +193,7 @@ class Test(avocado.Test):
     def tearDown(self):
         for vm in self._vms.values():
             vm.shutdown()
+        self._sd = None
 
     def fetch_asset(self, name,
                     asset_hash=None, algorithm=None,
-- 
2.20.1



  parent reply	other threads:[~2020-11-23 11:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 11:25 [PULL for 5.2-rc3 0/7] various CI cleanups (scripts, avocado, gitlab) Alex Bennée
2020-11-23 11:25 ` [PULL 1/7] scripts/ci: clean up default args logic a little Alex Bennée
2020-11-23 11:25 ` [PULL 2/7] tests: add prefixes to the bare mkdtemp calls Alex Bennée
2020-11-23 11:25 ` Alex Bennée [this message]
2020-11-23 11:25 ` [PULL 4/7] gitlab: move remaining x86 check-tcg targets to gitlab Alex Bennée
2020-11-23 11:25 ` [PULL 5/7] tests/docker: Install liblttng-ust-dev package in Ubuntu 20.04 image Alex Bennée
2020-11-23 11:25 ` [PULL 6/7] gitlab-ci: Move trace backend tests across to gitlab Alex Bennée
2020-11-23 11:25 ` [PULL 7/7] .cirrus.yml: bump timeout period for MacOS builds Alex Bennée
2020-11-23 13:02 ` [PULL for 5.2-rc3 0/7] various CI cleanups (scripts, avocado, gitlab) Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201123112518.13425-4-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).