[PATCH v1 1/3] tests/functional/arm: Add helper to generate OTP images

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 1/3] tests/functional/arm: Add helper to generate OTP images
Posted by Kane Chen via 1 week, 5 days ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

Add a small helper that generates OTP images at test time. This lets
multiple test cases create default OTP contents without shipping prebuilt
fixtures and keeps the tests self-contained.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 tests/functional/aspeed.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/functional/aspeed.py b/tests/functional/aspeed.py
index b131703c52..90edb99a09 100644
--- a/tests/functional/aspeed.py
+++ b/tests/functional/aspeed.py
@@ -61,3 +61,10 @@ def do_test_arm_aspeed_sdk_start(self, image):
         self.wait_for_console_pattern('U-Boot 2019.04')
         self.wait_for_console_pattern('## Loading kernel from FIT Image')
         self.wait_for_console_pattern('Starting kernel ...')
+
+    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
\ No newline at end of file
-- 
2.43.0
Re: [SPAM] [PATCH v1 1/3] tests/functional/arm: Add helper to generate OTP images
Posted by Cédric Le Goater 1 week, 5 days ago
Hello Kane,

On 9/16/25 10:04, Kane Chen wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> Add a small helper that generates OTP images at test time. This lets
> multiple test cases create default OTP contents without shipping prebuilt
> fixtures and keeps the tests self-contained.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> ---
>   tests/functional/aspeed.py | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/functional/aspeed.py b/tests/functional/aspeed.py
> index b131703c52..90edb99a09 100644
> --- a/tests/functional/aspeed.py
> +++ b/tests/functional/aspeed.py
> @@ -61,3 +61,10 @@ def do_test_arm_aspeed_sdk_start(self, image):
>           self.wait_for_console_pattern('U-Boot 2019.04')
>           self.wait_for_console_pattern('## Loading kernel from FIT Image')
>           self.wait_for_console_pattern('Starting kernel ...')
> +
> +    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
> \ No newline at end of file

Please add a new line.


Thanks,

C.