diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index 6fdee34..629144f 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -3,13 +3,11 @@ enable_testing() set(SRC_DIR "../src") add_executable("t_cmsg" "t_cmsg.c" "${SRC_DIR}/strlcpy.c" "${SRC_DIR}/cmsg.c") -add_executable("t_logfile" "t_logfile.c" "${SRC_DIR}/strlcpy.c" "${SRC_DIR}/logfile.c") add_executable("t_matches" "t_matches.c" "${SRC_DIR}/strlcpy.c" "${SRC_DIR}/matches.c") add_executable("t_ipaddr" "t_ipaddr.c" "${SRC_DIR}/strlcpy.c" "${SRC_DIR}/matches.c" "${SRC_DIR}/ipaddr.c") add_executable("t_config_param" "t_config_param.c" "${SRC_DIR}/strlcpy.c" "${SRC_DIR}/config.c" "${SRC_DIR}/log.c") add_test("tests/f2b_cmsg_*" "t_cmsg") -add_test("tests/f2b_logfile_*" "t_logfile") add_test("tests/f2b_matches_*" "t_matches") add_test("tests/f2b_ipaddr_*" "t_ipaddr") add_test("tests/f2b_config_param*" "t_config_param") diff --git a/t/t_logfile.c b/t/t_logfile.c deleted file mode 100644 index 5885889..0000000 --- a/t/t_logfile.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "../src/common.h" -#include "../src/logfile.h" - -int main() { - f2b_logfile_t file; - char filename[] = "/tmp/f2b-test.XXXXXX"; - int fd = 0; - int ret; - bool res; - FILE *wfd = NULL; - char buf[2048]; - - UNUSED(res); - UNUSED(ret); - - fd = mkstemp(filename); - assert(fd > 0); - wfd = fdopen(fd, "a"); - assert(wfd != NULL); - ret = fputs("test1\n", wfd); - assert(ret > 0); - ret = fflush(wfd); - assert(ret == 0); - - res = f2b_logfile_open(&file, filename); - assert(res == true); - res = f2b_logfile_getline(&file, buf, sizeof(buf)); - assert(res == false); - - ret = fputs("test2\n", wfd); - assert(ret > 0); - ret = fflush(wfd); - assert(ret == 0); - - res = f2b_logfile_getline(&file, buf, sizeof(buf)); - assert(res == true); - ret = strncmp(buf, "test2\n", sizeof(buf)); - assert(ret == 0); - - res = f2b_logfile_getline(&file, buf, sizeof(buf)); - assert(res == false); - - fclose(wfd); - close(fd); - unlink(filename); - - wfd = fopen(filename, "a"); - assert(wfd != NULL); - - res = f2b_logfile_rotated(&file); - assert(res == true); - - f2b_logfile_close(&file); - fclose(wfd); - unlink(filename); - - exit(0); -}