All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Fam Zheng <famz@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 1/6] avocado: Add a Test.arch property
Date: Fri, 27 Jul 2018 02:35:12 -0300	[thread overview]
Message-ID: <99e1a77f-31e3-916d-e3ca-02348ea92668@amsat.org> (raw)
In-Reply-To: <f8c3ed3c-8dac-d596-208a-e8f72797c784@amsat.org>

Hi Cleber,

On 06/28/2018 07:03 PM, Philippe Mathieu-Daudé wrote:
> On 06/28/2018 06:54 PM, Alex Bennée wrote:
>> Alex Bennée <alex.bennee@linaro.org> writes:
>>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>>
>>>> Tests can change this property to run tests in other
>>>> architectures than the host one.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>> ---
>>>>  tests/acceptance/avocado_qemu/__init__.py | 17 +++++++++++++----
>>>>  1 file changed, 13 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
>>>> index 1e54fd5932..6e9601f5e9 100644
>>>> --- a/tests/acceptance/avocado_qemu/__init__.py
>>>> +++ b/tests/acceptance/avocado_qemu/__init__.py
>>>> @@ -13,6 +13,7 @@ import sys
>>>>
>>>>  import avocado
>>>>
>>>> +HOST_ARCH = os.uname()[4]
>>>
>>> The python docs seem to point to platform as a more stable way of
>>> querying this stuff:
>>>
>>>   platform.machine() => 'x86_64' or 'aarch64'
>>>
>>>>  SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
>>>>  SRC_ROOT_DIR = os.path.abspath(os.path.dirname(SRC_ROOT_DIR))
>>>>  sys.path.append(os.path.join(SRC_ROOT_DIR, 'scripts'))
>>>> @@ -23,12 +24,11 @@ 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():
>>>> +def pick_default_qemu_bin(arch):
>>>>      """
>>>>      Picks the path of a QEMU binary, starting either in the current working
>>>>      directory or in the source tree root directory.
>>>>      """
>>>> -    arch = os.uname()[4]
>>>>      qemu_bin_relative_path = os.path.join("%s-softmmu" % arch,
>>>>                                            "qemu-system-%s" % arch)
>>>>      if is_readable_executable_file(qemu_bin_relative_path):
>>>> @@ -41,10 +41,19 @@ def pick_default_qemu_bin():
>>>>
>>>>
>>>>  class Test(avocado.Test):
>>>> +    _arch = HOST_ARCH
>>
>> But actually this is wrong - because the host arch may not boot machines
>> defined in the tests. I suspect each superclass needs to explicitly set
>> it's arch and we should assert it has done so here.

Do you have any suggestion on how we could clear this?

> 
> Hmm but arch-specific tests are protected by the 'arch' tag:
> 
> class BootLinuxConsoleMips(Test):
>     """
>     :avocado: enable
>     :avocado: tags=endian:big
>     :avocado: tags=arch:mips
>     :avocado: tags=board:malta
>     """
> 
> Oh no they aren't, it is just a way to filter which selection of tests
> to run :|

>>>> +
>>>> +    @property
>>>> +    def arch(self):
>>>> +        """
>>>> +        Returns the architecture required to run the current test
>>>> +        """
>>>> +        return self._arch
>>>> +> 
>>
>> --
>> Alex Bennée
>>
>>>>      def setUp(self):
>>>>          self.vm = None
>>>> -        self.qemu_bin = self.params.get('qemu_bin',
>>>> -                                        default=pick_default_qemu_bin())
>>>> +        qemu_bin = pick_default_qemu_bin(self.arch)
>>>> +        self.qemu_bin = self.params.get('qemu_bin', default=qemu_bin)
>>>>          if self.qemu_bin is None:
>>>>              self.cancel("No QEMU binary defined or found in the source tree")
>>>>          self.vm = QEMUMachine(self.qemu_bin)

  reply	other threads:[~2018-07-27  5:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  0:44 [Qemu-devel] [PATCH v2 0/6] Avocado: start multi-arch tests, add a Travis job Philippe Mathieu-Daudé
2018-06-22  0:44 ` [Qemu-devel] [RFC PATCH v2 1/6] avocado: Add a Test.arch property Philippe Mathieu-Daudé
2018-06-28 16:10   ` Alex Bennée
2018-06-28 21:54     ` Alex Bennée
2018-06-28 22:03       ` Philippe Mathieu-Daudé
2018-07-27  5:35         ` Philippe Mathieu-Daudé [this message]
2018-06-22  0:44 ` [Qemu-devel] [PATCH v2 2/6] tests/acceptance: Rename the x86-64 specific BootLinuxConsole test Philippe Mathieu-Daudé
2018-06-28 17:17   ` Alex Bennée
2018-06-22  0:44 ` [Qemu-devel] [PATCH v2 3/6] tests/acceptance: Improve the Avocado tags Philippe Mathieu-Daudé
2018-06-22  0:44 ` [Qemu-devel] [PATCH v2 4/6] tests/acceptance: Add a BootLinuxConsoleMips test Philippe Mathieu-Daudé
2018-06-28 16:23   ` Alex Bennée
2018-06-28 17:40     ` Philippe Mathieu-Daudé
2018-06-28 18:36       ` Alex Bennée
2018-06-28 22:45         ` Philippe Mathieu-Daudé
2018-07-04 19:56           ` Philippe Mathieu-Daudé
2018-07-04 20:47             ` Eduardo Habkost
2018-07-04 21:44               ` Philippe Mathieu-Daudé
2018-07-04 22:32                 ` Eduardo Habkost
2018-06-22  0:44 ` [Qemu-devel] [RFC PATCH v2 5/6] tests/acceptance: Add a kludge to not use the default console Philippe Mathieu-Daudé
2018-06-28 16:33   ` Alex Bennée
2018-06-22  0:44 ` [Qemu-devel] [PATCH v2 6/6] travis: Add Avocado tests Philippe Mathieu-Daudé
2018-06-28 15:46 ` [Qemu-devel] [PATCH v2 0/6] Avocado: start multi-arch tests, add a Travis job Alex Bennée
2018-06-28 16:26   ` Cleber Rosa
2018-06-28 17:13     ` Alex Bennée
2018-06-28 17:24       ` Philippe Mathieu-Daudé
2018-06-28 16:01 ` Alex Bennée
2018-07-27  5:33   ` Philippe Mathieu-Daudé
2018-07-27 16:30     ` Alex Bennée

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=99e1a77f-31e3-916d-e3ca-02348ea92668@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.