[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 1/6] avocado_qemu: Introduce pick_qemu_util to pick qemu utili
From: |
Lukas Straub |
Subject: |
[PATCH v4 1/6] avocado_qemu: Introduce pick_qemu_util to pick qemu utility binaries |
Date: |
Sun, 7 Feb 2021 16:55:18 +0100 |
This introduces a generic function to pick qemu utility binaries
from the build dir, system or via test parameter.
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
tests/acceptance/avocado_qemu/__init__.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tests/acceptance/avocado_qemu/__init__.py
b/tests/acceptance/avocado_qemu/__init__.py
index bf54e419da..1f8c41cee0 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -15,6 +15,7 @@ import uuid
import tempfile
import avocado
+from avocado.utils.path import find_command
#: The QEMU build root directory. It may also be the source directory
#: if building from the source dir, but it's safer to use BUILD_DIR for
@@ -146,6 +147,20 @@ def exec_command_and_wait_for_pattern(test, command,
_console_interaction(test, success_message, failure_message, command +
'\r')
class Test(avocado.Test):
+ def pick_qemu_util(self, util):
+ default = os.path.join(BUILD_DIR, util)
+ if not os.path.exists(default):
+ default = find_command(default, False)
+ if not default:
+ default = None
+
+ ret = self.params.get(util, default=default)
+
+ if ret is None:
+ self.cancel("Could not find \"%s\"" % util)
+
+ return ret
+
def _get_unique_tag_val(self, tag_name):
"""
Gets a tag value, if unique for a key
--
2.30.0
pgpHo3SHProw9.pgp
Description: OpenPGP digital signature
- [PATCH v4 0/6] colo: Introduce resource agent and test suite/CI, Lukas Straub, 2021/02/07
- [PATCH v4 1/6] avocado_qemu: Introduce pick_qemu_util to pick qemu utility binaries,
Lukas Straub <=
- [PATCH v4 2/6] boot_linux.py: Use pick_qemu_util, Lukas Straub, 2021/02/07
- [PATCH v4 3/6] colo: Introduce resource agent, Lukas Straub, 2021/02/07
- [PATCH v4 4/6] colo: Introduce high-level test suite, Lukas Straub, 2021/02/07
- [PATCH v4 5/6] configure,Makefile: Install colo resource-agent, Lukas Straub, 2021/02/07
- [PATCH v4 6/6] MAINTAINERS: Add myself as maintainer for COLO resource agent, Lukas Straub, 2021/02/07