[Concept,10/25] test: Add more SMBIOS data to sandbox

Message ID 20250903133639.3235920-11-sjg@u-boot.org
State New
Headers
Series Selection of devicetree using CHIDs |

Commit Message

Simon Glass Sept. 3, 2025, 1:36 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Some common smbios settings are not included with sandbox. Add these to
test.dts so the data is more meaningful.

Update smbios tests to match the new devicetree values.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/dts/test.dts    | 24 ++++++++++++++++++++++++
 test/cmd/smbios.c            | 20 ++++++++++----------
 test/py/tests/test_smbios.py |  2 +-
 3 files changed, 35 insertions(+), 11 deletions(-)
  

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 1783a21894a..b79f06ce0fe 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1938,6 +1938,30 @@ 
 
 	sysinfo {
 		compatible = "sandbox,sysinfo-sandbox";
+
+		smbios {
+			/* Type 1 table */
+			system {
+				manufacturer = "Sandbox Corp";
+				product = "Sandbox Computer";
+				version = "1.0";
+				serial = "SB12345678";
+				sku = "SANDBOX-SKU";
+				family = "Sandbox_Family";
+			};
+
+			/* Type 2 table */
+			baseboard {
+				manufacturer = "Sandbox Boards";
+				product = "Sandbox Motherboard";
+				asset-tag = "SB-ASSET-001";
+			};
+
+			/* Type 3 table */
+			chassis {
+				manufacturer = "Sandbox Chassis Inc";
+			};
+		};
 	};
 
 	sysinfo-gpio {
diff --git a/test/cmd/smbios.c b/test/cmd/smbios.c
index e8ed38af2ed..69596dd1c45 100644
--- a/test/cmd/smbios.c
+++ b/test/cmd/smbios.c
@@ -43,22 +43,22 @@  static int cmd_smbios_test(struct unit_test_state *uts)
 	ut_assert_nextline_empty();
 	ut_assert_nextlinen("Handle 0x0001, DMI type 1, 27 bytes at");
 	ut_assert_nextline("System Information");
-	ut_assert_nextline("\tManufacturer: sandbox");
-	ut_assert_nextline("\tProduct Name: sandbox");
-	ut_assert_nextline("\tVersion: ");
-	ut_assert_nextline("\tSerial Number: ");
+	ut_assert_nextline("\tManufacturer: Sandbox Corp");
+	ut_assert_nextline("\tProduct Name: Sandbox Computer");
+	ut_assert_nextline("\tVersion: 1.0");
+	ut_assert_nextline("\tSerial Number: SB12345678");
 	ut_assert_nextline("\tUUID: 00000000-0000-0000-0000-000000000000");
 	ut_assert_nextline("\tWake-up Type: Unknown");
-	ut_assert_nextline("\tSKU Number: ");
-	ut_assert_nextline("\tFamily: ");
+	ut_assert_nextline("\tSKU Number: SANDBOX-SKU");
+	ut_assert_nextline("\tFamily: Sandbox_Family");
 	ut_assert_nextline_empty();
 	ut_assert_nextlinen("Handle 0x0002, DMI type 2, 15 bytes at");
 	ut_assert_nextline("Baseboard Information");
-	ut_assert_nextline("\tManufacturer: sandbox");
-	ut_assert_nextline("\tProduct Name: sandbox");
+	ut_assert_nextline("\tManufacturer: Sandbox Boards");
+	ut_assert_nextline("\tProduct Name: Sandbox Motherboard");
 	ut_assert_nextline("\tVersion: ");
 	ut_assert_nextline("\tSerial Number: ");
-	ut_assert_nextline("\tAsset Tag: ");
+	ut_assert_nextline("\tAsset Tag: SB-ASSET-001");
 	ut_assert_nextline("\tFeature Flags: 0x00");
 	ut_assert_nextline("\tChassis Location: ");
 	ut_assert_nextline("\tChassis Handle: 0x0003");
@@ -67,7 +67,7 @@  static int cmd_smbios_test(struct unit_test_state *uts)
 	ut_assert_nextline_empty();
 	ut_assert_nextlinen("Handle 0x0003, DMI type 3, 22 bytes at");
 	ut_assert_nextline("Baseboard Information");
-	ut_assert_nextline("\tManufacturer: ");
+	ut_assert_nextline("\tManufacturer: Sandbox Chassis Inc");
 	ut_assert_nextline("\tType: 0x02");
 	ut_assert_nextline("\tVersion: ");
 	ut_assert_nextline("\tSerial Number: ");
diff --git a/test/py/tests/test_smbios.py b/test/py/tests/test_smbios.py
index 3b85a7cc661..eea2c934893 100644
--- a/test/py/tests/test_smbios.py
+++ b/test/py/tests/test_smbios.py
@@ -34,7 +34,7 @@  def test_cmd_smbios_sandbox(ubman):
     assert 'DMI type 0,' in output
     assert 'Vendor: U-Boot' in output
     assert 'DMI type 1,' in output
-    assert 'Manufacturer: sandbox' in output
+    assert 'Manufacturer: Sandbox Corp' in output
     assert 'DMI type 2,' in output
     assert 'DMI type 3,' in output
     assert 'DMI type 4,' in output