From: Kautuk Consul <kconsul@linux.vnet.ibm.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>
Cc: qemu-devel@nongnu.org, Kautuk Consul <kconsul@linux.vnet.ibm.com>
Subject: [PATCH v3 1/2] avocado_qemu/__init__.py: factor out the qemu-img finding
Date: Thu, 20 Apr 2023 07:52:16 -0500 [thread overview]
Message-ID: <20230420125217.620928-2-kconsul@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230420125217.620928-1-kconsul@linux.vnet.ibm.com>
Factor out the code that finds the qemu-img binary in the
QemuSystemTest class and create a new get_qemu_img() function
with it. This function will get called also from the new code
in tuxrun_baselines.py avocado test-case.
Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
---
tests/avocado/avocado_qemu/__init__.py | 27 +++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index cb71f50db9..d8f390e27a 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -330,6 +330,19 @@ def _new_vm(self, name, *args):
vm.add_args(*args)
return vm
+ def get_qemu_img(self):
+ self.log.debug('Looking for and selecting a qemu-img binary')
+
+ # If qemu-img has been built, use it, otherwise the system wide one
+ # will be used.
+ qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
+ if not os.path.exists(qemu_img):
+ qemu_img = find_command('qemu-img', False)
+ if qemu_img is False:
+ self.cancel('Could not find "qemu-img"')
+
+ return qemu_img
+
@property
def vm(self):
return self.get_vm(name='default')
@@ -594,17 +607,9 @@ def set_up_existing_ssh_keys(self):
return (ssh_public_key, ssh_private_key)
def download_boot(self):
- self.log.debug('Looking for and selecting a qemu-img binary to be '
- 'used to create the bootable snapshot image')
- # If qemu-img has been built, use it, otherwise the system wide one
- # will be used. If none is available, the test will cancel.
- qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
- if not os.path.exists(qemu_img):
- qemu_img = find_command('qemu-img', False)
- if qemu_img is False:
- self.cancel('Could not find "qemu-img", which is required to '
- 'create the bootable image')
- vmimage.QEMU_IMG = qemu_img
+ # Set the qemu-img binary.
+ # If none is available, the test will cancel.
+ vmimage.QEMU_IMG = super().get_qemu_img()
self.log.info('Downloading/preparing boot image')
# Fedora 31 only provides ppc64le images
--
2.25.1
next prev parent reply other threads:[~2023-04-20 12:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 12:52 [PATCH v3 0/2] Improve avocado code coverage for ppc64 Kautuk Consul
2023-04-20 12:52 ` Kautuk Consul [this message]
2023-04-20 12:52 ` [PATCH v3 2/2] tests/avocado/tuxrun_baselines.py: improve " Kautuk Consul
2023-04-20 13:50 ` Harsh Prateek Bora
2023-04-21 3:42 ` Kautuk Consul
2023-04-21 3:53 ` Harsh Prateek Bora
2023-04-21 4:27 ` Kautuk Consul
2023-04-20 14:09 ` Philippe Mathieu-Daudé
2023-04-20 15:01 ` [PATCH v3 0/2] Improve avocado " Alex Bennée
2023-04-21 4:06 ` Kautuk Consul
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=20230420125217.620928-2-kconsul@linux.vnet.ibm.com \
--to=kconsul@linux.vnet.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--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).