From patchwork Fri Mar 22 09:58:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 1061030 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.133; helo=hemlock.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="nWyozLH8"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44QfHy04q2z9sRV for ; Fri, 22 Mar 2019 20:58:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A756687E8B; Fri, 22 Mar 2019 09:58:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QG5v17pvNkFh; Fri, 22 Mar 2019 09:58:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 9C1EC87D3D; Fri, 22 Mar 2019 09:58:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id A8D6F1BF968 for ; Fri, 22 Mar 2019 09:58:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A65D487E82 for ; Fri, 22 Mar 2019 09:58:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yr8axuPTp5iY for ; Fri, 22 Mar 2019 09:58:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id 5141B87ADB for ; Fri, 22 Mar 2019 09:58:45 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id w10so1640505wrm.4 for ; Fri, 22 Mar 2019 02:58:45 -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=HakUIjaBGhTi7SbfxtLTa1JGfIzrxfleIlQAaBKjpkA=; b=nWyozLH8KwQ8r1MVGJrDn0tVUl8CF+/gPQ2KU1cdDnBLaZB2XqTv6AgEV95nf8+BSB 7ui4BILQQasoZziEzPOfme1B9vJfKEK040mcYFGVdNsPYwX7gxc+VR/K/EgwAJB4wEAz 49A3uVbSnJhlUWlcDJcNWqVSobNBrudmidihL2DKdrMH6M+45G4/NVfxxyH0d7F/nt2l z0w1I8M1q7zLL6u84J6T44NPl/PcmHtUvFJembhxkLOU4f18oJwX9OsXkmNNURiw62l7 x+DVaZmyMMabd5TnATiDjRTu7oyOiHOsrY7sub7I1l/gSgZRoacGLeYioZCjriypaVgM 0PJg== 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=HakUIjaBGhTi7SbfxtLTa1JGfIzrxfleIlQAaBKjpkA=; b=DKeZ03UTsYNjwnYJd2BkGU5gqOo91bqla5j/AW0ujF1LKYqlIfQ8KK1o+4ZR5udFUj sexMmnarVy1HT93UJr4LDirjKvCVf7vXDBkkc4UMKBKyCQpjNAKg+P1FGPlpSy2awMSr k1DK9P5Se/s1fobUATeAIIsqrkHykUorVxei/fO8pNkyw1WyqTcABSG6yQvuuQgvXQe4 CVpEIiSr/UH7q6WXhfb+l3D/FvgM9t3cGfQX5tP9fs21LVbJGHp4xCDvNTBvgd470L7O jnfL7Y5V7FgZXXvLm3zEv5h1uYs9Vf7ts8y33c5qjZALpJ666b448utwYOHbFfyKLSdR cmaA== X-Gm-Message-State: APjAAAUdLmfiHFQw990v4I27KP07murbttgvoKg6NcpL4OZa0so2SsBE NJb3KyOv+7d+bc5HBRSW1uNNkAl79sA= X-Google-Smtp-Source: APXvYqyykaDEBBn32DRmMZfFUL5TBM2ZWBPg6f591yGkd/BV2ABMt44lVqrdhQ3HCx24hE53upf+tg== X-Received: by 2002:a5d:4606:: with SMTP id t6mr5668907wrq.43.1553248723764; Fri, 22 Mar 2019 02:58:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 02:58:43 -0700 (PDT) From: Etienne Carriere To: buildroot@buildroot.org Date: Fri, 22 Mar 2019 10:58:18 +0100 Message-Id: <20190322095818.19914-4-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 4/4] support/testing: test_optee.py: test optee boot and testsuite 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" Run a Qemu emulation over qemu_armv7a_tz_virt_defconfig and run the embedded OP-TEE regression test suite (xtest). Tool xtest dumps traces that contain '# ' (hash + space) which corrupts infra/emulator.py sequence which use such traces to find shell prompt when command is completed. To overcome the issue the xtest traces are shown only if the test failed. One can run the test from something like: $> support/testing/run-tests \ -o output/optee-runtest -d output/dwl \ tests.package.test_optee Signed-off-by: Etienne Carriere --- Changes v2 -> v3: - Test provides a config_emulator attribute and mandates use of the locally built emulator. - Update qemu defconfig filename. - Remove postprocessing of test image file since driven from the selected defconfig Changes v1 -> v2: - Add argument local=True to test emulator to use the qemu host built from test configuration. - Fix typo in trace "Silent test takes a while, be patient..." --- support/testing/tests/package/test_optee.py | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 support/testing/tests/package/test_optee.py diff --git a/support/testing/tests/package/test_optee.py b/support/testing/tests/package/test_optee.py new file mode 100644 index 0000000000..44cee74fd8 --- /dev/null +++ b/support/testing/tests/package/test_optee.py @@ -0,0 +1,42 @@ +import os + +import infra.basetest + +# This test enforces locally built emulator to prevent old Qemu to +# dump secure trace to stdio and corrupting trace synchro expected +# through pexpect. + +class TestOptee(infra.basetest.BRTest): + + with open(os.path.join(os.getcwd(), 'configs', + 'qemu_arm_vexpress_tz_defconfig'), + 'r') as config_file: + config = "".join(line for line in config_file if line[:1] != '#') + \ + """ + BR2_PACKAGE_HOST_QEMU=y + BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y + BR2_TOOLCHAIN_EXTERNAL=y + """ + config_emulator = '' + + def test_run(self): + + qemu_options = ['-machine', 'virt,secure=on'] + qemu_options.extend(['-cpu', 'cortex-a15']) + qemu_options.extend(['-m', '1024']) + qemu_options.extend(['-semihosting-config', 'enable,target=native']) + qemu_options.extend(['-bios', 'bl1.bin']) + + # This test expects Qemu is run from the image direcotry + os.chdir(os.path.join(self.builddir, 'images')) + + self.emulator.boot(arch='armv7', options=qemu_options, local=True) + self.emulator.login() + + # Trick traces since xtest prints "# " which corrupts emulator run + # method. Tests are dumped only if test fails. + cmd = 'echo "Silent test takes a while, be patient..."; ' + \ + 'xtest -t regression > /tmp/xtest.log ||' + \ + '(cat /tmp/xtest.log && false)' + output, exit_code = self.emulator.run(cmd, timeout=240) + self.assertEqual(exit_code, 0)