All of lore.kernel.org
 help / color / mirror / Atom feed
From: Etienne Carriere <etienne.carriere@linaro.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 8/8] support/testing: test_optee.py: test optee boot and testsuite
Date: Tue, 19 Mar 2019 00:21:09 +0100	[thread overview]
Message-ID: <1552951269-16967-8-git-send-email-etienne.carriere@linaro.org> (raw)
In-Reply-To: <1552951269-16967-1-git-send-email-etienne.carriere@linaro.org>

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 <etienne.carriere@linaro.org>
---
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 | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 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 0000000..fdf391a
--- /dev/null
+++ b/support/testing/tests/package/test_optee.py
@@ -0,0 +1,40 @@
+import os
+
+import infra.basetest
+
+
+class TestOptee(infra.basetest.BRTest):
+
+    with open(os.path.join(os.getcwd(), 'configs/qemu_armv7a_tz_virt_defconfig'), 'r') as config_file:
+        config = "".join(line for line in config_file if line[:1]!='#') + \
+                """
+                BR2_TOOLCHAIN_EXTERNAL=y
+                """
+
+    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'])
+
+        # Prepare env for Qemu/armv7a to find the boot images
+        os.chdir(os.path.join(self.builddir, 'images'))
+        if not os.path.exists('bl33.bin'):
+            os.symlink('u-boot.bin', 'bl33.bin')
+        if not os.path.exists('bl32.bin'):
+            os.symlink('tee-header_v2.bin', 'bl32.bin')
+        if not os.path.exists('bl32_extra1.bin'):
+            os.symlink('tee-pager_v2.bin', 'bl32_extra1.bin')
+        if not os.path.exists('bl32_extra2.bin'):
+            os.symlink('tee-pageable_v2.bin', 'bl32_extra2.bin')
+
+        self.emulator.boot(arch='armv7', options=qemu_options, local=True)
+        self.emulator.login()
+
+        # Trick test trace since it prints "# " and corrupts emulator run method
+        # Print test trace 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)
-- 
1.9.1

  parent reply	other threads:[~2019-03-18 23:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 23:21 [Buildroot] [PATCH v2 1/8] boot/arm-trusted-firmware: support 32bit Arm targets Etienne Carriere
2019-03-18 23:21 ` [Buildroot] [PATCH v2 2/8] boot/arm-trusted-firmware: in-tree and OP-TEE BL32 Etienne Carriere
2019-03-20 21:54   ` Thomas Petazzoni
2019-03-18 23:21 ` [Buildroot] [PATCH v2 3/8] boot/arm-trusted-firmware: support debug mode Etienne Carriere
2019-03-20 21:59   ` Thomas Petazzoni
2019-03-18 23:21 ` [Buildroot] [PATCH v2 4/8] boot/arm-trusted-firmware: support alternate image files Etienne Carriere
2019-03-20 22:03   ` Thomas Petazzoni
2019-03-21  8:06     ` Etienne Carriere
2019-03-18 23:21 ` [Buildroot] [PATCH v2 5/8] package/optee-test: fix dependency in TAs build Etienne Carriere
2019-03-20 22:03   ` Thomas Petazzoni
2019-03-18 23:21 ` [Buildroot] [PATCH v2 6/8] configs/qemu_armv7a_tz_virt: Armv7-A emulation with TrustZone services Etienne Carriere
2019-03-19 22:00   ` Arnout Vandecappelle
2019-03-20  8:49     ` Etienne Carriere
2019-03-20  9:20       ` Arnout Vandecappelle
2019-03-20 12:06         ` Etienne Carriere
2019-03-18 23:21 ` [Buildroot] [PATCH v2 7/8] testing: test can use the locally generated qemu host tool Etienne Carriere
2019-03-19  7:05   ` Etienne Carriere
2019-03-19 22:03     ` Arnout Vandecappelle
2019-03-22 10:06       ` Etienne Carriere
2019-03-18 23:21 ` Etienne Carriere [this message]
2019-03-20 21:34 ` [Buildroot] [PATCH v2 1/8] boot/arm-trusted-firmware: support 32bit Arm targets Thomas Petazzoni

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=1552951269-16967-8-git-send-email-etienne.carriere@linaro.org \
    --to=etienne.carriere@linaro.org \
    --cc=buildroot@busybox.net \
    /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.