CIRCT 23.0.0git
Loading...
Searching...
No Matches
Functions | Variables
tests.integration.conftest Namespace Reference

Functions

None require_tool (str tool)
 
str require_env (str var_name)
 
str run_cmd (cmd, **kwargs)
 
None check_lines (str stdout, list[str] expected)
 
Path build_cpp_test (Path sources_dir, str target, str header_subdir, Optional[str] build_subdir=None)
 
str run_probe (Path binary, str host, int port, str probe, Optional[list[str]] expected=None)
 

Variables

 _logger = logging.getLogger(__name__)
 
 ROOT_DIR = Path(__file__).resolve().parent
 
str HW_DIR = ROOT_DIR / "hw"
 
str SW_DIR = ROOT_DIR / "sw"
 

Function Documentation

◆ build_cpp_test()

Path tests.integration.conftest.build_cpp_test ( Path  sources_dir,
str  target,
str  header_subdir,
Optional[str]   build_subdir = None 
)
Configure + build a C++ integration test target, returning the binary.

* ``sources_dir``: root provided by ``cosim_test`` (contains ``generated/``).
* ``target``: CMake target name (e.g. ``loopback_test``).
* ``header_subdir``: subdirectory under the include root where the generated
  headers are copied (e.g. ``"loopback"`` or ``"test_codegen"``).
* ``build_subdir``: name for the build directory under ``sources_dir``.
  Defaults to ``target``.

The configure step is skipped when the build directory already exists;
``cmake --build`` always runs so that CMake's own dependency tracking
picks up any source or generated-header changes.

Definition at line 65 of file conftest.py.

◆ check_lines()

None tests.integration.conftest.check_lines ( str  stdout,
list[str]  expected 
)
Assert that every expected substring appears in stdout in order.

Definition at line 50 of file conftest.py.

◆ require_env()

str tests.integration.conftest.require_env ( str  var_name)

Definition at line 30 of file conftest.py.

◆ require_tool()

None tests.integration.conftest.require_tool ( str  tool)

Definition at line 25 of file conftest.py.

◆ run_cmd()

str tests.integration.conftest.run_cmd (   cmd,
**  kwargs 
)
Run a command, capture stdout, and return it. Raises on failure.

Definition at line 37 of file conftest.py.

◆ run_probe()

str tests.integration.conftest.run_probe ( Path  binary,
str  host,
int  port,
str  probe,
Optional[list[str]]   expected = None 
)
Invoke ``binary --probe <probe>`` and assert it prints ``<probe> ok``.

If *expected* is given, those substrings are checked (in order) against
stdout instead of the default ``["<probe> ok"]``.

Returns the captured stdout for further assertions if needed.

Definition at line 134 of file conftest.py.

Variable Documentation

◆ _logger

tests.integration.conftest._logger = logging.getLogger(__name__)
protected

Definition at line 16 of file conftest.py.

◆ HW_DIR

str tests.integration.conftest.HW_DIR = ROOT_DIR / "hw"

Definition at line 19 of file conftest.py.

◆ ROOT_DIR

tests.integration.conftest.ROOT_DIR = Path(__file__).resolve().parent

Definition at line 18 of file conftest.py.

◆ SW_DIR

str tests.integration.conftest.SW_DIR = ROOT_DIR / "sw"

Definition at line 20 of file conftest.py.