qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Alberto Garcia" <berto@igalia.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Zhang Chen" <chen.zhang@intel.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH v3 2/7] avocado_qemu: Introduce pick_qemu_util to pick qemu utility binaries
Date: Tue, 4 Aug 2020 12:46:48 +0200	[thread overview]
Message-ID: <a61e4eebe323ddfdd7e0a0ee7c52461f2e6a97ab.1596536719.git.lukasstraub2@web.de> (raw)
In-Reply-To: <cover.1596536719.git.lukasstraub2@web.de>

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

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 77d1c1d9ff..fbc47ccb3d 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
@@ -147,6 +148,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.20.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2020-08-04 10:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 10:46 [PATCH v3 0/7] colo: Introduce resource agent and test suite/CI Lukas Straub
2020-08-04 10:46 ` [PATCH v3 1/7] block/quorum.c: stable children names Lukas Straub
2020-09-02 12:22   ` Max Reitz
2020-08-04 10:46 ` Lukas Straub [this message]
2020-08-04 10:46 ` [PATCH v3 3/7] boot_linux.py: Use pick_qemu_util Lukas Straub
2020-08-04 10:46 ` [PATCH v3 4/7] colo: Introduce resource agent Lukas Straub
2020-08-04 10:47 ` [PATCH v3 5/7] colo: Introduce high-level test suite Lukas Straub
2020-08-04 10:47 ` [PATCH v3 6/7] configure,Makefile: Install colo resource-agent Lukas Straub
2020-09-04 10:45   ` Philippe Mathieu-Daudé
2020-08-04 10:47 ` [PATCH v3 7/7] MAINTAINERS: Add myself as maintainer for COLO resource agent Lukas Straub
2020-08-18 12:27 ` [PATCH v3 0/7] colo: Introduce resource agent and test suite/CI Lukas Straub
2020-08-18 12:31   ` Philippe Mathieu-Daudé
2020-08-27  8:40   ` Lukas Straub
2020-09-04 10:42     ` Philippe Mathieu-Daudé

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=a61e4eebe323ddfdd7e0a0ee7c52461f2e6a97ab.1596536719.git.lukasstraub2@web.de \
    --to=lukasstraub2@web.de \
    --cc=berto@igalia.com \
    --cc=chen.zhang@intel.com \
    --cc=crosa@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --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).