1# SPDX-License-Identifier: GPL-2.0+
2# Copyright (c) 2021, Asherah Connor <ashe@kivikakk.ee>
3
4# Test qfw command implementation
5
6import pytest
7
8@pytest.mark.buildconfigspec('cmd_qfw')
9def test_qfw_cpus(u_boot_console):
10    "Test QEMU firmware config reports the CPU count."
11
12    output = u_boot_console.run_command('qfw cpus')
13    # The actual number varies depending on the board under test, so only
14    # assert a non-zero output.
15    assert 'cpu(s) online' in output
16    assert '0 cpu(s) online' not in output
17
18@pytest.mark.buildconfigspec('cmd_qfw')
19def test_qfw_list(u_boot_console):
20    "Test QEMU firmware config lists devices."
21
22    output = u_boot_console.run_command('qfw list')
23    # Assert either:
24    # 1) 'test-one', from the sandbox driver, or
25    # 2) 'bootorder', found in every real QEMU implementation.
26    assert ("bootorder" in output) or ("test-one" in output)
27