0

If I raise a TestError under cocotb test coroutine :

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

I know that error raised in test log, but I don't see the message "Wrong CRC value found":

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  **
                       ************************************************************************************

Is there a proper way to print the TestError message in log ?

FabienM
  • 3,421
  • 23
  • 45

2 Answers2

1

I would consider this a bug. Maybe you want to report it at https://github.com/potentialventures/cocotb/issues?

Activity in cocotb has picked quite a lot recently, so it will be worth reporting.

cmarqu
  • 493
  • 3
  • 10
0

The only solution I found currently is to print the message before raising TestError:

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

But maybe it's the thing to do?

cmarqu
  • 493
  • 3
  • 10
FabienM
  • 3,421
  • 23
  • 45