test raw logging

This commit is contained in:
root
2012-11-08 23:33:17 +01:00
parent 8f53cc6563
commit c582a33365
2 changed files with 40 additions and 1 deletions
+32
View File
@@ -331,6 +331,36 @@ START_TEST (test_logfile_invalid_file_after_repoen)
END_TEST
START_TEST (test_logfile_raw)
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_DEBUG, 1);
fail_if(dest == NULL);
uc_log_add_destination(dest);
UC_LOGFR(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
UC_LOGFR(UC_LL_DEBUG, 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 != 14*2, "was %ld\n", (long)st.st_size);
END_TEST
Suite *logging_suite(void)
{
@@ -351,6 +381,8 @@ Suite *logging_suite(void)
}
tcase_add_test(tc1, test_logfile_invalid_file);
tcase_add_test(tc2, test_logfile_invalid_file_after_repoen);
tcase_add_test(tc2, test_logfile_raw);
tcase_add_checked_fixture(tc1, logging_rm_files, logging_rm_files);
tcase_add_checked_fixture(tc2, logging_setup_subdir, logging_rm_subdir);