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

Etienne Carriere etienne.carriere at linaro.org
Mon Mar 18 23:21:08 UTC 2019


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