示例#1
0
def test_efuse_read_once(caplog):
    caplog.set_level(100_000)
    runner = CliRunner()
    cmd = '-p super-com efuse-read-once 100'
    with patch('spsdk.mboot.interfaces.uart.Serial', SerialProxy.init_proxy(data_responses)):
        result = runner.invoke(blhost.main, cmd.split())
        assert result.exit_code == 0
        assert 'Response word 1 = 4 (0x4)' in result.output
        assert 'Response word 2 = 0 (0x0)' in result.output
示例#2
0
def test_get_property(caplog):
    # There's a problem with logging under CliRunner
    # https://github.com/pytest-dev/pytest/issues/3344
    # caplog is set to disable all loging output
    # Comment the folowing line to see logging info, however there will be an failure
    caplog.set_level(100_000)
    runner = CliRunner()
    cmd = '-p super-com get-property 1'
    with patch('spsdk.mboot.interfaces.uart.Serial', SerialProxy.init_proxy(data_responses)):
        result = runner.invoke(blhost.main, cmd.split())
        assert result.exit_code == 0
        assert 'Current Version = K3.0.0' in result.output
示例#3
0
def test_get_property(caplog):
    # There's a problem with logging under CliRunner
    # https://github.com/pytest-dev/pytest/issues/3344
    # caplog is set to disable all loging output
    # Comment the folowing line to see logging info, however there will be an failure
    caplog.set_level(100_000)
    runner = CliRunner()
    cmd = "-p com12 error-status"
    with patch("spsdk.sdp.interfaces.uart.Serial",
               SerialProxy.init_proxy(data_responses)):
        result = runner.invoke(sdphost.main, cmd.split())
        assert result.exit_code == 0
        assert "Response status = 4042322160 (0xf0f0f0f0) HAB Success." in result.output
示例#4
0
def run_blhost_proxy(caplog,
                     cmd,
                     expect_exit_code: int = 0,
                     ignore_ack: bool = False):
    # There's a problem with logging under CliRunner
    # https://github.com/pytest-dev/pytest/issues/3344
    # caplog is set to disable all loging output
    # Comment the folowing line to see logging info, however there will be an failure
    caplog.set_level(100_000)
    runner = CliRunner()
    with patch(
            "spsdk.mboot.interfaces.uart.Serial",
            SerialProxy.init_proxy(data_responses, ignore_ack=ignore_ack),
    ):
        result = runner.invoke(blhost.main, cmd.split())
        assert result.exit_code == expect_exit_code
    return result