timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ttail_search_closest_fileinit.c 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include <check.h>
  2. #include <stdio.h>
  3. #include <libgen.h>
  4. #include "ttail_check.h"
  5. #include "ttail.h"
  6. #include "ttail_init.h"
  7. #include "ttail_search.h"
  8. START_TEST (test_search_closest_init)
  9. {
  10. int ret;
  11. ret = ttail_search_files_init(ttail);
  12. ck_assert_int_eq(ret,0);
  13. ck_assert(ttail->session->file.vpos == 0);
  14. #ifdef HUGEFILE
  15. ck_assert_int_eq(ttail->session->file.sz_div,0);
  16. #endif
  17. }
  18. END_TEST
  19. START_TEST (test_search_closest_init_filesz)
  20. {
  21. size_t i;
  22. ttail_search_files_init(ttail);
  23. for(i=0;i<6;i++)
  24. {
  25. ck_assert(samples_sz[i] == ttail->session->file.file_sz[i]);
  26. }
  27. }
  28. END_TEST
  29. START_TEST (test_search_closest_init_vfile)
  30. {
  31. size_t i;
  32. off_t full_sz;
  33. ttail_search_files_init(ttail);
  34. full_sz = 0;
  35. for(i=0;i<6;i++)
  36. {
  37. ck_assert(full_sz == ttail->session->file.vfile[i]);
  38. full_sz += samples_sz[i];
  39. }
  40. ck_assert(full_sz == ttail->session->file.vsz);
  41. }
  42. END_TEST
  43. TTAIL_CHECK_START( "ttail search_files checks",\
  44. "ttail_logline_closest_files_init() checks")
  45. TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
  46. TTAIL_ADD_TEST(test_search_closest_init);
  47. TTAIL_ADD_TEST(test_search_closest_init_filesz);
  48. TTAIL_ADD_TEST(test_search_closest_init_vfile);
  49. TTAIL_CHECK_END