cocotb_tests
add_cocotb_tests(IP_LIB DIRECTORY)
This function scans a given directory for cocotb test subdirectories and registers each as a CTest, with support for both simple and multi-testcase cocotb test configurations.
Multi-testcase tests are auto-numbered into single CTest and a check target is created to run all the different tests.
Each test subdirectory's CMakeLists.txt is expected to set the following variables in PARENT_SCOPE to register a test:
COCOTB_MODULE(required): name of the test, used as the CTest name.COCOTB_SIM_RUN_CMD(required): command used to run the simulation.COCOTB_SIM_BUILD_DEP(required): build target(s) the simulation run depends on.COCOTB_DESCRIPTION(optional): human readable description, shown in the summary message.COCOTB_PYTHONPATH(optional):PYTHONPATHenvironment variable for the test.COCOTB_TESTCASE(optional): number of test cases to register (from 1 to N). If unset, a single CTest is registered.
If a subdirectory does not set COCOTB_MODULE, it is silently skipped (no test registered for it).
Parameters
| Name | Type | Description |
|---|---|---|
IP_LIB | string | The target IP library, it needs to have SOURCES property set with a list of SystemVerilog files. |
DIRECTORY | path string | Path to the directory containing the cocotb test subdirectories to scan. Subdirectories prefixed with _ are excluded. |