|
cmocka 2.0.0
Unit testing library with mock support
|
Control test output formats and execution behavior. More...
Data Structures | |
| struct | CMCallbacks |
Enumerations | |
| enum | cm_message_output { CM_OUTPUT_STANDARD = 0x00000001 , CM_OUTPUT_STDOUT = 0x00000001 , CM_OUTPUT_SUBUNIT = 0x00000002 , CM_OUTPUT_TAP = 0x00000004 , CM_OUTPUT_XML = 0x00000008 } |
| Output format options for test results. More... | |
Functions | |
| void | print_message (const char *const format,...) CMOCKA_PRINTF_ATTRIBUTE(1 |
| void void | print_error (const char *const format,...) CMOCKA_PRINTF_ATTRIBUTE(1 |
| void void void | vprint_message (const char *const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1 |
| void void void void | vprint_error (const char *const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1 |
| void | cmocka_set_callbacks (const struct CMCallbacks *f_callbacks) |
| Set callback functions for CMocka. | |
| void | cm_print_error (const char *const format,...) |
| void | cmocka_print_error (const char *const format,...) CMOCKA_PRINTF_ATTRIBUTE(1 |
| Print error message using the cmocka output format. | |
| void void | cmocka_set_message_output (uint32_t output) |
| Function to set the output format for a test. | |
| void | cmocka_set_test_filter (const char *pattern) |
| Set a pattern to only run the test matching the pattern. | |
| void | cmocka_set_skip_filter (const char *pattern) |
| Set a pattern to skip tests matching the pattern. | |
Control test output formats and execution behavior.
Configure test execution behavior and output formatting.
This module provides functions to customize CMocka's behavior, including setting custom output callbacks, controlling output format (STANDARD, SUBUNIT, TAP, XML), and filtering which tests to run or skip.
| enum cm_message_output |
Output format options for test results.
These are bitfield flags that can be combined using bitwise OR to enable multiple output formats simultaneously.
| void cm_print_error | ( | const char *const | format, |
| ... ) |
| void cmocka_print_error | ( | const char *const | format, |
| ... ) |
Print error message using the cmocka output format.
This prints an error message using the message output defined by the environment variable CMOCKA_MESSAGE_OUTPUT or cmocka_set_message_output().
| format | The format string fprintf(3) uses. |
| ... | The parameters used to fill format. |
| void cmocka_set_callbacks | ( | const struct CMCallbacks * | f_callbacks | ) |
Set callback functions for CMocka.
Input is a structure containing function pointers to one or more user-supplied callback functions. A NULL pointer for a particular callback will set that callback to the default implementation.
See the CMCallbacks documentation for details of each callback.
| [in] | f_callbacks | A structure containing the user callbacks to use. |
| void void cmocka_set_message_output | ( | uint32_t | output | ) |
Function to set the output format for a test.
The output format(s) for the test can either be set globally using this function or overwritten with environment variable CMOCKA_MESSAGE_OUTPUT.
The environment variable can be set to STANDARD, SUBUNIT, TAP or XML. Multiple outputs separated with comma are permitted. (e.g. export CMOCKA_MESSAGE_OUTPUT=STANDARD,XML)
| [in] | output | The output format from cm_message_output to use for the test. For multiple outputs OR options together. |
| void cmocka_set_skip_filter | ( | const char * | pattern | ) |
Set a pattern to skip tests matching the pattern.
This allows to filter tests and skip the ones matching the pattern. The pattern can include two wildcards. The first is '*', a wildcard that matches zero or more characters, or '?', a wildcard that matches exactly one character.
The same can also be achieved by setting the environment variable CMOCKA_SKIP_FILTER, without needing to recompile the application.
| [in] | pattern | The pattern to match, e.g. "test_wurst*" |
| void cmocka_set_test_filter | ( | const char * | pattern | ) |
Set a pattern to only run the test matching the pattern.
This allows to filter tests and only run the ones matching the pattern. The pattern can include two wildcards. The first is '*', a wildcard that matches zero or more characters, or '?', a wildcard that matches exactly one character.
The same can also be achieved by setting the environment variable CMOCKA_TEST_FILTER, without needing to recompile the application.
| [in] | pattern | The pattern to match, e.g. "test_wurst*" |