From: Kane Chen via <qemu-arm@nongnu.org>
To: "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>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: <troy_lee@aspeedtech.com>, Kane-Chen-AS <kane_chen@aspeedtech.com>
Subject: [RFC v5 4/4] tests/functional: Add integration tests for ASPEED OTP memory model
Date: Thu, 19 Jun 2025 14:41:13 +0800 [thread overview]
Message-ID: <20250619064115.4182202-5-kane_chen@aspeedtech.com> (raw)
In-Reply-To: <20250619064115.4182202-1-kane_chen@aspeedtech.com>
From: Kane-Chen-AS <kane_chen@aspeedtech.com>
Introduce a functional test suite to validate the ASPEED OTP memory
device integration under different machine configurations.
The following cases are covered:
- AST2600 with blockdev + device + machine parameter (full binding)
- AST2600 fallback with no machine parameter
- AST2600 with only blockdev + device (no machine param)
- AST2600 with only machine parameter (no backend/device)
- AST1030 fallback test with Zephyr-based image
The tests ensure that the OTP model behaves correctly across boot-time
binding variations and fallback paths, and that firmware boot is
successful under each condition.
Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
tests/functional/meson.build | 1 +
tests/functional/test_aspeed_otpmem.py | 82 ++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 tests/functional/test_aspeed_otpmem.py
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index e9f19d54a2..ce999eeab1 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -41,6 +41,7 @@ test_timeouts = {
'arm_replay' : 240,
'arm_tuxrun' : 240,
'arm_sx1' : 360,
+ 'aspeed_otpmem': 1200,
'intel_iommu': 300,
'mips_malta' : 480,
'mipsel_malta' : 420,
diff --git a/tests/functional/test_aspeed_otpmem.py b/tests/functional/test_aspeed_otpmem.py
new file mode 100644
index 0000000000..67d2a7ecf6
--- /dev/null
+++ b/tests/functional/test_aspeed_otpmem.py
@@ -0,0 +1,82 @@
+
+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
+
+class AspeedOtpMemoryTest(AspeedTest):
+ # AST2600 SDK image
+ ASSET_SDK_V906_AST2600 = Asset(
+ 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2600-default-obmc.tar.gz',
+ '768d76e247896ad78c154b9cff4f766da2ce65f217d620b286a4a03a8a4f68f5')
+
+ # AST1030 Zephyr image
+ ASSET_ZEPHYR_3_00 = Asset(
+ ('https://github.com/AspeedTech-BMC'
+ '/zephyr/releases/download/v00.03.00/ast1030-evb-demo.zip'),
+ '37fe3ecd4a1b9d620971a15b96492a81093435396eeac69b6f3e384262ff555f')
+ 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_fallback(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ bmc_image = self.scratch_file("ast2600-default", "image-bmc")
+ self.vm.set_machine("ast2600-evb")
+ self.vm.set_console()
+ self.do_test_arm_aspeed_sdk_start(
+ self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern('ast2600-default login:')
+
+ def test_ast2600_otp_blockdev_device(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ otp_img = self.generate_otpmem_image()
+ self.vm.set_console()
+ self.vm.add_args(
+ "-blockdev", f"node-name=otpmem,driver=file,filename={otp_img}",
+ "-device", "aspeed.otpmem,drive=otpmem,id=otpmem-drive",
+ "-machine", "ast2600-evb,otpmem=otpmem-drive"
+ )
+ self.do_test_arm_aspeed_sdk_start(self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern("ast2600-default login:")
+
+ def test_ast2600_otp_only_blockdev(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ otp_img = self.generate_otpmem_image()
+ self.vm.set_machine("ast2600-evb")
+ self.vm.set_console()
+ self.vm.add_args(
+ "-blockdev", f"node-name=otpmem,driver=file,filename={otp_img}",
+ "-device", "aspeed.otpmem,drive=otpmem,id=otpmem-drive",
+ )
+ self.do_test_arm_aspeed_sdk_start(self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern("ast2600-default login:")
+
+ def test_ast2600_otp_only_machine_param(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ self.vm.set_console()
+ self.vm.add_args(
+ "-machine", "ast2600-evb,otpmem=otpmem-drive"
+ )
+ 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_fallback(self):
+ kernel_name = "ast1030-evb-demo/zephyr.elf"
+ kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_00, member=kernel_name)
+
+ self.vm.set_machine("ast1030-evb")
+ self.vm.set_console()
+ self.vm.add_args("-kernel", kernel_file)
+ self.vm.launch()
+ self.wait_for_console_pattern("Booting Zephyr OS")
+
+if __name__ == '__main__':
+ AspeedTest.main()
\ No newline at end of file
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Kane Chen via <qemu-devel@nongnu.org>
To: "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>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: <troy_lee@aspeedtech.com>, Kane-Chen-AS <kane_chen@aspeedtech.com>
Subject: [RFC v5 4/4] tests/functional: Add integration tests for ASPEED OTP memory model
Date: Thu, 19 Jun 2025 14:41:13 +0800 [thread overview]
Message-ID: <20250619064115.4182202-5-kane_chen@aspeedtech.com> (raw)
In-Reply-To: <20250619064115.4182202-1-kane_chen@aspeedtech.com>
From: Kane-Chen-AS <kane_chen@aspeedtech.com>
Introduce a functional test suite to validate the ASPEED OTP memory
device integration under different machine configurations.
The following cases are covered:
- AST2600 with blockdev + device + machine parameter (full binding)
- AST2600 fallback with no machine parameter
- AST2600 with only blockdev + device (no machine param)
- AST2600 with only machine parameter (no backend/device)
- AST1030 fallback test with Zephyr-based image
The tests ensure that the OTP model behaves correctly across boot-time
binding variations and fallback paths, and that firmware boot is
successful under each condition.
Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
tests/functional/meson.build | 1 +
tests/functional/test_aspeed_otpmem.py | 82 ++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 tests/functional/test_aspeed_otpmem.py
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index e9f19d54a2..ce999eeab1 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -41,6 +41,7 @@ test_timeouts = {
'arm_replay' : 240,
'arm_tuxrun' : 240,
'arm_sx1' : 360,
+ 'aspeed_otpmem': 1200,
'intel_iommu': 300,
'mips_malta' : 480,
'mipsel_malta' : 420,
diff --git a/tests/functional/test_aspeed_otpmem.py b/tests/functional/test_aspeed_otpmem.py
new file mode 100644
index 0000000000..67d2a7ecf6
--- /dev/null
+++ b/tests/functional/test_aspeed_otpmem.py
@@ -0,0 +1,82 @@
+
+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
+
+class AspeedOtpMemoryTest(AspeedTest):
+ # AST2600 SDK image
+ ASSET_SDK_V906_AST2600 = Asset(
+ 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2600-default-obmc.tar.gz',
+ '768d76e247896ad78c154b9cff4f766da2ce65f217d620b286a4a03a8a4f68f5')
+
+ # AST1030 Zephyr image
+ ASSET_ZEPHYR_3_00 = Asset(
+ ('https://github.com/AspeedTech-BMC'
+ '/zephyr/releases/download/v00.03.00/ast1030-evb-demo.zip'),
+ '37fe3ecd4a1b9d620971a15b96492a81093435396eeac69b6f3e384262ff555f')
+ 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_fallback(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ bmc_image = self.scratch_file("ast2600-default", "image-bmc")
+ self.vm.set_machine("ast2600-evb")
+ self.vm.set_console()
+ self.do_test_arm_aspeed_sdk_start(
+ self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern('ast2600-default login:')
+
+ def test_ast2600_otp_blockdev_device(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ otp_img = self.generate_otpmem_image()
+ self.vm.set_console()
+ self.vm.add_args(
+ "-blockdev", f"node-name=otpmem,driver=file,filename={otp_img}",
+ "-device", "aspeed.otpmem,drive=otpmem,id=otpmem-drive",
+ "-machine", "ast2600-evb,otpmem=otpmem-drive"
+ )
+ self.do_test_arm_aspeed_sdk_start(self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern("ast2600-default login:")
+
+ def test_ast2600_otp_only_blockdev(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ otp_img = self.generate_otpmem_image()
+ self.vm.set_machine("ast2600-evb")
+ self.vm.set_console()
+ self.vm.add_args(
+ "-blockdev", f"node-name=otpmem,driver=file,filename={otp_img}",
+ "-device", "aspeed.otpmem,drive=otpmem,id=otpmem-drive",
+ )
+ self.do_test_arm_aspeed_sdk_start(self.scratch_file("ast2600-default", "image-bmc"))
+ self.wait_for_console_pattern("ast2600-default login:")
+
+ def test_ast2600_otp_only_machine_param(self):
+ image_path = self.archive_extract(self.ASSET_SDK_V906_AST2600)
+ self.vm.set_console()
+ self.vm.add_args(
+ "-machine", "ast2600-evb,otpmem=otpmem-drive"
+ )
+ 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_fallback(self):
+ kernel_name = "ast1030-evb-demo/zephyr.elf"
+ kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_00, member=kernel_name)
+
+ self.vm.set_machine("ast1030-evb")
+ self.vm.set_console()
+ self.vm.add_args("-kernel", kernel_file)
+ self.vm.launch()
+ self.wait_for_console_pattern("Booting Zephyr OS")
+
+if __name__ == '__main__':
+ AspeedTest.main()
\ No newline at end of file
--
2.43.0
next prev parent reply other threads:[~2025-06-19 6:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 6:41 [RFC v5 0/4] Add QEMU model for ASPEED OTP memory and integrate with SoCs Kane Chen via
2025-06-19 6:41 ` [RFC v5 1/4] hw/misc/aspeed_otp: Add ASPEED OTP memory device model Kane Chen via
2025-06-19 6:41 ` [RFC v5 2/4] hw/misc/aspeed_sbc: Connect ASPEED OTP memory device to SBC Kane Chen via
2025-06-19 6:41 ` Kane Chen via
2025-06-19 6:41 ` [RFC v5 3/4] hw/arm: Integrate ASPEED OTP memory support into AST10x0 and AST2600 SoCs Kane Chen via
2025-06-19 6:41 ` Kane Chen via [this message]
2025-06-19 6:41 ` [RFC v5 4/4] tests/functional: Add integration tests for ASPEED OTP memory model Kane Chen via
2025-06-20 5:44 ` [RFC v5 0/4] Add QEMU model for ASPEED OTP memory and integrate with SoCs Cédric Le Goater
2025-06-23 3:23 ` Kane Chen
2025-06-23 6:45 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250619064115.4182202-5-kane_chen@aspeedtech.com \
--to=qemu-arm@nongnu.org \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.