diff mbox series

[4/5] arm/oeqa: Convert linuxboot test case into fvp_boot

Message ID 20230717185626.1793017-4-peter.hoyes@arm.com
State New
Headers show
Series [1/5] runfvp: Add missing conffile include | expand

Commit Message

Peter Hoyes July 17, 2023, 6:56 p.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

The linuxboot test case is already FVP-specific due to the use of the
OEFVPTarget pexpect interface. Clarify this by renaming to fvp_boot.

So that fvp_boot can be used alongside other OEQA test cases (e.g. those
in OE-core):
 * Call self.target.transition("off") at the start of the test to
   ensure the model starts from reset
 * Call self.target.transition("linux") to reuse the "wait for boot"
   logic in OEFVPTarget.

Additionally, minimally validate the firmware boot by checking for
common error patterns in all console logs. Expose the runfvp config in
OEFVPTarget to support this.

Align the list of test cases executed on both fvp-base and
fvp-baser-aemv8r64 by using TEST_CASES:append = " fvp_boot" for both.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 .../conf/machine/corstone1000-fvp.conf        |  2 +-
 meta-arm-bsp/conf/machine/corstone500.conf    |  2 +-
 .../conf/machine/fvp-baser-aemv8r64.conf      |  2 +-
 .../conf/machine/include/fvp-common.inc       |  1 +
 meta-arm-bsp/conf/machine/tc1.conf            |  2 +-
 meta-arm/lib/oeqa/controllers/fvp.py          |  4 +++
 meta-arm/lib/oeqa/runtime/cases/fvp_boot.py   | 25 +++++++++++++++++++
 meta-arm/lib/oeqa/runtime/cases/linuxboot.py  | 17 -------------
 8 files changed, 34 insertions(+), 21 deletions(-)
 create mode 100644 meta-arm/lib/oeqa/runtime/cases/fvp_boot.py
 delete mode 100644 meta-arm/lib/oeqa/runtime/cases/linuxboot.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 40f69297..449f5658 100644
--- a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
+++ b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
@@ -9,7 +9,7 @@  TFM_PLATFORM_IS_FVP = "TRUE"
 
 # testimage config
 TEST_TARGET = "OEFVPTarget"
-TEST_SUITES = "linuxboot"
+TEST_SUITES = "fvp_boot"
 
 # 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 36ba7703..a688ad2f 100644
--- a/meta-arm-bsp/conf/machine/corstone500.conf
+++ b/meta-arm-bsp/conf/machine/corstone500.conf
@@ -33,7 +33,7 @@  WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
 WKS_FILE ?= "core-image-minimal.corstone500.wks"
 
 TEST_TARGET = "OEFVPTarget"
-TEST_SUITES = "linuxboot"
+TEST_SUITES = "fvp_boot"
 
 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 b8a6aa46..7dbc53a1 100644
--- a/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf
+++ b/meta-arm-bsp/conf/machine/fvp-baser-aemv8r64.conf
@@ -30,7 +30,7 @@  MACHINE_EXTRA_RRECOMMENDS += "ssh-pregen-hostkeys"
 
 # testimage configuration
 TEST_TARGET = "OEFVPTarget"
-TEST_SUITES = "linuxboot"
+TEST_SUITES:append = " fvp_boot"
 TEST_TARGET_IP ?= "127.0.0.1:8022"
 TEST_SERVER_IP ?= "127.0.1.1"
 
diff --git a/meta-arm-bsp/conf/machine/include/fvp-common.inc b/meta-arm-bsp/conf/machine/include/fvp-common.inc
index 47b7ffce..f80ac4c2 100644
--- a/meta-arm-bsp/conf/machine/include/fvp-common.inc
+++ b/meta-arm-bsp/conf/machine/include/fvp-common.inc
@@ -24,6 +24,7 @@  MACHINE_EXTRA_RRECOMMENDS += "ssh-pregen-hostkeys"
 
 TEST_TARGET = "OEFVPTarget"
 TEST_TARGET_IP = "127.0.0.1:8022"
+TEST_SUITES:append = " fvp_boot"
 
 FVP_PROVIDER ?= "fvp-base-a-aem-native"
 FVP_EXE ?= "FVP_Base_RevC-2xAEMvA"
diff --git a/meta-arm-bsp/conf/machine/tc1.conf b/meta-arm-bsp/conf/machine/tc1.conf
index bba2c191..31bcc2fb 100644
--- a/meta-arm-bsp/conf/machine/tc1.conf
+++ b/meta-arm-bsp/conf/machine/tc1.conf
@@ -7,7 +7,7 @@ 
 require conf/machine/include/tc.inc
 
 TEST_TARGET = "OEFVPTarget"
-TEST_SUITES = "linuxboot"
+TEST_SUITES = "fvp_boot"
 
 # FVP Config
 FVP_PROVIDER ?= "fvp-tc1-native"
diff --git a/meta-arm/lib/oeqa/controllers/fvp.py b/meta-arm/lib/oeqa/controllers/fvp.py
index cfd8c4e9..80f72aab 100644
--- a/meta-arm/lib/oeqa/controllers/fvp.py
+++ b/meta-arm/lib/oeqa/controllers/fvp.py
@@ -132,3 +132,7 @@  class OEFVPTarget(OESSHTarget):
                 return attr
 
         return call_pexpect
+
+    @property
+    def config(self):
+        return self.fvp.getConfig()
diff --git a/meta-arm/lib/oeqa/runtime/cases/fvp_boot.py b/meta-arm/lib/oeqa/runtime/cases/fvp_boot.py
new file mode 100644
index 00000000..dce52776
--- /dev/null
+++ b/meta-arm/lib/oeqa/runtime/cases/fvp_boot.py
@@ -0,0 +1,25 @@ 
+# SPDX-License-Identifier: MIT
+
+from oeqa.runtime.case import OERuntimeTestCase
+import pexpect
+
+
+class FVPBootTest(OERuntimeTestCase):
+    """
+    This test waits for a Linux login prompt on the default console. It is
+    dependent on the OEFVPTarget test controller
+    """
+
+    def test_fvp_boot(self):
+        self.target.transition("off")
+        timeout = int(self.td.get('TEST_FVP_LINUX_BOOT_TIMEOUT') or 10*60)
+        self.target.transition("linux", timeout)
+
+        # Check for common error patterns on all consoles
+        for console in self.target.config['consoles']:
+            # "expect" a timeout when searching for the error patterns
+            match = self.target.expect(console,
+                               [br'(\[ERR\]|\[ERROR\]|ERROR\:)',
+                                pexpect.TIMEOUT],
+                                timeout=0)
+            self.assertEqual(match, 1)
diff --git a/meta-arm/lib/oeqa/runtime/cases/linuxboot.py b/meta-arm/lib/oeqa/runtime/cases/linuxboot.py
deleted file mode 100644
index 184eb6c9..00000000
--- a/meta-arm/lib/oeqa/runtime/cases/linuxboot.py
+++ /dev/null
@@ -1,17 +0,0 @@ 
-# SPDX-License-Identifier: MIT
-
-from oeqa.runtime.case import OERuntimeTestCase
-
-
-class LinuxBootTest(OERuntimeTestCase):
-    """
-    This test waits for a Linux login prompt on the default console.
-    """
-
-    def setUp(self):
-        self.console = self.target.DEFAULT_CONSOLE
-        self.timeout = int(self.td.get('TEST_FVP_LINUX_BOOT_TIMEOUT') or 10*60)
-
-    def test_linux_boot(self):
-        self.logger.info(f"{self.console}: Waiting for login prompt")
-        self.target.expect(self.console, r"login\:", self.timeout)