Browse Source
Reorganize the monolithic Aspeed functional test files into separate files based on firmware type (Buildroot vs SDK) and specific test scenarios. This allows the test suite to run tests in parallel more effectively and makes it easier to identify and run specific test scenarios independently. Link: https://lore.kernel.org/qemu-devel/20260209065044.239378-2-clg@redhat.com Reviewed-by: Kane Chen <kane_chen@aspeedtech.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>master
8 changed files with 134 additions and 73 deletions
@ -0,0 +1,29 @@ |
|||
#!/usr/bin/env python3 |
|||
# |
|||
# Functional test that boots the ASPEED machines |
|||
# |
|||
# SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
from qemu_test import Asset |
|||
from aspeed import AspeedTest |
|||
|
|||
|
|||
class AST2500Machine(AspeedTest): |
|||
|
|||
ASSET_SDK_V1000_AST2500 = Asset( |
|||
'https://github.com/AspeedTech-BMC/openbmc/releases/download/v10.00/ast2500-default-obmc.tar.gz', |
|||
'7d71a3f71d5f4d9f3451f59a73bf9baf8fd9f6a24107eb504a3216151a8b2b5b') |
|||
|
|||
def test_arm_ast2500_evb_sdk(self): |
|||
self.set_machine('ast2500-evb') |
|||
|
|||
self.archive_extract(self.ASSET_SDK_V1000_AST2500) |
|||
|
|||
self.do_test_arm_aspeed_sdk_start( |
|||
self.scratch_file("ast2500-default", "image-bmc")) |
|||
|
|||
self.wait_for_console_pattern('ast2500-default login:') |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
AspeedTest.main() |
|||
@ -0,0 +1,60 @@ |
|||
#!/usr/bin/env python3 |
|||
# |
|||
# Functional test that boots the ASPEED machines |
|||
# |
|||
# SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
import os |
|||
import time |
|||
import tempfile |
|||
import subprocess |
|||
|
|||
from aspeed import AspeedTest |
|||
from qemu_test import Asset |
|||
from qemu_test import exec_command_and_wait_for_pattern, skipIfMissingCommands |
|||
|
|||
|
|||
class AST2600Machine(AspeedTest): |
|||
|
|||
ASSET_BR2_202302_AST2600_TPM_FLASH = Asset( |
|||
('https://github.com/legoater/qemu-aspeed-boot/raw/master/' |
|||
'images/ast2600-evb/buildroot-2023.02-tpm/flash.img'), |
|||
'a46009ae8a5403a0826d607215e731a8c68d27c14c41e55331706b8f9c7bd997') |
|||
|
|||
def _test_arm_ast2600_evb_buildroot_tpm(self, tpmstate_dir): |
|||
image_path = self.ASSET_BR2_202302_AST2600_TPM_FLASH.fetch() |
|||
|
|||
socket = os.path.join(tpmstate_dir, 'swtpm-socket') |
|||
|
|||
# We must put the TPM state dir in /tmp/, not the build dir, |
|||
# because some distros use AppArmor to lock down swtpm and |
|||
# restrict the set of locations it can access files in. |
|||
subprocess.run(['swtpm', 'socket', '-d', '--tpm2', |
|||
'--tpmstate', f'dir={tpmstate_dir}', |
|||
'--ctrl', f'type=unixio,path={socket}'], |
|||
check=True) |
|||
|
|||
self.vm.add_args('-chardev', f'socket,id=chrtpm,path={socket}') |
|||
self.vm.add_args('-tpmdev', 'emulator,id=tpm0,chardev=chrtpm') |
|||
self.vm.add_args('-device', |
|||
'tpm-tis-i2c,tpmdev=tpm0,bus=aspeed.i2c.bus.12,address=0x2e') |
|||
self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00', 'Aspeed AST2600 EVB') |
|||
|
|||
exec_command_and_wait_for_pattern(self, |
|||
'echo tpm_tis_i2c 0x2e > /sys/bus/i2c/devices/i2c-12/new_device', |
|||
'tpm_tis_i2c 12-002e: 2.0 TPM (device-id 0x1, rev-id 1)') |
|||
exec_command_and_wait_for_pattern(self, |
|||
'cat /sys/class/tpm/tpm0/pcr-sha256/0', |
|||
'B804724EA13F52A9072BA87FE8FDCC497DFC9DF9AA15B9088694639C431688E0') |
|||
|
|||
self.do_test_arm_aspeed_buildroot_poweroff() |
|||
|
|||
@skipIfMissingCommands('swtpm') |
|||
def test_arm_ast2600_evb_buildroot_tpm(self): |
|||
self.set_machine('ast2600-evb') |
|||
with tempfile.TemporaryDirectory(prefix="qemu_") as tpmstate_dir: |
|||
self._test_arm_ast2600_evb_buildroot_tpm(tpmstate_dir) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
AspeedTest.main() |
|||
@ -0,0 +1,34 @@ |
|||
#!/usr/bin/env python3 |
|||
# |
|||
# Functional test that boots the ASPEED machines |
|||
# |
|||
# SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
from qemu_test import Asset |
|||
from aspeed import AspeedTest |
|||
|
|||
|
|||
class AST2600Machine(AspeedTest): |
|||
|
|||
ASSET_SDK_V1100_AST2600 = Asset( |
|||
'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2600-default-obmc.tar.gz', |
|||
'64d8926a7d01b649168be96c986603b5690f06391286c438a3a772c8c7039e93') |
|||
|
|||
def test_arm_ast2600_otp_blockdev_device(self): |
|||
self.vm.set_machine("ast2600-evb") |
|||
|
|||
image_path = self.archive_extract(self.ASSET_SDK_V1100_AST2600) |
|||
otp_img = self.generate_otpmem_image() |
|||
|
|||
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:") |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
AspeedTest.main() |
|||
Loading…
Reference in new issue