diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2020-11-17 17:36:32 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-11-23 09:52:24 +0000 |
commit | 69272bec1a1934a9a133c807fe238a91ace70e0b (patch) | |
tree | 6c7d25725358f1fcd01516d87dca05ea08331847 /tests | |
parent | 8c175c63eefe4efb8614718a9cbc72d03ce4d4a2 (diff) | |
download | qemu-69272bec1a1934a9a133c807fe238a91ace70e0b.zip qemu-69272bec1a1934a9a133c807fe238a91ace70e0b.tar.gz qemu-69272bec1a1934a9a133c807fe238a91ace70e0b.tar.bz2 |
tests/avocado: clean-up socket directory after run
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/avocado_qemu/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 307020b..bf54e41 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, |