Skip to contentSkip to conversation

docs: Update FVP_CONSOLES in runfvp documentation

PATCH Applied Peter Hoyes 2 participants 5 messages Aug 5, 2022 – Aug 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 docs: Update FVP_CONSOLES in runfvp documentation

From: Peter Hoyes <[email protected]>

The runfvp refactor to enable OEFVPSerialTarget created FVP_CONSOLES which maps the names used for serial ports in test cases to the names used for serial ports in the FVP stdout.

Refactor the FVP_CONSOLE section -> FVP_CONSOLES, noting the the 'default' console is still used for the --console runfvp flag.

Issue-Id: SCM-4954

Change-Id Ieb13d74cfd425900f44b4b2e6d125393e7b456ad
---
 documentation/runfvp.md | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
documentation/runfvp.md +6 -3
index b9e007b..c792f4e 100644
@@ -98,13 +98,16 @@ FVP_TERMINALS[bp.terminal_2] = ""
 FVP_TERMINALS[bp.terminal_3] = ""
 ```
 
-### `FVP_CONSOLE`
+### `FVP_CONSOLES`
 
-This specifies what serial port is used when `--console` is passed to runfvp. Note that this has to be the FVP identifier but without the board prefix, for example:
+This specifies what serial ports can be used in oeqa tests, along with an alias to be used in the test cases. Note that the values have to be the FVP identifier but without the board prefix, for example:
 ```
-FVP_CONSOLE = "terminal_0"
+FVP_CONSOLES[default] = "terminal_0"
+FVP_CONSOLES[tf-a] = "s_terminal_0"
 ```
 
+The 'default' console is also used when `--console` is passed to runfvp.
+
 ### `FVP_EXTRA_ARGS`
 
 Arbitrary extra arguments that are passed directly to the FVP.  For example:
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 docs: Introduce meta-arm OEQA documentation

From: Peter Hoyes <[email protected]>

Add documentation for how to use the OEQA framework to test targets in meta-arm. Include instructions on using OEFVPTarget as well as the OEFVPSerialTarget introduced by the recent refactor of runfvp.

Issue-Id: SCM-4954

Change-Id I146ec1c82214471fe9d18a999fd92efb38f652f9
---
 documentation/oeqa-fvp.md | 55 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 documentation/oeqa-fvp.md
documentation/oeqa-fvp.md new file +55 -0
new file mode 100644
index 0000000..b53065a
@@ -0,0 +1,55 @@
+# OEQA on Arm FVPs
+
+OE-Core's [oeqa][OEQA] framework provides a method of performing runtime tests on machines using the `testimage` Yocto task. meta-arm has good support for writing test cases against [Arm FVPs][FVP], meaning the [runfvp][RUNFVP] boot configuration can be re-used.
+
+Tests can be configured to run automatically post-build by setting the variable `TESTIMAGE_AUTO="1"`, e.g. in your Kas file or local.conf.
+
+There are two main methods of testing, using different test "targets".
+
+## OEFVPTarget
+
+This runs test cases on a machine using SSH. It therefore requires that an SSH server is installed in the image.
+
+In test cases, the primary interface with the target is, e.g:
+```
+(status, output) = self.target.run('uname -a')
+```
+which runs a single command on the target (using `ssh -c`) and returns the status code and the output. It is therefore useful for running tests in a Linux environment.
+
+For examples of test cases, see meta/lib/oeqa/runtime/cases in OE-Core. The majority of test cases depend on `ssh.SSHTest.test_ssh`, which first validates that the SSH connection is functioning.
+
+Example machine configuration:
+```
+TEST_TARGET = "OEFVPTarget"
+TEST_SERVER_IP = "127.0.0.1"
+TEST_TARGET_IP = "127.0.0.1:8022"
+IMAGE_FEATURES:append = " ssh-server-dropbear"
+FVP_CONFIG[bp.virtio_net.hostbridge.userNetPorts] ?= "8022=22"
+```
+
+## OEFVPSerialTarget
+
+This runs tests against one or more serial consoles on the FVP. It is more flexible than OEFVPTarget, but test cases written for this test target do not support the test cases in OE-core. As it does not require an SSH server, it is suitable for machines with performance or memory limitations.
+
+Internally, this test target launches a [Pexpect][PEXPECT] instance for each entry in FVP_CONSOLES which can be used with the provided alias. The whole Pexpect API is exposed on the target, where the alias is always passed as the first argument, e.g.:
+```
+self.target.expect('default', r'root@.*\:~#', timeout=30)
+self.assertNotIn(b'ERROR:', self.target.before('tf-a'))
+```
+
+For an example of a full test case, see meta-arm/lib/oeqa/runtime/cases/linuxboot.py This test case can be used to minimally verify that a machine boots to a Linux shell.
+
+The SSH interface described above is also available on OEFVPSerialTarget to support writing a set of hybrid test suites that use a combination of serial and SSH access. Note however that this test target does not guarantee that Linux has booted to shell prior to running any tests, so the test cases in OE-core are not supported.
+
+Example machine configuration:
+```
+TEST_TARGET="OEFVPSerialTarget"
+TEST_SUITES="linuxboot"
+FVP_CONSOLES[default] = "terminal_0"
+FVP_CONSOLES[tf-a] = "s_terminal_0"
+```
+
+[OEQA]: https://docs.yoctoproject.org/test-manual/intro.html
+[FVP]: https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms
+[RUNFVP]: runfvp.md
+[PEXPECT]: https://pexpect.readthedocs.io/en/stable/overview.html
Signature · 1 line
2.25.1
Applied
#2 lore raw
In reply to Peter Hoyes
Quoted 6 lines · Peter Hoyes

The runfvp refactor to enable OEFVPSerialTarget created FVP_CONSOLES which maps the names used for serial ports in test cases to the names used for serial ports in the FVP stdout.

Refactor the FVP_CONSOLE section -> FVP_CONSOLES, noting the the 'default' console is still used for the --console runfvp flag.

Applied, thanks!

[1/2] docs: Update FVP_CONSOLES in runfvp documentation

      commit: 74a36b024f4d20c80e7c686cdc6d829d60a2689d
[2/2] docs: Introduce meta-arm OEQA documentation
      commit: f83aad2ba9d43327bcae28b6c05a8a8ab9d5a519

Best regards,

Signature · 1 line
Jon Mason <[email protected]>
#3 lore raw
Quoted 7 lines · Jon Mason
Quoted 6 lines · Peter Hoyes

The runfvp refactor to enable OEFVPSerialTarget created FVP_CONSOLES which maps the names used for serial ports in test cases to the names used for serial ports in the FVP stdout.

Refactor the FVP_CONSOLE section -> FVP_CONSOLES, noting the the 'default' console is still used for the --console runfvp flag.

Quoted 8 lines

Applied, thanks!

[1/2] docs: Update FVP_CONSOLES in runfvp documentation

       commit: 74a36b024f4d20c80e7c686cdc6d829d60a2689d
[2/2] docs: Introduce meta-arm OEQA documentation
       commit: f83aad2ba9d43327bcae28b6c05a8a8ab9d5a519

Best regards,

Please can this chain be backported to kirkstone.

#4 lore raw
Quoted 10 lines · Peter Hoyes
Quoted 9 lines · Jon Mason
Quoted 6 lines · Peter Hoyes

The runfvp refactor to enable OEFVPSerialTarget created FVP_CONSOLES which maps the names used for serial ports in test cases to the names used for serial ports in the FVP stdout.

Refactor the FVP_CONSOLE section -> FVP_CONSOLES, noting the the 'default' console is still used for the --console runfvp flag.

Applied, thanks!

Quoted 8 lines
Quoted 6 lines

[1/2] docs: Update FVP_CONSOLES in runfvp documentation

       commit: 74a36b024f4d20c80e7c686cdc6d829d60a2689d
[2/2] docs: Introduce meta-arm OEQA documentation
       commit: f83aad2ba9d43327bcae28b6c05a8a8ab9d5a519

Best regards,

Please can this chain be backported to kirkstone.

Done