From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/4] test: py: add simple EFI loader integration test
Date: Thu, 18 Dec 2025 15:48:46 +0100 [thread overview]
Message-ID: <20251218144950.3068179-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251218144950.3068179-1-a.fatoum@pengutronix.de>
Boot into a Linux image (assumes journald) and check that the system was
UEFI booted by barebox.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
test/py/test_linux_efiloader.py | 59 +++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 test/py/test_linux_efiloader.py
diff --git a/test/py/test_linux_efiloader.py b/test/py/test_linux_efiloader.py
new file mode 100644
index 000000000000..22531bff81f4
--- /dev/null
+++ b/test/py/test_linux_efiloader.py
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+import re
+import pytest
+
+
+def get_dmesg(shell):
+ stdout, _, ret = shell.run("journalctl -k --no-pager --grep efi -o cat")
+ assert ret == 0
+ return stdout
+
+
+@pytest.mark.lg_feature(['bootable', 'efi'])
+def test_efi_kernel_no_warn(shell):
+ stdout, stderr, ret = shell.run("journalctl -k --no-pager --grep efi -o cat -p warning")
+ assert stdout == []
+ assert stderr == []
+
+
+@pytest.mark.lg_feature(['bootable', 'efi'])
+def test_expected_efi_messages(shell, env):
+ dmesg = get_dmesg(shell)
+
+ expected_patterns = [
+ r"efi:\s+EFI v2\.8 by barebox",
+ r"Remapping and enabling EFI services\.",
+ r"efivars:\s+Registered efivars operations",
+ ]
+
+ for pattern in expected_patterns:
+ assert re.search(pattern, "\n".join(dmesg)), \
+ f"Missing expected EFI message: {pattern}"
+
+
+@pytest.mark.lg_feature(['bootable', 'efi'])
+def test_efi_systab(shell, env):
+ stdout, stderr, ret = shell.run("cat /sys/firmware/efi/systab")
+ assert ret == 0
+ assert stderr == []
+ assert len(stdout) > 0
+
+ expected_patterns = [
+ ]
+
+ if 'smbios' in env.get_target_features():
+ expected_patterns.append(r"SMBIOS3=")
+
+ for pattern in expected_patterns:
+ assert re.search(pattern, "\n".join(stdout)), \
+ f"Missing expected entry in systab : {pattern}"
+
+
+@pytest.mark.lg_feature(['bootable', 'efi'])
+def test_efivars_filesystem_not_empty(shell):
+ # Directory must not be empty
+ stdout, _, ret = shell.run("ls -1 /sys/firmware/efi/efivars")
+ assert ret == 0
+
+ assert len(stdout), "EFI variables directory is empty"
--
2.47.3
next prev parent reply other threads:[~2025-12-18 14:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 14:48 [PATCH 0/4] efi: add " Ahmad Fatoum
2025-12-18 14:48 ` [PATCH 1/4] test: py: strategy: add OS shell state Ahmad Fatoum
2025-12-18 14:48 ` [PATCH 2/4] test: py: add simple SMBIOS tests Ahmad Fatoum
2025-12-18 14:48 ` Ahmad Fatoum [this message]
2025-12-18 14:48 ` [PATCH 4/4] test: arm: add Labgrid env YAML for multi_v8_efiloader_defconfig Ahmad Fatoum
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=20251218144950.3068179-4-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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