1# SPDX-License-Identifier: GPL-2.0-or-later
2
3"""Test smbios command"""
4
5import pytest
6
7@pytest.mark.buildconfigspec('cmd_smbios')
8@pytest.mark.notbuildconfigspec('qfw_smbios')
9@pytest.mark.notbuildconfigspec('sandbox')
10def test_cmd_smbios(u_boot_console):
11    """Run the smbios command"""
12    output = u_boot_console.run_command('smbios')
13    assert 'DMI type 127,' in output
14
15@pytest.mark.buildconfigspec('cmd_smbios')
16@pytest.mark.buildconfigspec('qfw_smbios')
17@pytest.mark.notbuildconfigspec('sandbox')
18# TODO:
19# QEMU v8.2.0 lacks SMBIOS support for RISC-V
20# Once support is available in our Docker image we can remove the constraint.
21@pytest.mark.notbuildconfigspec('riscv')
22def test_cmd_smbios_qemu(u_boot_console):
23    """Run the smbios command on QEMU"""
24    output = u_boot_console.run_command('smbios')
25    assert 'DMI type 1,' in output
26    assert 'Manufacturer: QEMU' in output
27    assert 'DMI type 127,' in output
28
29@pytest.mark.buildconfigspec('cmd_smbios')
30@pytest.mark.buildconfigspec('sandbox')
31def test_cmd_smbios_sandbox(u_boot_console):
32    """Run the smbios command on the sandbox"""
33    output = u_boot_console.run_command('smbios')
34    assert 'DMI type 0,' in output
35    assert 'String 1: U-Boot' in output
36    assert 'DMI type 1,' in output
37    assert 'Manufacturer: sandbox' in output
38    assert 'DMI type 2,' in output
39    assert 'DMI type 3,' in output
40    assert 'DMI type 4,' in output
41    assert 'DMI type 127,' in output
42