[PATCH v1 2/3] tests/functional/arm: Add AST1030 boot test with generated OTP image

Kane Chen via posted 3 patches 1 week, 5 days ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
There is a newer version of this series
[PATCH v1 2/3] tests/functional/arm: Add AST1030 boot test with generated OTP image
Posted by Kane Chen via 1 week, 5 days ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

Add a functional test that boots an AST1030 machine with a generated
OTP image. The test verifies that OTP contents are read during early
boot and that the system reaches the expected console prompt.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 tests/functional/arm/test_aspeed_ast1030.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/tests/functional/arm/test_aspeed_ast1030.py b/tests/functional/arm/test_aspeed_ast1030.py
index 42126b514f..2cad85c196 100755
--- a/tests/functional/arm/test_aspeed_ast1030.py
+++ b/tests/functional/arm/test_aspeed_ast1030.py
@@ -7,10 +7,11 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 from qemu_test import LinuxKernelTest, Asset
+from aspeed import AspeedTest
 from qemu_test import exec_command_and_wait_for_pattern
 
 
-class AST1030Machine(LinuxKernelTest):
+class AST1030Machine(AspeedTest):
 
     ASSET_ZEPHYR_3_02 = Asset(
         ('https://github.com/AspeedTech-BMC'
@@ -68,6 +69,21 @@ def test_ast1030_zephyros_1_07(self):
                 'kernel uptime',
         ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$")
 
+    def test_ast1030_otp_blockdev_device(self):
+        self.vm.set_machine("ast1030-evb")
+
+        kernel_name = "ast1030-evb-demo-3/zephyr.elf"
+        kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_02, member=kernel_name)
+        otp_img = self.generate_otpmem_image()
+
+        self.vm.set_console()
+        self.vm.add_args(
+            "-kernel", kernel_file,
+            "-blockdev", f"driver=file,filename={otp_img},node-name=otp",
+            "-global", "aspeed-otp.drive=otp",
+        )
+        self.vm.launch()
+        self.wait_for_console_pattern("Booting Zephyr OS")
 
 if __name__ == '__main__':
-    LinuxKernelTest.main()
+    AspeedTest.main()
-- 
2.43.0
Re: [SPAM] [PATCH v1 2/3] tests/functional/arm: Add AST1030 boot test with generated OTP image
Posted by Cédric Le Goater 1 week, 5 days ago
On 9/16/25 10:04, Kane Chen wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> Add a functional test that boots an AST1030 machine with a generated
> OTP image. The test verifies that OTP contents are read during early
> boot and that the system reaches the expected console prompt.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> ---
>   tests/functional/arm/test_aspeed_ast1030.py | 20 ++++++++++++++++++--
>   1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/functional/arm/test_aspeed_ast1030.py b/tests/functional/arm/test_aspeed_ast1030.py
> index 42126b514f..2cad85c196 100755
> --- a/tests/functional/arm/test_aspeed_ast1030.py
> +++ b/tests/functional/arm/test_aspeed_ast1030.py
> @@ -7,10 +7,11 @@
>   # SPDX-License-Identifier: GPL-2.0-or-later
>   
>   from qemu_test import LinuxKernelTest, Asset
> +from aspeed import AspeedTest
>   from qemu_test import exec_command_and_wait_for_pattern
>   
>   
> -class AST1030Machine(LinuxKernelTest):
> +class AST1030Machine(AspeedTest):
>   
>       ASSET_ZEPHYR_3_02 = Asset(
>           ('https://github.com/AspeedTech-BMC'
> @@ -68,6 +69,21 @@ def test_ast1030_zephyros_1_07(self):
>                   'kernel uptime',
>           ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$")
>   
> +    def test_ast1030_otp_blockdev_device(self):


To have a consistent name with the other tests, please use a
test_arm_ prefix.


Thanks,

C.



> +        self.vm.set_machine("ast1030-evb")
> +
> +        kernel_name = "ast1030-evb-demo-3/zephyr.elf"
> +        kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_02, member=kernel_name)
> +        otp_img = self.generate_otpmem_image()
> +
> +        self.vm.set_console()
> +        self.vm.add_args(
> +            "-kernel", kernel_file,
> +            "-blockdev", f"driver=file,filename={otp_img},node-name=otp",
> +            "-global", "aspeed-otp.drive=otp",
> +        )
> +        self.vm.launch()
> +        self.wait_for_console_pattern("Booting Zephyr OS")
>   
>   if __name__ == '__main__':
> -    LinuxKernelTest.main()
> +    AspeedTest.main()