首页 > 解决方案 > 如何打印 Cocotb 中引发的 TestError 的内容

问题描述

如果我在 cocotb 测试协程下引发 TestError :

@cocotb.test()
def double_cmd(dut):
    ...
    raise TestError("Wrong CRC value found")

我知道测试日志中出现了错误,但我没有看到“找到错误的 CRC 值”的消息:

12580176.01ns ERROR    Test Failed: double_cmd (result was TestError)
12580176.01ns ERROR    Failed 1 out of 1 tests (3 skipped)
12580176.01ns INFO     ************************************************************************************
                       ** TEST                        PASS/FAIL  SIM TIME(NS)  REAL TIME(S)  RATIO(NS/S) **
                       ************************************************************************************
                       ** test_laser_com.simple_test     N/A            0.00          0.00         0.00  **
                       ** test_laser_com.wrong_crc       N/A            0.00          0.00         0.00  **
                       ** test_laser_com.gas_cmd         N/A            0.00          0.00         0.00  **
                       ** test_laser_com.double_cmd     FAIL     12580176.01         14.41    872921.37  **
                       ************************************************************************************

是否有正确的方法在日志中打印 TestError 消息?

标签: pythoncocotb

解决方案


我会认为这是一个错误。也许您想在https://github.com/potentialventures/cocotb/issues报告它?

cocotb 的活动最近非常活跃,因此值得报告。


推荐阅读