|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Test output capture helper. More...
Go to the source code of this file.
Functions | |
| void | tc_capture_start (void) |
| Start capturing test output. | |
| void | tc_capture_stop (void) |
| Stop capturing test output. | |
| bool | tc_capture_contains (const char *substr) |
| Check whether the captured output contains a substring. | |
| size_t | tc_capture_get (char *dst, size_t size) |
| Copy the captured output into a caller-provided buffer. | |
| void | tc_capture_clear (void) |
| Discard any captured output without stopping capture. | |
Test output capture helper.
Captures the textual diagnostic output produced during a test into an in-memory buffer so it can be asserted on, without each test having to wire up its own log backend or printk hook. Both output routes are handled transparently:
CONFIG_LOG_MODE_MINIMAL, which is routed through printk) is captured by wrapping the printk character-output hook.CONFIG_LOG with a real backend mode) is captured through a dedicated log backend.Typical use:
CONFIG_LOG_MODE_IMMEDIATE (or otherwise flush the logs) so deferred messages are not missed. | void tc_capture_clear | ( | void | ) |
Discard any captured output without stopping capture.
| bool tc_capture_contains | ( | const char * | substr | ) |
| size_t tc_capture_get | ( | char * | dst, |
| size_t | size ) |
Copy the captured output into a caller-provided buffer.
The copy is always NUL-terminated (unless size is 0) and is truncated to fit size.
| dst | Destination buffer. |
| size | Size of dst in bytes. |
| void tc_capture_start | ( | void | ) |
Start capturing test output.
Clears any previously captured data and begins recording printk and logging output into the internal capture buffer. Capturing continues until tc_capture_stop() is called. Output is still forwarded to the normal console so ordinary test logs are unaffected.
| void tc_capture_stop | ( | void | ) |
Stop capturing test output.
Restores the normal output path. The captured data remains available for inspection with tc_capture_contains() and tc_capture_get() until the next tc_capture_start() or tc_capture_clear().