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

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat Apr 19 16:37:41 UTC 2025


commit: https://git.buildroot.net/buildroot/commit/?id=4f7e3f0bdd9200303f5dfc717d9dc45e8c1875d3
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 DEVELOPERS                              |   1 +
 support/testing/tests/boot/test_edk2.py | 101 ++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 5ac9a477ec..3a2797d7ec 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3351,6 +3351,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")


More information about the buildroot mailing list