[Buildroot] [PATCH] support/testing: test_edk2: add a few build tests

Vincent Stehlé vincent.stehle at arm.com
Fri Apr 11 15:53:14 UTC 2025


Some EDK II configurations have complex dependencies on several packages
and additional build options; build tests help keeping track of those
more easily.

Factorize some code common to all the build tests into a new
TestEdk2BuildBase class, which defines a base configuration and a method
to assert that binaries do indeed exist after the build.

While at it, add myself in DEVELOPERS.

Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
Cc: Dick Olsson <hi at senzilla.io>
---


Hi,

I will also send a build test for the MACCHIATObin platform later on,
after a couple of fixes have been integrated. [1][2]

Best regards,
Vincent.

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20250411125452.1377323-1-vincent.stehle@arm.com/
[2] https://patchwork.ozlabs.org/project/buildroot/patch/20250410153114.1374261-1-vincent.stehle@arm.com/


 DEVELOPERS                              |   1 +
 support/testing/tests/boot/test_edk2.py | 101 ++++++++++++++++++++++++
 2 files changed, 102 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 1c84f95943..1e6a029512 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3350,6 +3350,7 @@ F:	configs/qemu_aarch64_ebbr_defconfig
 F:	configs/qemu_arm_ebbr_defconfig
 F:	configs/rockpro64_ebbr_defconfig
 F:	package/edk2-non-osi/
+F:	support/testing/tests/boot/test_edk2.py
 
 N:	Vincent Stehlé <vincent.stehle at laposte.net>
 F:	board/arm/foundation-v8/
diff --git a/support/testing/tests/boot/test_edk2.py b/support/testing/tests/boot/test_edk2.py
index 90583b56fe..4e0942b3a4 100644
--- a/support/testing/tests/boot/test_edk2.py
+++ b/support/testing/tests/boot/test_edk2.py
@@ -48,3 +48,104 @@ class TestEdk2(infra.basetest.BRTest):
                                     "-pflash", flash1,
                                     "-hda", hda])
         self.emulator.login()
+
+
+class TestEdk2BuildBase(infra.basetest.BRTest):
+    """A class to test the build of various edk2 platforms."""
+    base_config = \
+        """
+        # BR2_PACKAGE_BUSYBOX is not set
+        # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_INIT_NONE=y
+        BR2_SYSTEM_BIN_SH_NONE=y
+        BR2_TARGET_EDK2=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        """
+
+    def assertBinariesExist(self, *binaries: str) -> None:
+        """Assert that the binaries passed as argument exist
+        under the images folder.
+        We print a message to the emulator logfile for each binary found.
+        """
+        for binary in binaries:
+            binpath = os.path.join(self.builddir, "images", binary)
+            self.assertTrue(os.path.exists(binpath), f"Missing {binpath}!")
+            print(f"{binary} exists: {binpath}", file=self.emulator.logfile,
+                  flush=True)
+
+
+class TestEdk2BuildArmVirtQemu(TestEdk2BuildBase):
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU=y
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
+
+
+class TestEdk2BuildArmVirtQemuKernel(TestEdk2BuildBase):
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL=y
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
+
+
+class TestEdk2BuildArmSgi575(TestEdk2BuildBase):
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_ARM_SGI575=y
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("BL33_AP_UEFI.fd")
+
+
+class TestEdk2BuildArmVexpressFvpAarch64(TestEdk2BuildBase):
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64=y
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("FVP_AARCH64_EFI.fd")
+
+
+class TestEdk2BuildSocionextDeveloperbox(TestEdk2BuildBase):
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="synquacer"
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS="PRELOADED_BL33_BASE=0x8200000"
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("SPI_NOR_IMAGE.fd", "fip.bin")
+
+
+class TestEdk2BuildQemuSbsa(TestEdk2BuildBase):
+    # This configuration is not exactly identical to the configuration built
+    # during TestEdk2, as we use the latest arm-trusted-firmware version, among
+    # other things.
+    config = TestEdk2BuildBase.base_config + \
+        """
+        BR2_aarch64=y
+        BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
+        """
+
+    def test_run(self) -> None:
+        self.assertBinariesExist("SBSA_FLASH0.fd", "SBSA_FLASH1.fd", "fip.bin")
-- 
2.47.2



More information about the buildroot mailing list