def test_virtualprobe_dp(): """Test of virtual Debug Probe - Debug port access.""" virtual_probe = DebugProbeVirtual("ID", None) with pytest.raises(SPSDKDebugProbeNotOpenError): virtual_probe.coresight_reg_read(False, 0) with pytest.raises(SPSDKDebugProbeNotOpenError): virtual_probe.coresight_reg_write(False, 0, 0) virtual_probe.open() assert virtual_probe.coresight_reg_read(False, 0) == 0 virtual_probe.coresight_reg_write(False, 0, 1) assert virtual_probe.coresight_reg_read(False, 0) == 1 virtual_probe.coresight_reg_write(False, 0, 1) assert virtual_probe.coresight_reg_read(False, 0) == 1 virtual_probe.set_coresight_dp_substitute_data( {0: [2, 3, "Exception", "Invalid"]}) assert virtual_probe.coresight_reg_read(False, 0) == 2 assert virtual_probe.coresight_reg_read(False, 0) == 3 with pytest.raises(SPSDKDebugProbeError): assert virtual_probe.coresight_reg_read(False, 0) == 3 assert virtual_probe.coresight_reg_read(False, 0) == 1 assert virtual_probe.coresight_reg_read(False, 0) == 1 virtual_probe.dp_write_cause_exception() with pytest.raises(SPSDKDebugProbeTransferError): virtual_probe.coresight_reg_write(False, 0, 0)
def test_virtualprobe_dp(): vp = DebugProbeVirtual("ID", None) with pytest.raises(DebugProbeNotOpenError): vp.coresight_reg_read(False, 0) with pytest.raises(DebugProbeNotOpenError): vp.coresight_reg_write(False, 0, 0) vp.open() assert vp.coresight_reg_read(False, 0) == 0 vp.coresight_reg_write(False, 0, 1) assert vp.coresight_reg_read(False, 0) == 1 vp.coresight_reg_write(False, 0, 1) assert vp.coresight_reg_read(False, 0) == 1 vp.set_coresight_dp_substitute_data({0: [2, 3, "Exception", "Invalid"]}) assert vp.coresight_reg_read(False, 0) == 2 assert vp.coresight_reg_read(False, 0) == 3 with pytest.raises(DebugProbeError): assert vp.coresight_reg_read(False, 0) == 3 assert vp.coresight_reg_read(False, 0) == 1 assert vp.coresight_reg_read(False, 0) == 1 vp.dp_write_cause_exception() with pytest.raises(DebugProbeTransferError): vp.coresight_reg_write(False, 0, 0)