Buildroot Archive mirror
 help / color / mirror / Atom feed
From: Julien Olivain <ju.o@free.fr>
To: buildroot@buildroot.org
Cc: Julien Olivain <ju.o@free.fr>
Subject: [Buildroot] [PATCH 1/1] support/testing: add fwts runtime test
Date: Sat, 20 Apr 2024 15:28:17 +0200	[thread overview]
Message-ID: <20240420132817.1352847-1-ju.o@free.fr> (raw)

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                 |  1 +
 support/testing/tests/package/test_fwts.py | 67 ++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 support/testing/tests/package/test_fwts.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..a790a8c108d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1789,6 +1789,7 @@ F:	support/testing/tests/package/test_file/
 F:	support/testing/tests/package/test_fluidsynth.py
 F:	support/testing/tests/package/test_fluidsynth/
 F:	support/testing/tests/package/test_fping.py
+F:	support/testing/tests/package/test_fwts.py
 F:	support/testing/tests/package/test_gawk.py
 F:	support/testing/tests/package/test_ghostscript.py
 F:	support/testing/tests/package/test_ghostscript/
diff --git a/support/testing/tests/package/test_fwts.py b/support/testing/tests/package/test_fwts.py
new file mode 100644
index 00000000000..ef792136c22
--- /dev/null
+++ b/support/testing/tests/package/test_fwts.py
@@ -0,0 +1,67 @@
+import os
+
+import infra.basetest
+
+
+class TestFwts(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_aarch64=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_4=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_TARGET_ROOTFS_EXT2_SIZE="128M"
+        BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/aarch64-sbsa/assemble-flash-images support/scripts/genimage.sh"
+        BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/aarch64-sbsa/genimage.cfg"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.28"
+        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+        BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+        BR2_TARGET_EDK2=y
+        BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
+        BR2_TARGET_GRUB2=y
+        BR2_TARGET_GRUB2_ARM64_EFI=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.9"
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
+        BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
+        BR2_PACKAGE_FWTS=y
+        BR2_PACKAGE_FWTS_EFI_RUNTIME_MODULE=y
+        BR2_PACKAGE_HOST_GENIMAGE=y
+        BR2_PACKAGE_HOST_DOSFSTOOLS=y
+        BR2_PACKAGE_HOST_MTOOLS=y
+        """
+
+    def test_run(self):
+        hda = os.path.join(self.builddir, "images", "disk.img")
+        flash0 = os.path.join(self.builddir, "images", "SBSA_FLASH0.fd")
+        flash1 = os.path.join(self.builddir, "images", "SBSA_FLASH1.fd")
+        self.emulator.boot(arch="aarch64",
+                           options=["-M", "sbsa-ref",
+                                    "-cpu", "cortex-a57",
+                                    "-m", "512M",
+                                    "-pflash", flash0,
+                                    "-pflash", flash1,
+                                    "-hda", hda])
+        self.emulator.login()
+
+        # Check the program can execute.
+        self.assertRunOk("fwts --version")
+
+        # We run a simple UEFI runtime service variable interface test
+        # suite. Those tests are using the fwts efi_runtime kernel
+        # module.
+        self.assertRunOk("fwts -q uefirtvariable", timeout=30)
+
+        # The previous fwts invocation is expected to have created a
+        # "results.log" report. We check the file exists and contains
+        # a known header string.
+        expected_str = "Results generated by fwts:"
+        cmd = f"grep -F '{expected_str}' results.log"
+        out, ret = self.emulator.run(cmd)
+        self.assertEqual(ret, 0)
+        self.assertTrue(out[0].startswith(expected_str))
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2024-04-20 13:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20 13:28 Julien Olivain [this message]
2024-05-01 19:57 ` [Buildroot] [PATCH 1/1] support/testing: add fwts runtime test Thomas Petazzoni via buildroot
2024-05-16 11:02 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240420132817.1352847-1-ju.o@free.fr \
    --to=ju.o@free.fr \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).