Add LL_NONE test
This commit is contained in:
@@ -410,6 +410,64 @@ START_TEST (test_logfile_dest_mask)
|
|||||||
fail_if(st.st_size != 14*2, "was %ld\n", (long)st.st_size);
|
fail_if(st.st_size != 14*2, "was %ld\n", (long)st.st_size);
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (test_loglevel_module_none)
|
||||||
|
|
||||||
|
struct uc_log_module m = {
|
||||||
|
.id = 0,
|
||||||
|
.short_name = "MOD1",
|
||||||
|
.long_name = "Module 1",
|
||||||
|
.log_level = UC_LL_NONE,
|
||||||
|
};
|
||||||
|
struct uc_log_modules mods = {
|
||||||
|
.mods = &m,
|
||||||
|
.cnt = 1,
|
||||||
|
};
|
||||||
|
struct stat st;
|
||||||
|
struct uc_log_destination *dest;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
uc_log_init(&mods);
|
||||||
|
|
||||||
|
dest = uc_log_new_file(FILE_NAME, UC_LL_DEBUG, 1);
|
||||||
|
fail_if(dest == NULL);
|
||||||
|
uc_log_add_destination(dest);
|
||||||
|
|
||||||
|
UC_LOGFR(UC_LL_ERROR, 0, "Lorum ipson %d\n", 1);
|
||||||
|
|
||||||
|
rc = stat(FILE_NAME, &st);
|
||||||
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
|
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (test_loglevel_dest_none)
|
||||||
|
|
||||||
|
struct uc_log_module m = {
|
||||||
|
.id = 0,
|
||||||
|
.short_name = "MOD1",
|
||||||
|
.long_name = "Module 1",
|
||||||
|
.log_level = UC_LL_DEBUG,
|
||||||
|
};
|
||||||
|
struct uc_log_modules mods = {
|
||||||
|
.mods = &m,
|
||||||
|
.cnt = 1,
|
||||||
|
};
|
||||||
|
struct stat st;
|
||||||
|
struct uc_log_destination *dest;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
uc_log_init(&mods);
|
||||||
|
|
||||||
|
dest = uc_log_new_file(FILE_NAME, UC_LL_NONE, 1);
|
||||||
|
fail_if(dest == NULL);
|
||||||
|
uc_log_add_destination(dest);
|
||||||
|
|
||||||
|
UC_LOGFR(UC_LL_WARNING, 0, "Lorum ipson %d\n", 1);
|
||||||
|
|
||||||
|
rc = stat(FILE_NAME, &st);
|
||||||
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
|
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
|
||||||
Suite *logging_suite(void)
|
Suite *logging_suite(void)
|
||||||
{
|
{
|
||||||
@@ -435,6 +493,9 @@ Suite *logging_suite(void)
|
|||||||
tcase_add_test(tc2, test_logfile_invalid_file_after_reopen);
|
tcase_add_test(tc2, test_logfile_invalid_file_after_reopen);
|
||||||
tcase_add_test(tc1, test_logfile_raw);
|
tcase_add_test(tc1, test_logfile_raw);
|
||||||
|
|
||||||
|
tcase_add_test(tc1, test_loglevel_module_none);
|
||||||
|
tcase_add_test(tc1, test_loglevel_dest_none);
|
||||||
|
|
||||||
|
|
||||||
tcase_add_checked_fixture(tc1, logging_rm_files, logging_rm_files);
|
tcase_add_checked_fixture(tc1, logging_rm_files, logging_rm_files);
|
||||||
tcase_add_checked_fixture(tc2, logging_setup_subdir, logging_rm_subdir);
|
tcase_add_checked_fixture(tc2, logging_setup_subdir, logging_rm_subdir);
|
||||||
|
|||||||
Reference in New Issue
Block a user