add a function to print an aditional message

with automatic formating depending on the output format

Signed-off-by: Friedrich Schwedler <fschwedler@emlix.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Friedrich Schwedler 2024-03-13 11:02:56 +01:00 committed by Andreas Schneider
parent f9e5b1fa3b
commit 9fd057cc71
1 changed files with 12 additions and 0 deletions

View File

@ -226,6 +226,7 @@ typedef struct CheckMemoryData {
size_t size;
} CheckMemoryData;
void _additional_msg(const char * const msg);
static ListNode* list_initialize(ListNode * const node);
static ListNode* list_add(ListNode * const head, ListNode *new_node);
static ListNode* list_add_value(ListNode * const head, const void *value,
@ -2877,6 +2878,17 @@ static void fail_if_blocks_allocated(const ListNode * const check_point,
}
}
void _additional_msg(const char * const msg) {
uint32_t output = cm_get_output();
if (output & CM_OUTPUT_STANDARD) {
cmocka_print_error("[ ] --- %s\n", msg);
}
if ((output & CM_OUTPUT_SUBUNIT) || (output & CM_OUTPUT_TAP) ||
(output & CM_OUTPUT_XML)) {
cmocka_print_error("%s\n", msg);
}
}
void _fail(const char * const file, const int line) {
uint32_t output = cm_get_output();