From db6e0ed624f6e1eda9c3a0ed5f13057c24037f86 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Tue, 12 Jul 2022 11:28:30 +0100 Subject: [PATCH] arm/oeqa: Use linuxboot and OEFVPSerialTarget instead of noop Create a new "linuxboot" test that uses the pexpect methods on OEFVPSerialTarget to wait for a Linux login shell. Switch to this test method for fvp-baser-aemv8r64, corstone500 and corstone1000. Issue-Id: SCM-4957 Signed-off-by: Peter Hoyes Change-Id: Idd749652ee72e244b7a3831dd2295e0bfaed3bfa Signed-off-by: Jon Mason --- .../conf/machine/corstone1000-fvp.conf | 4 ++-- meta-arm-bsp/conf/machine/corstone500.conf | 4 ++-- .../conf/machine/fvp-baser-aemv8r64.conf | 4 ++-- meta-arm/lib/fvp/runner.py | 4 +++- meta-arm/lib/oeqa/controllers/fvp.py | 3 ++- meta-arm/lib/oeqa/runtime/cases/linuxboot.py | 18 ++++++++++++++++++ meta-arm/lib/oeqa/runtime/cases/noop.py | 12 ------------ 7 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 meta-arm/lib/oeqa/runtime/cases/linuxboot.py delete mode 100644 meta-arm/lib/oeqa/runtime/cases/noop.py diff --git a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf index eb122f35..e79373de 100644 --- a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf +++ b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf @@ -8,8 +8,8 @@ TFA_TARGET_PLATFORM = "fvp" TFM_PLATFORM_IS_FVP = "TRUE" # testimage config -TEST_TARGET = "OEFVPTarget" -TEST_SUITES = "noop" +TEST_TARGET = "OEFVPSerialTarget" +TEST_SUITES = "linuxboot" # FVP Config FVP_PROVIDER ?= "fvp-corstone1000-native" diff --git a/meta-arm-bsp/conf/machine/corstone500.conf b/meta-arm-bsp/conf/machine/corstone500.conf index 526fff78..6b65e7c5 100644 --- a/meta-arm-bsp/conf/machine/corstone500.conf +++ b/meta-arm-bsp/conf/machine/corstone500.conf @@ -33,8 +33,8 @@ WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}" WKS_FILE ?= "core-image-minimal.corstone500.wks" -TEST_TARGET = "OEFVPTarget" -TEST_SUITES = "noop" +TEST_TARGET = "OEFVPSerialTarget" +TEST_SUITES = "linuxboot" FVP_PROVIDER ?= "fvp-corstone500-native" FVP_EXE ?= "FVP_Corstone-500" diff --git a/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf b/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf index 1ffafb6e..6fa2ac46 100644 --- a/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf +++ b/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf @@ -32,8 +32,8 @@ PACKAGECONFIG:remove:pn-openssh = "rng-tools" MACHINE_EXTRA_RRECOMMENDS += "ssh-pregen-hostkeys" # testimage configuration -TEST_TARGET = "OEFVPTarget" -TEST_SUITES = "ping ssh" +TEST_TARGET = "OEFVPSerialTarget" +TEST_SUITES = "linuxboot" TEST_TARGET_IP ?= "127.0.0.1:8022" TEST_SERVER_IP ?= "127.0.1.1" diff --git a/meta-arm/lib/fvp/runner.py b/meta-arm/lib/fvp/runner.py index 74ebc02c..3b3fd00b 100644 --- a/meta-arm/lib/fvp/runner.py +++ b/meta-arm/lib/fvp/runner.py @@ -119,7 +119,9 @@ class FVPRunner: check_telnet() import pexpect port = await self._get_terminal_port(terminal, timeout) - return pexpect.spawn(f"telnet localhost {port}", **kwargs) + instance = pexpect.spawn(f"telnet localhost {port}", **kwargs) + self._pexpects.append(instance) + return instance def pid(self): return self._fvp_process.pid diff --git a/meta-arm/lib/oeqa/controllers/fvp.py b/meta-arm/lib/oeqa/controllers/fvp.py index ad01c110..30b6296b 100644 --- a/meta-arm/lib/oeqa/controllers/fvp.py +++ b/meta-arm/lib/oeqa/controllers/fvp.py @@ -87,7 +87,8 @@ class OEFVPSerialTarget(OEFVPSSHTarget): This still depends on OEFVPSSHTarget so SSH commands can still be run on the target, but note that this class does not inherently guarantee that the SSH server is running prior to running test cases. Test cases that use - SSH should first validate that SSH is available. + SSH should first validate that SSH is available, e.g. by depending on the + "linuxboot" test case in meta-arm. """ DEFAULT_CONSOLE = "default" diff --git a/meta-arm/lib/oeqa/runtime/cases/linuxboot.py b/meta-arm/lib/oeqa/runtime/cases/linuxboot.py new file mode 100644 index 00000000..19e6e187 --- /dev/null +++ b/meta-arm/lib/oeqa/runtime/cases/linuxboot.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: MIT + +from oeqa.runtime.case import OERuntimeTestCase + + +class LinuxBootTest(OERuntimeTestCase): + """ + This test case is only compatible with the OEFVPSerialTarget as it uses + the pexpect interface. It waits for a Linux login prompt on the default + console. + """ + + def setUp(self): + self.console = self.target.DEFAULT_CONSOLE + + def test_linux_boot(self): + self.logger.info(f"{self.console}: Waiting for login prompt") + self.target.expect(self.console, "login\:", timeout=10*60) diff --git a/meta-arm/lib/oeqa/runtime/cases/noop.py b/meta-arm/lib/oeqa/runtime/cases/noop.py deleted file mode 100644 index b5fba7c5..00000000 --- a/meta-arm/lib/oeqa/runtime/cases/noop.py +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: MIT - -from oeqa.runtime.case import OERuntimeTestCase - -class NoopTest(OERuntimeTestCase): - """ - This is a test case which does nothing. Useful when you want to use - testimage to verify that an image boots, but you don't have networking so - none of the existing test cases are suitable. - """ - def test_no_op(self): - return