[PATCH 2/4] test: py: add simple SMBIOS tests
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Dec 18 06:48:45 PST 2025
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 at 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
+
+
+ at 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"
+
+
+ at 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
More information about the barebox
mailing list