[Buildroot] [PATCH v2 7/8] testing: test can use the locally generated qemu host tool

Etienne Carriere etienne.carriere at linaro.org
Tue Mar 19 07:05:01 UTC 2019


Dear all,

I made this to allow test_optee to use the qemu config from the platform.
But I wonder if it would be more suitable to have an generic option to
script run-tests to build the emulator within the test config.

Your thoughts?

Best regards,
etienne

On Tue, 19 Mar 2019 at 00:21, Etienne Carriere
<etienne.carriere at linaro.org> wrote:
>
> This change adds argument local to emulator boot method. When local is
> True, emulator.py runs the qemu host tool locally generated by the
> test. Otherwise the test uses the qemu host as found from PATH.
>
> Signed-off-by: Etienne Carriere <etienne.carriere at linaro.org>
> ---
> Changes v1 -> v2:
>  - No commit not in v1 series.
>
> ---
>  support/testing/infra/emulator.py | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
> index 802e89d..5fbf213 100644
> --- a/support/testing/infra/emulator.py
> +++ b/support/testing/infra/emulator.py
> @@ -1,5 +1,7 @@
>  import pexpect
>
> +import os
> +
>  import infra
>
>
> @@ -8,6 +10,7 @@ class Emulator(object):
>      def __init__(self, builddir, downloaddir, logtofile, timeout_multiplier):
>          self.qemu = None
>          self.downloaddir = downloaddir
> +        self.builddir = builddir
>          self.logfile = infra.open_log_file(builddir, "run", logtofile)
>          # We use elastic runners on the cloud to runs our tests. Those runners
>          # can take a long time to run the emulator. Use a timeout multiplier
> @@ -30,13 +33,22 @@ class Emulator(object):
>      #
>      # options: array of command line options to pass to Qemu
>      #
> -    def boot(self, arch, kernel=None, kernel_cmdline=None, options=None):
> +    # local: if True, the locally built qemu host tool is used instead of a
> +    # qemu host tool found from the PATH.
> +    #
> +    def boot(self, arch, kernel=None, kernel_cmdline=None, options=None,
> +             local=None):
>          if arch in ["armv7", "armv5"]:
>              qemu_arch = "arm"
>          else:
>              qemu_arch = arch
>
> -        qemu_cmd = ["qemu-system-{}".format(qemu_arch),
> +        if local:
> +            basedir = os.path.join(self.builddir, "host/bin/")
> +        else:
> +            basedir = ""
> +
> +        qemu_cmd = [basedir + "qemu-system-{}".format(qemu_arch),
>                      "-serial", "stdio",
>                      "-display", "none"]
>
> --
> 1.9.1
>


More information about the buildroot mailing list