All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Willian Rampazzo" <willianr@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: Re: [PATCH v3 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic
Date: Wed, 17 Mar 2021 10:32:33 -0300	[thread overview]
Message-ID: <1bb15b0e-44d2-d761-e2d2-8ae5e906f2cd@redhat.com> (raw)
In-Reply-To: <20210315230838.2973103-3-f4bug@amsat.org>

Hi,

On 3/15/21 8:08 PM, Philippe Mathieu-Daudé wrote:
> Make pick_default_qemu_bin() generic to find qemu-system or
> qemu-user binaries.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   tests/acceptance/avocado_qemu/__init__.py | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index 4f814047176..08b3fa1124f 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -48,7 +48,7 @@ def is_readable_executable_file(path):
>       return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
>   
>   
> -def pick_default_qemu_bin(arch=None):
> +def pick_default_qemu_bin(bin_fmt, arch=None):
I suggest that bin_fmt defaults to "qemu-system-%" (or "qemu-system-", 
see below) so that you don't need to change the existing callers.
>       """
>       Picks the path of a QEMU binary, starting either in the current working
>       directory or in the source tree root directory.
> @@ -67,7 +67,7 @@ def pick_default_qemu_bin(arch=None):
>       # qemu binary path does not match arch for powerpc, handle it
>       if 'ppc64le' in arch:
>           arch = 'ppc64'
> -    qemu_bin_relative_path = "./qemu-system-%s" % arch
> +    qemu_bin_relative_path = os.path.join(".", bin_fmt % arch)

Above construct fails (unless I missed something):

   >>> bin_fmt="qemu-system-%"

   >>> arch="aarch64"
   >>> qemu_bin_relative_path = os.path.join(".", bin_fmt % arch)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   ValueError: incomplete format

Instead it could be "bin_prefix" where the value is either 
"qemu-system-" or "qemu-", then "arch" is just appended.

>       if is_readable_executable_file(qemu_bin_relative_path):
>           return qemu_bin_relative_path
>   
> @@ -187,14 +187,14 @@ def require_accelerator(self, accelerator):
>               self.cancel("%s accelerator does not seem to be "
>                           "available" % accelerator)
>   
> -    def setUp(self):
> +    def setUp(self, bin_fmt):
>           self.arch = self.params.get('arch',
>                                       default=self._get_unique_tag_val('arch'))
>   
>           self.machine = self.params.get('machine',
>                                          default=self._get_unique_tag_val('machine'))
>   
> -        default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
> +        default_qemu_bin = pick_default_qemu_bin(bin_fmt, arch=self.arch)
>           self.qemu_bin = self.params.get('qemu_bin',
>                                           default=default_qemu_bin)
>           if self.qemu_bin is None:
> @@ -217,7 +217,7 @@ def fetch_asset(self, name,
>   class Test(QemuBaseTest):
>       def setUp(self):
>           self._vms = {}
> -        super(Test, self).setUp()
> +        super(Test, self).setUp("qemu-system-%s")
>   
>       def _new_vm(self, *args):
>           self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")



  reply	other threads:[~2021-03-17 13:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 23:08 [PATCH v3 0/5] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-03-15 23:08 ` [PATCH v3 1/5] tests/acceptance: Extract QemuBaseTest from Test Philippe Mathieu-Daudé
2021-03-17 13:08   ` Wainer dos Santos Moschetta
2021-03-17 13:26     ` Philippe Mathieu-Daudé
2021-03-17 13:44       ` Wainer dos Santos Moschetta
2021-03-17 14:18         ` Philippe Mathieu-Daudé
2021-03-15 23:08 ` [PATCH v3 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic Philippe Mathieu-Daudé
2021-03-17 13:32   ` Wainer dos Santos Moschetta [this message]
2021-03-15 23:08 ` [PATCH v3 3/5] tests/acceptance: Introduce QemuUserTest base class Philippe Mathieu-Daudé
2021-03-17 14:14   ` Wainer dos Santos Moschetta
2021-03-15 23:08 ` [PATCH v3 4/5] tests/acceptance: Share useful helpers from virtiofs_submounts test Philippe Mathieu-Daudé
2021-03-17 14:52   ` Wainer dos Santos Moschetta
2021-03-15 23:08 ` [PATCH v3 5/5] tests/acceptance: Add bFLT loader linux-user test 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=1bb15b0e-44d2-d761-e2d2-8ae5e906f2cd@redhat.com \
    --to=wainersm@redhat.com \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=willianr@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.