Hi Cédric,

Many thanks for reviewing. I will revise the test script as suggested and 
resubmit the patch.

Best regards,
Kane
> -----Original Message-----
> From: Cédric Le Goater <c...@kaod.org>
> Sent: Tuesday, September 2, 2025 1:41 PM
> To: Kane Chen <kane_c...@aspeedtech.com>; Peter Maydell
> <peter.mayd...@linaro.org>; Steven Lee <steven_...@aspeedtech.com>; Troy
> Lee <leet...@gmail.com>; Jamin Lin <jamin_...@aspeedtech.com>; Andrew
> Jeffery <and...@codeconstruct.com.au>; Joel Stanley <j...@jms.id.au>;
> open list:ASPEED BMCs <qemu-...@nongnu.org>; open list:All patches CC
> here <qemu-devel@nongnu.org>; Thomas Huth <th...@redhat.com>
> Cc: Troy Lee <troy_...@aspeedtech.com>
> Subject: Re: [SPAM] [PATCH v5 09/10] tests/function/aspeed: Add OTP
> functional test
> 
> Hello Kane,
> 
> + Thomas
> 
> On 8/12/25 11:40, Kane Chen wrote:
> > From: Kane-Chen-AS <kane_c...@aspeedtech.com>
> >
> > On boot, the SoC firmware reads data from the OTP region to obtain the
> > chip ID and default settings. This change adds test cases to verify
> > that the firmware can boot correctly with a pre-configured OTP image.
> >
> > Signed-off-by: Kane-Chen-AS <kane_c...@aspeedtech.com>
> > ---
> >   tests/functional/meson.build            |  2 +
> >   tests/functional/test_arm_aspeed_otp.py | 55
> +++++++++++++++++++++++++
> >   2 files changed, 57 insertions(+)
> >   create mode 100644 tests/functional/test_arm_aspeed_otp.py
> >
> > diff --git a/tests/functional/meson.build
> > b/tests/functional/meson.build index 311c6f1806..c731b779dd 100644
> > --- a/tests/functional/meson.build
> > +++ b/tests/functional/meson.build
> > @@ -34,6 +34,7 @@ test_timeouts = {
> >     'arm_aspeed_bletchley' : 480,
> >     'arm_aspeed_catalina' : 480,
> >     'arm_aspeed_gb200nvl_bmc' : 480,
> > +  'arm_aspeed_otp': 1200,
> >     'arm_aspeed_rainier' : 480,
> >     'arm_bpim2u' : 500,
> >     'arm_collie' : 180,
> > @@ -132,6 +133,7 @@ tests_arm_system_thorough = [
> >     'arm_aspeed_bletchley',
> >     'arm_aspeed_catalina',
> >     'arm_aspeed_gb200nvl_bmc',
> > +  'arm_aspeed_otp',
> >     'arm_aspeed_rainier',
> >     'arm_bpim2u',
> >     'arm_canona1100',
> > diff --git a/tests/functional/test_arm_aspeed_otp.py
> > b/tests/functional/test_arm_aspeed_otp.py
> 
> The tests/functional directory was recently reorganized.
> 
> Also, I think I would prefer the new otp test to be part of the existing test 
> files :
> 
>    tests/functional/arm/test_aspeed_ast1030.py
>    tests/functional/arm/test_aspeed_ast2600.py
> 
> Something to discuss since test_aspeed_ast2600.py is rather big.
> 
> 
> > new file mode 100644
> > index 0000000000..48c7cad3f3
> > --- /dev/null
> > +++ b/tests/functional/test_arm_aspeed_otp.py
> > @@ -0,0 +1,55 @@
> > +import os
> > +import time
> > +import tempfile
> > +import subprocess
> > +
> > +from qemu_test import LinuxKernelTest, Asset> +from aspeed import
> > +AspeedTest from qemu_test import exec_command_and_wait_for_pattern,
> > +skipIfMissingCommands
> > +
> 
> Please add an extra blank line
> 
> > +class AspeedOtpMemoryTest(AspeedTest):
> > +    # AST2600 SDK image
> > +    ASSET_SDK_V907_AST2600 = Asset(
> > +
> 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.07/a
> st2600-default-obmc.tar.gz',
> > +
> >
> +'cb6c08595bcbba1672ce716b068ba4e48eda1ed9abe78a07b30392ba2278fe
> ba')
> 
> Please update first all functional tests with the new SDK v9.07 images.
> 
> > +
> > +    # AST1030 Zephyr image
> > +    ASSET_ZEPHYR_3_02 = Asset(
> > +
> 'https://github.com/AspeedTech-BMC/zephyr/releases/download/v00.03.02/
> ast1030-evb-demo.zip',
> > +
> > +
> '1ec83caab3ddd5d09481772801be7210e222cb015ce22ec6fffb8a76956dcd4f'
> )
> 
> Same for Zephyr images
> 
> > +
> > +    def generate_otpmem_image(self):
> > +        path = self.scratch_file("otpmem.img")
> > +        pattern = b'\x00\x00\x00\x00\xff\xff\xff\xff' * (16 * 1024 // 8)
> > +        with open(path, "wb") as f:
> > +            f.write(pattern)
> > +        return path
> > +
> > +    def test_ast2600_otp_blockdev_device(self):
> > +        image_path =
> self.archive_extract(self.ASSET_SDK_V907_AST2600)
> > +        otp_img = self.generate_otpmem_image()
> > +        self.vm.set_machine("ast2600-evb")
> 
> Please move self.vm.set_machine() at the top of the routine.
> 
> 
> Thanks,
> 
> C.
> 
> 
> 
> > +        self.vm.set_console()
> > +        self.vm.add_args(
> > +            "-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:")
> > +
> > +    def test_ast1030_otp_blockdev_device(self):
> > +        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_machine("ast1030-evb")
> > +        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__':
> > +    AspeedTest.main()

Reply via email to