Browse Source

tests/functional: Split Aspeed ARM tests into separate files

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
Cédric Le Goater 2 months ago
parent
commit
6b1a1fc1d1
  1. 14
      tests/functional/arm/meson.build
  2. 0
      tests/functional/arm/test_aspeed_ast1060.py
  3. 14
      tests/functional/arm/test_aspeed_ast2500_buildroot.py
  4. 29
      tests/functional/arm/test_aspeed_ast2500_sdk.py
  5. 41
      tests/functional/arm/test_aspeed_ast2600_buildroot.py
  6. 60
      tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py
  7. 15
      tests/functional/arm/test_aspeed_ast2600_sdk.py
  8. 34
      tests/functional/arm/test_aspeed_ast2600_sdk_otp.py

14
tests/functional/arm/meson.build

@ -4,9 +4,12 @@ test_arm_timeouts = {
'aspeed_palmetto' : 120, 'aspeed_palmetto' : 120,
'aspeed_romulus' : 120, 'aspeed_romulus' : 120,
'aspeed_witherspoon' : 120, 'aspeed_witherspoon' : 120,
'aspeed_ast2500' : 720, 'aspeed_ast2500_sdk' : 720,
'aspeed_ast2600_buildroot' : 720, 'aspeed_ast2500_buildroot' : 480,
'aspeed_ast2600_sdk' : 1200, 'aspeed_ast2600_buildroot' : 480,
'aspeed_ast2600_buildroot_tpm' : 720,
'aspeed_ast2600_sdk' : 720,
'aspeed_ast2600_sdk_otp' : 720,
'aspeed_bletchley' : 480, 'aspeed_bletchley' : 480,
'aspeed_catalina' : 480, 'aspeed_catalina' : 480,
'aspeed_gb200nvl_bmc' : 480, 'aspeed_gb200nvl_bmc' : 480,
@ -32,9 +35,12 @@ tests_arm_system_thorough = [
'aspeed_palmetto', 'aspeed_palmetto',
'aspeed_romulus', 'aspeed_romulus',
'aspeed_witherspoon', 'aspeed_witherspoon',
'aspeed_ast2500', 'aspeed_ast2500_sdk',
'aspeed_ast2500_buildroot',
'aspeed_ast2600_buildroot', 'aspeed_ast2600_buildroot',
'aspeed_ast2600_buildroot_tpm',
'aspeed_ast2600_sdk', 'aspeed_ast2600_sdk',
'aspeed_ast2600_sdk_otp',
'aspeed_bletchley', 'aspeed_bletchley',
'aspeed_catalina', 'aspeed_catalina',
'aspeed_gb200nvl_bmc', 'aspeed_gb200nvl_bmc',

0
tests/functional/arm/test_aspeed_ast1060.py

14
tests/functional/arm/test_aspeed_ast2500.py → tests/functional/arm/test_aspeed_ast2500_buildroot.py

@ -37,20 +37,6 @@ class AST2500Machine(AspeedTest):
self.do_test_arm_aspeed_buildroot_poweroff() self.do_test_arm_aspeed_buildroot_poweroff()
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__': if __name__ == '__main__':
AspeedTest.main() AspeedTest.main()

29
tests/functional/arm/test_aspeed_ast2500_sdk.py

@ -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()

41
tests/functional/arm/test_aspeed_ast2600_buildroot.py

@ -11,7 +11,7 @@ import subprocess
from aspeed import AspeedTest from aspeed import AspeedTest
from qemu_test import Asset from qemu_test import Asset
from qemu_test import exec_command_and_wait_for_pattern, skipIfMissingCommands from qemu_test import exec_command_and_wait_for_pattern
class AST2600Machine(AspeedTest): class AST2600Machine(AspeedTest):
@ -61,45 +61,6 @@ class AST2600Machine(AspeedTest):
'0000000 ffaa ffff ffff ffff ffff ffff ffff ffff') '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff')
self.do_test_arm_aspeed_buildroot_poweroff() self.do_test_arm_aspeed_buildroot_poweroff()
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__': if __name__ == '__main__':
AspeedTest.main() AspeedTest.main()

60
tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py

@ -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()

15
tests/functional/arm/test_aspeed_ast2600_sdk.py

@ -70,21 +70,6 @@ class AST2600Machine(AspeedTest):
'/sbin/hwclock -f /dev/rtc1', year) '/sbin/hwclock -f /dev/rtc1', year)
self.do_ast2600_pcie_test() self.do_ast2600_pcie_test()
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__': if __name__ == '__main__':
AspeedTest.main() AspeedTest.main()

34
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py

@ -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…
Cancel
Save