Nuke warnings in tests

This commit is contained in:
Nils O. Selåsdal
2025-07-18 22:45:08 +02:00
parent cfe647f85d
commit 5b5ca445e9
11 changed files with 230 additions and 230 deletions
+35 -35
View File
@@ -61,7 +61,7 @@ START_TEST (test_logfile_location)
UC_LOGF(UC_LL_ERROR, 0, "Lorum ipson 5");
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(rc != 0);
}
END_TEST
@@ -96,8 +96,8 @@ START_TEST (test_logfile_delete_destination)
UC_LOGF(UC_LL_ERROR, 0, "Lorum ipson 5");
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 260, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 260);
uc_log_delete_destination(dest);
@@ -109,8 +109,8 @@ START_TEST (test_logfile_delete_destination)
//since we deleted destinatiion, no more logging should appear in the file
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 260, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 260);
}
END_TEST
@@ -142,8 +142,8 @@ START_TEST (test_logfile_no_location)
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 52*2, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 52*2);
}
END_TEST
@@ -175,9 +175,9 @@ START_TEST (test_logfile_loglevel_surpressed_dest)
UC_LOGF(UC_LL_INFO, 1, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(rc != 0);
fail_if(st.st_size != 0, "was %ld", (long)st.st_size);
fail_if(st.st_size != 0);
}
END_TEST
@@ -209,9 +209,9 @@ START_TEST (test_logfile_loglevel_surpressed_module)
UC_LOGF(UC_LL_INFO, 0, "Lorum ipson %d", 100);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(rc != 0);
fail_if(st.st_size != 0, "was %ld", (long)st.st_size);
fail_if(st.st_size != 0);
}
END_TEST
@@ -242,20 +242,20 @@ START_TEST (test_logfile_reopen_files)
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 104, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 104);
rc = remove(FILE_NAME);
fail_if(rc != 0, "Remove failed %s", strerror(errno));
fail_if(rc != 0);
rc = uc_log_reopen_files();
fail_if(rc != 0, "uc_log_reopen_files failed: %d", rc);
fail_if(rc != 0);
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "2. stat failed: %s", strerror(errno));
fail_if(st.st_size != 52, "was %ld", (long)st.st_size);//should only one line there now
fail_if(rc != 0);
fail_if(st.st_size != 52);//should only one line there now
}
END_TEST
@@ -293,16 +293,16 @@ START_TEST (test_logfile_remove_dest)
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 104, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 104);
uc_log_remove_destination(dest1);
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1); //should not be logged now
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "2. stat failed: %s", strerror(errno));
fail_if(st.st_size != 104, "was %ld", (long)st.st_size);//should be same size
fail_if(rc != 0);
fail_if(st.st_size != 104);//should be same size
//removing the last destination should be fine too
uc_log_remove_destination(dest2);
@@ -310,8 +310,8 @@ START_TEST (test_logfile_remove_dest)
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "2. stat failed: %s", strerror(errno));
fail_if(st.st_size != 104, "was %ld", (long)st.st_size);//should be same size
fail_if(rc != 0);
fail_if(st.st_size != 104);//should be same size
}
END_TEST
@@ -336,7 +336,7 @@ START_TEST (test_logfile_full_filesystem)
uc_log_init(&mods);
dest = uc_log_new_file("/dev/full", UC_LL_DEBUG, 1);
fail_if(dest == NULL, "Cannot open /dev/full");
fail_if(dest == NULL);
uc_log_add_destination(dest);
for (i = 0; i < 1024; i++) {
@@ -396,7 +396,7 @@ START_TEST (test_logfile_invalid_file_after_reopen)
logging_rm_subdir();
rc = access(SUBDIR_FILE_NAME, W_OK);
fail_if(rc == 0, "Test setup is wrong. Can still access" SUBDIR_FILE_NAME "");
fail_if(rc == 0);
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
UC_LOGF(UC_LL_WARNING, 0, "Lorum ipson %d", 1);
@@ -439,8 +439,8 @@ START_TEST (test_logfile_raw)
UC_LOGFR(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 14*2, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 14*2);
}
END_TEST
@@ -479,16 +479,16 @@ START_TEST (test_logfile_dest_mask)
UC_LOGFR(UC_LL_DEBUG, 0, "Lorum ipson %d", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 0, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 0);
uc_log_destination_set_mask(dest, "MOD1=DEBUG:mod2=Debug");
UC_LOGFR(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
UC_LOGFR(UC_LL_DEBUG, 1, "Lorum ipson %d\n", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 14*2, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 14*2);
}
END_TEST
@@ -518,8 +518,8 @@ START_TEST (test_loglevel_module_none)
UC_LOGFR(UC_LL_ERROR, 0, "Lorum ipson %d\n", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 0, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 0);
}
END_TEST
@@ -549,8 +549,8 @@ START_TEST (test_loglevel_dest_none)
UC_LOGFR(UC_LL_WARNING, 0, "Lorum ipson %d\n", 1);
rc = stat(FILE_NAME, &st);
fail_if(rc != 0, "stat failed: %s", strerror(errno));
fail_if(st.st_size != 0, "was %ld", (long)st.st_size);
fail_if(rc != 0);
fail_if(st.st_size != 0);
}
END_TEST