]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional/arm/aspeed_ast2600: Enhance OTP test with functional validation
authorKane Chen <kane_chen@aspeedtech.com>
Wed, 11 Feb 2026 05:23:28 +0000 (05:23 +0000)
committerCédric Le Goater <clg@redhat.com>
Thu, 12 Feb 2026 15:06:55 +0000 (16:06 +0100)
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.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260211052326.430475-2-kane_chen@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py

index 4066532d5dec3d5796540871b535bf1d23fbd7a8..31a1c3bed6700681242f32efc4caef025f7fb51c 100755 (executable)
@@ -7,6 +7,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):
 
@@ -16,6 +18,7 @@ class AST2600Machine(AspeedTest):
 
     def test_arm_ast2600_otp_blockdev_device(self):
         self.vm.set_machine("ast2600-evb")
+        self.require_netdev('user')
 
         image_path = self.archive_extract(self.ASSET_SDK_V1100_AST2600)
         otp_img = self.generate_otpmem_image()
@@ -25,9 +28,34 @@ class AST2600Machine(AspeedTest):
             "-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.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__':