diff mbox series

[6/6] arm/oeqa: Use linuxboot and OEFVPSerialTarget instead of noop

Message ID 20220712102830.625090-7-peter.hoyes@arm.com
State New
Headers show
Series Refactor runfvp for OEFVPSerialTarget | expand

Commit Message

Peter Hoyes July 12, 2022, 10:28 a.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

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 <Peter.Hoyes@arm.com>
Change-Id: Idd749652ee72e244b7a3831dd2295e0bfaed3bfa
---
 .../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 mbox series

Patch

diff --git a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
index eb122f3..e79373d 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 6a3b36e..1d25471 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 ee85cc6..9c80059 100644
--- a/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf
+++ b/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf
@@ -33,8 +33,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 74ebc02..3b3fd00 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 ad01c11..30b6296 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 0000000..19e6e18
--- /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 b5fba7c..0000000
--- 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