unittest: use test.h setup hook to setup logging

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-04-28 18:06:33 +01:00
parent e5e618fb50
commit c5e58da1ba
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
2 changed files with 8 additions and 3 deletions

View File

@ -416,9 +416,6 @@ c2_lptr_t *c2_parse(c2_lptr_t **pcondlst, const char *pattern, void *data) {
}
TEST_CASE(c2_parse) {
log_init_tls();
// log_add_target_tls(stderr_logger_new());
char str[1024];
c2_lptr_t *cond = c2_parse(NULL, "name = \"xterm\"", NULL);
struct atom *atoms = init_mock_atoms();

View File

@ -2888,3 +2888,11 @@ int PICOM_MAIN(int argc, char **argv) {
return ret_code;
}
#ifdef UNIT_TEST
static void unittest_setup(void) {
log_init_tls();
// log_add_target_tls(stderr_logger_new());
}
void (*test_h_unittest_setup)(void) = unittest_setup;
#endif