Skip to contentSkip to conversation

tests/functional/arm/aspeed_ast2600: Enhance OTP test with functional validation

PATCH Superseded Kane Chen 2 participants 3 messages Feb 10 Arm/Aspeed machine support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v2 1/1 tests/functional/arm/aspeed_ast2600: Enhance OTP test with functional validation

In reply to Kane Chen

Improve the OTP test script by adding functional verification of OTP strap registers. The test now validates that OTP modifications made in U-Boot persist through the Linux boot process and survive a subsequent reboot.

Key changes:
- Added interactive console commands for U-Boot and Linux.
- Implemented verification for OTP register 0x30 across reboots.

---
 .../arm/test_aspeed_ast2600_sdk_otp.py        | 35 ++++++++++++++++---
 1 file changed, 31 insertions(+), 4 deletions(-)
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +31 -4
index 4066532d5d..90f283ea09 100644
@@ -6,7 +6,8 @@
 
 from qemu_test import Asset
 from aspeed import AspeedTest
-
+from qemu_test import wait_for_console_pattern, exec_command
+from qemu_test import exec_command_and_wait_for_pattern
 
 class AST2600Machine(AspeedTest):
 
@@ -25,9 +26,35 @@ def test_arm_ast2600_otp_blockdev_device(self):
             "-blockdev", f"driver=file,filename={otp_img},node-name=otp",
             "-global", "aspeed-otp.drive=otp",
         )
-        self.do_test_arm_aspeed_sdk_start(
-            self.scratch_file("ast2600-default", "image-bmc"))
-        self.wait_for_console_pattern("ast2600-default login:")
+        self.require_netdev('user')
+        self.vm.add_args('-drive', 'file=' +
+                self.scratch_file("ast2600-default", "image-bmc") +
+                ',if=mtd,format=raw',
+                '-net', 'nic', '-net', 'user', '-snapshot')
+        self.vm.launch()
+
+        # Set OTP value via uboot command
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot:')
+        exec_command_and_wait_for_pattern(self, '\012', 'ast#')
+        exec_command_and_wait_for_pattern(self,
+            'otp pb strap  o 0x30 1', 'ast#')
+        # Validate OTP value in uboot stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
+        exec_command_and_wait_for_pattern(self, 'boot',
+            "ast2600-default login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'Password:')
+        exec_command_and_wait_for_pattern(self, '0penBmc',
+            'root@ast2600-default:~#')
+        # Validate OTP value in BMC stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
+        exec_command_and_wait_for_pattern(self,
+            'reboot', 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', 'ast#')
+        # Validate OTP value in uboot stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
 
 
 if __name__ == '__main__':
Signature · 1 line
2.51.0

Kane Chen

author
#0 lore raw

v2 cover tests/functional/arm/aspeed_ast2600: Enhance OTP test with functional validation

Hi all,

This series enhances the AST2600 OTP functional test by introducing cross-stage verification. While the previous test focused on basic system boot-up, this update ensures OTP data persistence and correctness through various execution environments (U-Boot and Linux).

The updated test logic implements the following flow:
1. Boot into U-Boot and modify OTP strap settings via CLI.
2. Boot into Linux to verify the consistency of these settings.
3. Trigger a reboot to ensure that OTP configurations persist back into the U-Boot stage.

Note: This series is based on the aspeed-next branch.

Any feedback or suggestions are appreciated.

Best Regards,
Kane
---
Changlog:
v2: Change title for grouping the patch

v1: Initial version
---
Kane-Chen-AS (1):
tests/functional/arm/aspeed_ast2600: Enhance OTP test with functional
validation

 .../arm/test_aspeed_ast2600_sdk_otp.py        | 35 ++++++++++++++++---
 1 file changed, 31 insertions(+), 4 deletions(-)
Signature · 1 line
2.51.0
#2 lore raw
In reply to Kane Chen
Quoted 19 lines · Kane Chen

Improve the OTP test script by adding functional verification of OTP strap registers. The test now validates that OTP modifications made in U-Boot persist through the Linux boot process and survive a subsequent reboot.

Key changes:
- Added interactive console commands for U-Boot and Linux.
- Implemented verification for OTP register 0x30 across reboots.

---
  .../arm/test_aspeed_ast2600_sdk_otp.py        | 35 ++++++++++++++++---
  1 file changed, 31 insertions(+), 4 deletions(-)
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +0 -0
index 4066532d5d..90f283ea09 100644

tests/functional/arm/test_aspeed_ast2600_sdk_otp.py line 9

Quoted 4 lines
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +0 -1
@@ -6,7 +6,8 @@
 
  from qemu_test import Asset
  from aspeed import AspeedTest
-

Can you keep the line above please ?

Quoted 7 lines
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +2 -0
+from qemu_test import wait_for_console_pattern, exec_command
+from qemu_test import exec_command_and_wait_for_pattern
 
  class AST2600Machine(AspeedTest):
 
@@ -25,9 +26,35 @@ def test_arm_ast2600_otp_blockdev_device(self):
              "-blockdev", f"driver=file,filename={otp_img},node-name=otp",

tests/functional/arm/test_aspeed_ast2600_sdk_otp.py def test_arm_ast2600_otp_blockdev_device(self): · line 33

Quoted 10 lines
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +5 -3
              "-global", "aspeed-otp.drive=otp",
          )
-        self.do_test_arm_aspeed_sdk_start(
-            self.scratch_file("ast2600-default", "image-bmc"))
-        self.wait_for_console_pattern("ast2600-default login:")
+        self.require_netdev('user')
+        self.vm.add_args('-drive', 'file=' +
+                self.scratch_file("ast2600-default", "image-bmc") +
+                ',if=mtd,format=raw',
+                '-net', 'nic', '-net', 'user', '-snapshot')

please add at the top of the function :

self.require_netdev('user')

Thanks,

C.

Quoted 27 lines
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +24 -0
+        self.vm.launch()
+
+        # Set OTP value via uboot command
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot:')
+        exec_command_and_wait_for_pattern(self, '\012', 'ast#')
+        exec_command_and_wait_for_pattern(self,
+            'otp pb strap  o 0x30 1', 'ast#')
+        # Validate OTP value in uboot stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
+        exec_command_and_wait_for_pattern(self, 'boot',
+            "ast2600-default login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'Password:')
+        exec_command_and_wait_for_pattern(self, '0penBmc',
+            'root@ast2600-default:~#')
+        # Validate OTP value in BMC stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
+        exec_command_and_wait_for_pattern(self,
+            'reboot', 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '\012', 'ast#')
+        # Validate OTP value in uboot stage
+        exec_command_and_wait_for_pattern(self,
+            'otp read strap 0x30', '0x30      1')
 
 
  if __name__ == '__main__':