From patchwork Fri Mar 22 09:58:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 1061031 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zsx/Hsdu"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44QfJ064Kyz9sRV for ; Fri, 22 Mar 2019 20:58:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1A46F23455; Fri, 22 Mar 2019 09:58:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yz7HOGjge-Nj; Fri, 22 Mar 2019 09:58:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id F253C23469; Fri, 22 Mar 2019 09:58:46 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 82EFB1BF968 for ; Fri, 22 Mar 2019 09:58:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7FEBC870C7 for ; Fri, 22 Mar 2019 09:58:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wPu3QP8QS29V for ; Fri, 22 Mar 2019 09:58:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4ED1781F0F for ; Fri, 22 Mar 2019 09:58:44 +0000 (UTC) Received: by mail-wm1-f43.google.com with SMTP id o10so3914331wmc.1 for ; Fri, 22 Mar 2019 02:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WXUajT4+cz+6WaOHryjdy7odzvpabdj/ty9d2ZvE+JA=; b=zsx/HsduI2ghcZPEsmRhBzGpjsMS0Kp4ZIruoSdBAh45OMqagqCnb9cGGM/2zg0ksG oSigzDJshqsaetgtvokIQ26UEiq2zcGOtXRpwCTHxOQuGeSX1snmYApChvFo/C/A8hMM KDAoywNHjqn0HGx0H3cHWdqXosyp8TcICgNp4gcaLBmncq1zO2lTXGMpiRPfx/3btVxT DjfV/Az5CQ37u9MVnsaS9etL4Kj9/vWJ2XYZ1XGN5/ZmWrE1IQeFaPzF8q/z8fUiOM/u yXTRQ94PAt6avxnT8GWaHPfafTiqwR1vUivdChwtMzuRvJjweANf5k4G8UNpYkUVfB1X L9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WXUajT4+cz+6WaOHryjdy7odzvpabdj/ty9d2ZvE+JA=; b=clg8Q8toOpZm+LDuOq/houiKRmSHknwWgJ0kSDl2Xy9CwHM1KQ6X7OlWyUGlam7V5l /KNGPVL2HTSr3wCoeeMJNJBAcZhn5oEeWpoVdb37D7vfrQ925KjozyGeubCMQotNrHb0 eE4m0o09J3h+6WgBEIwtX3HE/unzm5jzEs53vwfqS8NCEaf8CHTq0K08dyoh8MapFR6F PhtGGBq2lislfdObLpx7n8U439gRAAiGRrPn62WRp0uRsqDhDHVAZ1zVW5HJB2B/zuJs 20AxpzdCKsMtbbKR/NDW+eoefipTYRo8Ja0rt+X1Mz5N6xwNh2Aq37HAWXRdpK7NHmGT ZkFQ== X-Gm-Message-State: APjAAAX0l3lPU5bYtqo1htTwMqBFlMY5XCd/OjyJBl9zk71LNoPsqW1u BPE9fP76wJHSpt+FH2ZAptWHkC2KbPk= X-Google-Smtp-Source: APXvYqyibMKBl1jk3pj8hwbWQ+fQYJnZSr7e63s/fsWs3trTO1xb7Gw2hVM3DNoM9d/uocqGfZasxA== X-Received: by 2002:a1c:4105:: with SMTP id o5mr2503962wma.35.1553248722646; Fri, 22 Mar 2019 02:58:42 -0700 (PDT) Received: from lmecxl0524.st.com ([80.215.109.31]) by smtp.gmail.com with ESMTPSA id t69sm12165646wmt.16.2019.03.22.02.58.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 02:58:42 -0700 (PDT) From: Etienne Carriere To: buildroot@buildroot.org Date: Fri, 22 Mar 2019 10:58:17 +0100 Message-Id: <20190322095818.19914-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190322095818.19914-1-etienne.carriere@linaro.org> References: <20190322095818.19914-1-etienne.carriere@linaro.org> Subject: [Buildroot] [PATCH v3 3/4] support/testing: test can use the locally generated qemu host tool X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Etienne Carriere , Ricardo Martincoski , Sergey Matyukevich MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This change adds argument --local-emulator to run-tests to use a locally built emulator for the runtime test. Target test shall provide a config_emulator attribute unless what test is inconsistent. Signed-off-by: Etienne Carriere --- Changes v2 -> v3: - Add an argument to run-tests to use locally built emulator. Test can still enforce use of locally built emulator from boot method argument local=True|False (still defaults to False). Changes v1 -> v2: - No commit not in v1 series. --- support/testing/infra/basetest.py | 5 ++++- support/testing/infra/emulator.py | 19 ++++++++++++++++--- support/testing/run-tests | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py index a176bc328a..c59e0a3443 100644 --- a/support/testing/infra/basetest.py +++ b/support/testing/infra/basetest.py @@ -51,6 +51,8 @@ class BRConfigTest(unittest.TestCase): def setUp(self): self.show_msg("Starting") + if self.local_emulator: + self.config = self.config + self.config_emulator self.b = Builder(self.config, self.builddir, self.logtofile) if not self.keepbuilds: @@ -78,7 +80,8 @@ class BRTest(BRConfigTest): self.show_msg("Building done") self.emulator = Emulator(self.builddir, self.downloaddir, - self.logtofile, self.timeout_multiplier) + self.logtofile, self.timeout_multiplier, + self.local_emulator) def tearDown(self): if self.emulator: diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py index 802e89d4b4..13e19df497 100644 --- a/support/testing/infra/emulator.py +++ b/support/testing/infra/emulator.py @@ -1,14 +1,19 @@ import pexpect +import os + import infra class Emulator(object): - def __init__(self, builddir, downloaddir, logtofile, timeout_multiplier): + def __init__(self, builddir, downloaddir, logtofile, timeout_multiplier, + local_emulator): self.qemu = None self.downloaddir = downloaddir self.logfile = infra.open_log_file(builddir, "run", logtofile) + self.builddir = builddir + self.local_emulator = local_emulator # 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 # when running the tests to avoid sporadic failures. @@ -30,13 +35,21 @@ 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), + qemu_bin = "qemu-system-{}".format(qemu_arch) + if self.local_emulator or local: + qemu_bin = os.path.join(self.builddir, 'host', 'bin', qemu_bin) + + qemu_cmd = [qemu_bin, "-serial", "stdio", "-display", "none"] diff --git a/support/testing/run-tests b/support/testing/run-tests index 813b927045..c667fc2e4f 100755 --- a/support/testing/run-tests +++ b/support/testing/run-tests @@ -31,6 +31,8 @@ def main(): help='BR2_JLEVEL to use for each testcase') parser.add_argument('--timeout-multiplier', type=int, default=1, help='increase timeouts (useful for slow machines)') + parser.add_argument('--local-emulator', action='store_true', + help='use a locally built emulator') args = parser.parse_args() @@ -107,6 +109,8 @@ def main(): return 1 BRConfigTest.timeout_multiplier = args.timeout_multiplier + BRConfigTest.local_emulator = args.local_emulator + nose2_args = ["-v", "-N", str(args.testcases), "-s", test_dir,