|
@@ -154,7 +154,6 @@ START_TEST (test_file_minmax1)
|
154
|
154
|
/**@todo complete the testcase */
|
155
|
155
|
int r;
|
156
|
156
|
struct tm tm[2];
|
157
|
|
- printf("%ld\n", ttail->logfile_sz);
|
158
|
157
|
ttail->flag |= TTAIL_FLAG_PREFIX;
|
159
|
158
|
ttail->prefix_sz = 0;
|
160
|
159
|
ttail_set_fmt(ttail, "%b%n%d %H:%M");
|
|
@@ -302,12 +301,36 @@ START_TEST (test_search_log2date_faildate)
|
302
|
301
|
}
|
303
|
302
|
END_TEST
|
304
|
303
|
|
|
304
|
+/*
|
|
305
|
+ * tests ttail_search_closest_files()
|
|
306
|
+ */
|
|
307
|
+
|
|
308
|
+START_TEST (test_search_files1)
|
|
309
|
+{
|
|
310
|
+ int ret;
|
|
311
|
+ size_t i;
|
|
312
|
+ for(i=1;i<ttail->logfile_sz;i++)
|
|
313
|
+ {
|
|
314
|
+ fclose(ttail->logfile[i]);
|
|
315
|
+ ttail->logfile[i] = NULL;
|
|
316
|
+ }
|
|
317
|
+ ttail->flag |= TTAIL_FLAG_PREFIX;
|
|
318
|
+ ttail->prefix_sz = 0;
|
|
319
|
+ ttail_set_fmt(ttail, "%B%n%d %H:%M");
|
|
320
|
+
|
|
321
|
+ ret = _ttail_search_closest_files(ttail);
|
|
322
|
+ ck_assert_int_eq(ret, 0);
|
|
323
|
+ ck_assert(ttail->session->file.id == 0);
|
|
324
|
+}
|
|
325
|
+END_TEST
|
|
326
|
+
|
305
|
327
|
Suite * ttail_search_files_suite(void)
|
306
|
328
|
{
|
307
|
329
|
Suite *s;
|
308
|
330
|
TCase *tc_search_closest_fileinit, *tc_file_line,
|
309
|
331
|
*tc_file_minmax;
|
310
|
332
|
TCase *tc_search_subst, *tc_search_logline2date;
|
|
333
|
+ TCase *tc_search_files;
|
311
|
334
|
|
312
|
335
|
s = suite_create("ttail search_files checks");
|
313
|
336
|
tc_search_closest_fileinit = tcase_create("\
|
|
@@ -347,11 +370,18 @@ ttail_logline_closest_files_init() checks");
|
347
|
370
|
tcase_add_test(tc_search_subst, test_search_log2date_failpref);
|
348
|
371
|
tcase_add_test(tc_search_subst, test_search_log2date_faildate);
|
349
|
372
|
|
|
373
|
+ tc_search_files = tcase_create("ttail_logline2date() checks");
|
|
374
|
+ tcase_add_checked_fixture(tc_search_files,
|
|
375
|
+ setup_closest_fileinit, teardown_closest_fileinit);
|
|
376
|
+ tcase_add_test(tc_search_files, test_search_files1);
|
|
377
|
+
|
|
378
|
+
|
350
|
379
|
suite_add_tcase(s, tc_search_closest_fileinit);
|
351
|
380
|
suite_add_tcase(s, tc_file_line);
|
352
|
381
|
suite_add_tcase(s, tc_file_minmax);
|
353
|
382
|
suite_add_tcase(s, tc_search_subst);
|
354
|
383
|
suite_add_tcase(s, tc_search_logline2date);
|
|
384
|
+ suite_add_tcase(s, tc_search_files);
|
355
|
385
|
return s;
|
356
|
386
|
}
|
357
|
387
|
|