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.
Signed-off-by: Cédric Le Goater <[email protected]> --- tests/functional/arm/meson.build | 14 +++-- tests/functional/arm/test_aspeed_ast1060.py | 0 ...00.py => test_aspeed_ast2500_buildroot.py} | 14 ----- .../functional/arm/test_aspeed_ast2500_sdk.py | 29 +++++++++ .../arm/test_aspeed_ast2600_buildroot.py | 41 +------------ .../arm/test_aspeed_ast2600_buildroot_tpm.py | 60 +++++++++++++++++++ .../functional/arm/test_aspeed_ast2600_sdk.py | 15 ----- .../arm/test_aspeed_ast2600_sdk_otp.py | 34 +++++++++++ 8 files changed, 134 insertions(+), 73 deletions(-) mode change 100644 => 100755 tests/functional/arm/test_aspeed_ast1060.py rename tests/functional/arm/{test_aspeed_ast2500.py => test_aspeed_ast2500_buildroot.py} (74%) create mode 100755 tests/functional/arm/test_aspeed_ast2500_sdk.py create mode 100755 tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py create mode 100755 tests/functional/arm/test_aspeed_ast2600_sdk_otp.py diff --git a/tests/functional/arm/meson.build b/tests/functional/arm/meson.build index 1762a496049d..175a83a2acd7 100644 --- a/tests/functional/arm/meson.build +++ b/tests/functional/arm/meson.build @@ -4,9 +4,12 @@ test_arm_timeouts = { 'aspeed_palmetto' : 120, 'aspeed_romulus' : 120, 'aspeed_witherspoon' : 120, - 'aspeed_ast2500' : 720, - 'aspeed_ast2600_buildroot' : 720, - 'aspeed_ast2600_sdk' : 1200, + 'aspeed_ast2500_sdk' : 720, + 'aspeed_ast2500_buildroot' : 480, + 'aspeed_ast2600_buildroot' : 480, + 'aspeed_ast2600_buildroot_tpm' : 720, + 'aspeed_ast2600_sdk' : 720, + 'aspeed_ast2600_sdk_otp' : 720, 'aspeed_bletchley' : 480, 'aspeed_catalina' : 480, 'aspeed_gb200nvl_bmc' : 480, @@ -32,9 +35,12 @@ tests_arm_system_thorough = [ 'aspeed_palmetto', 'aspeed_romulus', 'aspeed_witherspoon', - 'aspeed_ast2500', + 'aspeed_ast2500_sdk', + 'aspeed_ast2500_buildroot', 'aspeed_ast2600_buildroot', + 'aspeed_ast2600_buildroot_tpm', 'aspeed_ast2600_sdk', + 'aspeed_ast2600_sdk_otp', 'aspeed_bletchley', 'aspeed_catalina', 'aspeed_gb200nvl_bmc', diff --git a/tests/functional/arm/test_aspeed_ast1060.py b/tests/functional/arm/test_aspeed_ast1060.py old mode 100644 new mode 100755 diff --git a/tests/functional/arm/test_aspeed_ast2500.py b/tests/functional/arm/test_aspeed_ast2500_buildroot.py similarity index 74% rename from tests/functional/arm/test_aspeed_ast2500.py rename to tests/functional/arm/test_aspeed_ast2500_buildroot.py index 5d75e20184d6..8196923ee04d 100755 --- a/tests/functional/arm/test_aspeed_ast2500.py +++ b/tests/functional/arm/test_aspeed_ast2500_buildroot.py @@ -37,20 +37,6 @@ def test_arm_ast2500_evb_buildroot(self): 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__': AspeedTest.main() diff --git a/tests/functional/arm/test_aspeed_ast2500_sdk.py b/tests/functional/arm/test_aspeed_ast2500_sdk.py new file mode 100755 index 000000000000..2c9211aeddc8 --- /dev/null +++ b/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() diff --git a/tests/functional/arm/test_aspeed_ast2600_buildroot.py b/tests/functional/arm/test_aspeed_ast2600_buildroot.py index 3d130b9fd189..cc5ab9796a5e 100755 --- a/tests/functional/arm/test_aspeed_ast2600_buildroot.py +++ b/tests/functional/arm/test_aspeed_ast2600_buildroot.py @@ -11,7 +11,7 @@ from aspeed import AspeedTest 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): @@ -61,45 +61,6 @@ def test_arm_ast2600_evb_buildroot(self): '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff') 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__': AspeedTest.main() diff --git a/tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py b/tests/functional/arm/test_aspeed_ast2600_buildroot_tpm.py new file mode 100755 index 000000000000..7ec996e9cf22 --- /dev/null +++ b/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() diff --git a/tests/functional/arm/test_aspeed_ast2600_sdk.py b/tests/functional/arm/test_aspeed_ast2600_sdk.py index 3485feaf2c39..46b9f7058c08 100755 --- a/tests/functional/arm/test_aspeed_ast2600_sdk.py +++ b/tests/functional/arm/test_aspeed_ast2600_sdk.py @@ -82,21 +82,6 @@ def test_arm_ast2600_evb_sdk(self): self.do_ast2600_pcie_test() self.do_ast2600_i3c_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__': AspeedTest.main() diff --git a/tests/functional/arm/test_aspeed_ast2600_sdk_otp.py b/tests/functional/arm/test_aspeed_ast2600_sdk_otp.py new file mode 100755 index 000000000000..4066532d5dec --- /dev/null +++ b/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() -- 2.53.0
