olofk / fusesocotb

Quick'n'dirty FuseSoC+cocotb example
18 stars 1 forks source link

Running single cocotb test case #4

Open stdefeber opened 2 weeks ago

stdefeber commented 2 weeks ago

Would it be possible to run a single test case from a module ?

In CoCoTb, a python module can contain multiple test cases. Debugging one such a test case seems impossible, without splitting a single file into multiple shorter ones, which will recompile and restart the simulator when in CI/CT over and over again.

The --testcase=<> option does not seems to work and is assumed icarus related.

vvp -n -M. -M cocotb-config --lib-dir -m cocotb-config --lib-name vpi icarus axis_send_packet_0 -fst +testcase=test_busy_cfg2 +vcd=1

Would it be possible to add a "cocotb_testcase" option in the flow_options ?

targets:
  default:
    flow: sim
    flow_options:
      tool : icarus
      cocotb_module : tc01
      cocotb_testcase : test_busy_cfg2

What seems supported:

export TESTCASE=test_busy_cfg2
poetry run fusesoc --verbose run axis_send_packet --MSG_LEN=11 --MSG_STR=hello_world --vcd
olofk commented 2 weeks ago

Adding a cocotb_testcase parameter is doable, but in the meantime you can do like you do already or run with TESTCASE=test_busy_cfg2 fusesoc run ... (which is what I do typically to have it all in one command)

stdefeber commented 2 weeks ago

Okay. Thanks for your answer.