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 2/4] test: py: add simple SMBIOS tests
Date: Thu, 18 Dec 2025 15:48:45 +0100	[thread overview]
Message-ID: <20251218144950.3068179-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251218144950.3068179-1-a.fatoum@pengutronix.de>

For configs that are bootable (meaning they are configured to start an
OS) and have the smbios feature enabled, let's verify that the kernel
has found the entry point and that it contains the "barebox" string.

We could do more extensive tests with dmidecode(1) and we should in
future, but we don't want to require its existence for the base check.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/py/test_linux_smbios.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 test/py/test_linux_smbios.py

diff --git a/test/py/test_linux_smbios.py b/test/py/test_linux_smbios.py
new file mode 100644
index 000000000000..d0c2b7ca5665
--- /dev/null
+++ b/test/py/test_linux_smbios.py
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+import pytest
+
+
+@pytest.mark.lg_feature(['bootable', 'smbios'])
+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")
+    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"
+
+
+@pytest.mark.lg_feature(['bootable', 'smbios'])
+def test_smbios_contains_barebox(shell):
+    """
+    Search raw SMBIOS/DMI tables for a barebox vendor string.
+    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")
+    assert len(stdout) > 0, "barebox not found in SMBIOS/DMI tables"
-- 
2.47.3




  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 EFI loader integration test Ahmad Fatoum
2025-12-18 14:48 ` [PATCH 1/4] test: py: strategy: add OS shell state Ahmad Fatoum
2025-12-18 14:48 ` Ahmad Fatoum [this message]
2025-12-18 14:48 ` [PATCH 3/4] test: py: add simple EFI loader integration test Ahmad Fatoum
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-3-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