mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/3] test: py: linux: use utilities available in Debian netinstall images
Date: Fri, 13 Feb 2026 11:35:56 +0100	[thread overview]
Message-ID: <20260213103626.2807840-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260213103626.2807840-1-a.fatoum@pengutronix.de>

The Debian CDROMs for netinstall on ARM64 don't have journalctl (no
systemd) and no stat or strings.

Adapt the tests we have to use the commands available within the busybox
included on the CDROM images.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/py/test_linux_efiloader.py | 19 +++++++++----------
 test/py/test_linux_smbios.py    | 11 ++++++-----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/test/py/test_linux_efiloader.py b/test/py/test_linux_efiloader.py
index b9ea82d27c0d..385f3fde4c30 100644
--- a/test/py/test_linux_efiloader.py
+++ b/test/py/test_linux_efiloader.py
@@ -4,13 +4,11 @@ import re
 import pytest
 
 
-def get_journalctl(shell, kernel=True, grep=None):
-    opts = ''
+def get_dmesg(shell, grep=None):
+    cmd = 'dmesg'
     if grep is not None:
-        opts += f" --grep={grep}"
-    if kernel:
-        opts += " -k"
-    stdout, _, ret = shell.run(f"journalctl --no-pager {opts} -o cat")
+        cmd += f" | grep '{grep}'"
+    stdout, _, ret = shell.run(cmd)
     assert ret == 0
     return stdout
 
@@ -56,11 +54,11 @@ def test_boot_manual_with_initrd(strategy, barebox, env, efiloader):
         shell.run_check("grep -q apparmor=0 /proc/cmdline")
 
         initrd_freed = any("Freeing initrd memory"
-                           in line for line in get_journalctl(shell, 'initrd'))
+                           in line for line in get_dmesg(shell, 'initrd'))
         assert initrd_freed, "initrd was not loaded or freed"
 
         # Verify we booted to shell
-        dmesg = get_journalctl(shell, 'efi')
+        dmesg = get_dmesg(shell, 'efi')
 
         uefi_not_found = re.search("efi: UEFI not found.",
                                    "\n".join(dmesg)) is not None
@@ -81,14 +79,14 @@ def test_boot_manual_with_initrd(strategy, barebox, env, efiloader):
 
 @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")
+    stdout, stderr, ret = shell.run("dmesg -r | grep '<[0-4]>.*\\<efi\\>'")
     assert stdout == []
     assert stderr == []
 
 
 @pytest.mark.lg_feature(['bootable', 'efi'])
 def test_expected_efi_messages(shell, env):
-    dmesg = get_journalctl(shell, 'efi')
+    dmesg = get_dmesg(shell, 'efi')
 
     expected_patterns = [
         r"efi:\s+EFI v2\.8 by barebox",
@@ -122,6 +120,7 @@ def test_efi_systab(shell, env):
 @pytest.mark.lg_feature(['bootable', 'efi'])
 def test_efivars_filesystem_not_empty(shell):
     # Directory must not be empty
+    shell.run("mount -t efivarfs efivarfs /sys/firmware/efi/efivars")
     stdout, _, ret = shell.run("ls -1 /sys/firmware/efi/efivars")
     assert ret == 0
 
diff --git a/test/py/test_linux_smbios.py b/test/py/test_linux_smbios.py
index d0c2b7ca5665..97a6ae3c80a4 100644
--- a/test/py/test_linux_smbios.py
+++ b/test/py/test_linux_smbios.py
@@ -8,15 +8,16 @@ def test_smbios3_tables_present(shell):
     _, _, ret = shell.run("test -e /sys/firmware/dmi/tables/smbios_entry_point")
     assert ret == 0, "SMBIOS entry point not found"
 
-    [stdout], _, ret = shell.run("stat -c '%s' /sys/firmware/dmi/tables/DMI")
+    [stdout], _, ret = shell.run("wc -c </sys/firmware/dmi/tables/DMI")
     assert ret == 0
 
     size = int(stdout)
     assert size > 0, "SMBIOS DMI table is empty"
 
-    [stdout], _, ret = shell.run("dd if=/sys/firmware/dmi/tables/smbios_entry_point bs=1 count=5 2>/dev/null")
-    assert ret == 0
-    assert stdout == "_SM3_", "SMBIOS entry point is not SMBIOS 3.x"
+    shell.run_check("echo _SM3_ >/tmp/sm3")
+    stdout, _, ret = shell.run("cmp --bytes 5 /tmp/sm3 /sys/firmware/dmi/tables/smbios_entry_point")
+    assert stdout == []
+    assert ret == 0, "SMBIOS entry point is not SMBIOS 3.x"
 
 
 @pytest.mark.lg_feature(['bootable', 'smbios'])
@@ -26,5 +27,5 @@ def test_smbios_contains_barebox(shell):
     This avoids dmidecode and relies on simple string matching.
     """
     # The DMI table is binary; strings are still ASCII embedded
-    stdout, _, ret = shell.run("strings /sys/firmware/dmi/tables/DMI | grep -i barebox")
+    stdout, _, ret = shell.run("grep -a barebox /sys/firmware/dmi/tables/DMI")
     assert len(stdout) > 0, "barebox not found in SMBIOS/DMI tables"
-- 
2.47.3




  reply	other threads:[~2026-02-13 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 10:35 [PATCH 0/3] test: test boot with Debian netinstaller CDROM image Ahmad Fatoum
2026-02-13 10:35 ` Ahmad Fatoum [this message]
2026-02-13 10:35 ` [PATCH 2/3] " Ahmad Fatoum
2026-02-13 10:35 ` [PATCH 3/3] test: py: linux: remove test_ prefix for intermediate functions 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=20260213103626.2807840-2-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