|
@@ -1,480 +0,0 @@
|
1
|
|
-#include <check.h>
|
2
|
|
-#include <stdio.h>
|
3
|
|
-#include <libgen.h>
|
4
|
|
-
|
5
|
|
-#include "ttail.h"
|
6
|
|
-#include "ttail_init.h"
|
7
|
|
-#include "ttail_search.h"
|
8
|
|
-
|
9
|
|
-ttail_t *ttail;
|
10
|
|
-
|
11
|
|
-char *samples[6] = { "./samples/1.log", "./samples/2.log", "./samples/3.log",\
|
12
|
|
- "./samples/4.log", "./samples/5.log", "./samples/1.1.log"};
|
13
|
|
-off_t samples_sz[6] = { 442, 0, 893, 2587, 2310, 220 };
|
14
|
|
-FILE *fpl;
|
15
|
|
-
|
16
|
|
-void setup_file_line(void)
|
17
|
|
-{
|
18
|
|
- fpl = fopen(samples[0], "r");
|
19
|
|
- if(!fpl)
|
20
|
|
- {
|
21
|
|
- perror("Unable to open file for testing :");
|
22
|
|
- ck_abort();
|
23
|
|
- }
|
24
|
|
-}
|
25
|
|
-
|
26
|
|
-void teardown_file_line(void)
|
27
|
|
-{
|
28
|
|
- fclose(fpl);
|
29
|
|
-}
|
30
|
|
-
|
31
|
|
-void teardown_closest(void)
|
32
|
|
-{
|
33
|
|
-
|
34
|
|
- ttail_free(ttail);
|
35
|
|
-}
|
36
|
|
-
|
37
|
|
-void setup_closest(void)
|
38
|
|
-{
|
39
|
|
- ttail = ttail_init(1, (char**)&"foo");
|
40
|
|
-}
|
41
|
|
-
|
42
|
|
-void setup_closest_fileinit(void)
|
43
|
|
-{
|
44
|
|
- size_t i;
|
45
|
|
- setup_closest();
|
46
|
|
- for(i=0; i<6; i++)
|
47
|
|
- {
|
48
|
|
- ttail_add_logfile(ttail, samples[i]);
|
49
|
|
- }
|
50
|
|
-}
|
51
|
|
-
|
52
|
|
-void teardown_closest_fileinit(void)
|
53
|
|
-{
|
54
|
|
- _ttail_search_file_free(ttail);
|
55
|
|
- teardown_closest();
|
56
|
|
-}
|
57
|
|
-
|
58
|
|
-START_TEST (test_search_closest_init)
|
59
|
|
-{
|
60
|
|
- int ret;
|
61
|
|
-
|
62
|
|
- ret = ttail_search_files_init(ttail);
|
63
|
|
- ck_assert_int_eq(ret,0);
|
64
|
|
- ck_assert(ttail->session->file.vpos == 0);
|
65
|
|
- #ifdef HUGEFILE
|
66
|
|
- ck_assert_int_eq(ttail->session->file.sz_div,0);
|
67
|
|
- #endif
|
68
|
|
-}
|
69
|
|
-END_TEST
|
70
|
|
-
|
71
|
|
-START_TEST (test_search_closest_init_filesz)
|
72
|
|
-{
|
73
|
|
- size_t i;
|
74
|
|
- ttail_search_files_init(ttail);
|
75
|
|
- for(i=0;i<6;i++)
|
76
|
|
- {
|
77
|
|
- ck_assert(samples_sz[i] == ttail->session->file.file_sz[i]);
|
78
|
|
- }
|
79
|
|
-
|
80
|
|
-}
|
81
|
|
-END_TEST
|
82
|
|
-
|
83
|
|
-START_TEST (test_search_closest_init_vfile)
|
84
|
|
-{
|
85
|
|
- size_t i;
|
86
|
|
- off_t full_sz;
|
87
|
|
-
|
88
|
|
- ttail_search_files_init(ttail);
|
89
|
|
-
|
90
|
|
- full_sz = 0;
|
91
|
|
- for(i=0;i<6;i++)
|
92
|
|
- {
|
93
|
|
- ck_assert(full_sz == ttail->session->file.vfile[i]);
|
94
|
|
- full_sz += samples_sz[i];
|
95
|
|
- }
|
96
|
|
- ck_assert(full_sz == ttail->session->file.vsz);
|
97
|
|
-}
|
98
|
|
-END_TEST
|
99
|
|
-
|
100
|
|
-/*
|
101
|
|
- * _ttail_file_next_line() & _ttail_file_line_start() tests
|
102
|
|
- */
|
103
|
|
-START_TEST (test_file_line_next)
|
104
|
|
-{
|
105
|
|
- long res;
|
106
|
|
- res = _ttail_file_next_line(fpl);
|
107
|
|
- ck_assert(res == 77);
|
108
|
|
- res = _ttail_file_next_line(fpl);
|
109
|
|
- ck_assert(res == 136);
|
110
|
|
- res = _ttail_file_next_line(fpl);
|
111
|
|
- ck_assert(res == 221);
|
112
|
|
- res = _ttail_file_next_line(fpl);
|
113
|
|
- ck_assert(res == 298);
|
114
|
|
- res = _ttail_file_next_line(fpl);
|
115
|
|
- ck_assert(res == 357);
|
116
|
|
- res = _ttail_file_next_line(fpl);
|
117
|
|
- ck_assert(res == 0);
|
118
|
|
- res = _ttail_file_next_line(fpl);
|
119
|
|
- ck_assert(res == -1);
|
120
|
|
-}
|
121
|
|
-END_TEST
|
122
|
|
-
|
123
|
|
-START_TEST (test_file_line_start)
|
124
|
|
-{
|
125
|
|
- long res;
|
126
|
|
- fseek(fpl, -1, SEEK_END);
|
127
|
|
- res = _ttail_file_start_line(fpl);
|
128
|
|
- ck_assert(res == 357);
|
129
|
|
- res = _ttail_file_start_line(fpl);
|
130
|
|
- ck_assert(res == 357);
|
131
|
|
- fseek(fpl, -1, SEEK_CUR);
|
132
|
|
- res = _ttail_file_start_line(fpl);
|
133
|
|
- ck_assert(res == 298);
|
134
|
|
- fseek(fpl, -1, SEEK_CUR);
|
135
|
|
- res = _ttail_file_start_line(fpl);
|
136
|
|
- ck_assert(res == 221);
|
137
|
|
- fseek(fpl, -1, SEEK_CUR);
|
138
|
|
- res = _ttail_file_start_line(fpl);
|
139
|
|
- ck_assert(res == 136);
|
140
|
|
- fseek(fpl, -1, SEEK_CUR);
|
141
|
|
- res = _ttail_file_start_line(fpl);
|
142
|
|
- ck_assert(res == 77);
|
143
|
|
- fseek(fpl, -1, SEEK_CUR);
|
144
|
|
- res = _ttail_file_start_line(fpl);
|
145
|
|
- ck_assert(res == 0);
|
146
|
|
-}
|
147
|
|
-END_TEST
|
148
|
|
-
|
149
|
|
-/*
|
150
|
|
- * _ttail_file_minmax() tests
|
151
|
|
- */
|
152
|
|
-START_TEST (test_file_minmax1)
|
153
|
|
-{
|
154
|
|
- /**@todo complete the testcase */
|
155
|
|
- int r;
|
156
|
|
- struct tm tm[2];
|
157
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
158
|
|
- ttail->prefix_sz = 0;
|
159
|
|
- ttail_set_fmt(ttail, "%b%n%d %H:%M");
|
160
|
|
- r = ttail_search_files_init(ttail);
|
161
|
|
- ck_assert_int_eq(r, 0);
|
162
|
|
- r = _ttail_file_minmax(ttail, 0, tm);
|
163
|
|
- ck_assert_int_eq(r, 0);
|
164
|
|
- ck_assert_int_eq(tm[0].tm_mon, 2);
|
165
|
|
- ck_assert_int_eq(tm[0].tm_mday, 6);
|
166
|
|
- ck_assert_int_eq(tm[0].tm_hour, 0);
|
167
|
|
- ck_assert_int_eq(tm[0].tm_min, 1);
|
168
|
|
- ck_assert_int_eq(tm[1].tm_mon, 2);
|
169
|
|
- ck_assert_int_eq(tm[1].tm_mday, 6);
|
170
|
|
- ck_assert_int_eq(tm[1].tm_hour, 0);
|
171
|
|
- ck_assert_int_eq(tm[1].tm_min, 29);
|
172
|
|
-}
|
173
|
|
-END_TEST
|
174
|
|
-
|
175
|
|
-/*
|
176
|
|
- * ttail_logline_subst() tests
|
177
|
|
- */
|
178
|
|
-START_TEST (test_search_subst_const1)
|
179
|
|
-{
|
180
|
|
- char expl[] = "Hello world !";
|
181
|
|
- const char *res;
|
182
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
183
|
|
- ttail->prefix_sz = 4;
|
184
|
|
- res = ttail_logline_subst(ttail, expl);
|
185
|
|
- ck_assert(res != NULL);
|
186
|
|
- ck_assert(res == expl+4);
|
187
|
|
-}
|
188
|
|
-END_TEST
|
189
|
|
-
|
190
|
|
-START_TEST (test_search_subst_const2)
|
191
|
|
-{
|
192
|
|
- char expl[] = "Hello world !";
|
193
|
|
- const char *res;
|
194
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
195
|
|
- ttail->prefix_sz = 0;
|
196
|
|
- res = ttail_logline_subst(ttail, expl);
|
197
|
|
- ck_assert(res != NULL);
|
198
|
|
- ck_assert(res == expl);
|
199
|
|
-}
|
200
|
|
-END_TEST
|
201
|
|
-
|
202
|
|
-START_TEST (test_search_subst_re1)
|
203
|
|
-{
|
204
|
|
- char expl[] = "1337 Foo Bar - Hello world !";
|
205
|
|
- char re[] = "^1337 Fo* Bar - ";
|
206
|
|
- const char *res;
|
207
|
|
- int ret;
|
208
|
|
- ret = ttail_set_prefix(ttail, re);
|
209
|
|
- ck_assert_int_eq(ret,0);
|
210
|
|
- res = ttail_logline_subst(ttail, expl);
|
211
|
|
- ck_assert(res != NULL);
|
212
|
|
- ck_assert_str_eq(res, "Hello world !");
|
213
|
|
-}
|
214
|
|
-END_TEST
|
215
|
|
-
|
216
|
|
-START_TEST (test_search_subst_re2)
|
217
|
|
-{
|
218
|
|
- char expl[] = "1337 Foo Bar - Hello world !";
|
219
|
|
- char re[] = "^[0-9]+ Fo{2} Bar - ";
|
220
|
|
- const char *res;
|
221
|
|
- int ret;
|
222
|
|
- ttail->flag |= TTAIL_FLAG_EXTENDED_RE;
|
223
|
|
- ret = ttail_set_prefix(ttail, re);
|
224
|
|
- ck_assert_int_eq(ret,0);
|
225
|
|
- res = ttail_logline_subst(ttail, expl);
|
226
|
|
- ck_assert(res != NULL);
|
227
|
|
- ck_assert_str_eq(res, "Hello world !");
|
228
|
|
-}
|
229
|
|
-END_TEST
|
230
|
|
-
|
231
|
|
-START_TEST (test_search_subst_re_nomatch)
|
232
|
|
-{
|
233
|
|
- char expl[] = "1337 Foo Bar - Hello world !";
|
234
|
|
- char re[] = "Never match m*";
|
235
|
|
- const char *res;
|
236
|
|
- int ret;
|
237
|
|
- ret = ttail_set_prefix(ttail, re);
|
238
|
|
- ck_assert_int_eq(ret,0);
|
239
|
|
- res = ttail_logline_subst(ttail, expl);
|
240
|
|
- ck_assert(res == NULL);
|
241
|
|
-}
|
242
|
|
-END_TEST
|
243
|
|
-
|
244
|
|
-/*
|
245
|
|
- * ttail_logline2date() checks
|
246
|
|
- */
|
247
|
|
-START_TEST (test_search_log2date1)
|
248
|
|
-{
|
249
|
|
- char re[] = "^[0-9]+ ";
|
250
|
|
- char fmt[] = "%Y-%m-%d:%H:%M";
|
251
|
|
- struct tm tm;
|
252
|
|
- int ret;
|
253
|
|
- ttail_set_flag_re_ex(ttail);
|
254
|
|
- ttail_set_prefix(ttail, re);
|
255
|
|
- ttail_set_fmt(ttail, fmt);
|
256
|
|
- ret = ttail_logline2date(ttail, "1337 1988-10-22:22:10 foobar", &tm);
|
257
|
|
- ck_assert_int_eq(ret, 0);
|
258
|
|
- ck_assert_int_eq(tm.tm_year, 88);
|
259
|
|
- ck_assert_int_eq(tm.tm_mon, 9);
|
260
|
|
- ck_assert_int_eq(tm.tm_mday, 22);
|
261
|
|
- ck_assert_int_eq(tm.tm_hour, 22);
|
262
|
|
- ck_assert_int_eq(tm.tm_min, 10);
|
263
|
|
-}
|
264
|
|
-END_TEST
|
265
|
|
-
|
266
|
|
-START_TEST (test_search_log2date_failpref)
|
267
|
|
-{
|
268
|
|
- char re[] = "^[0-9]+aa ";
|
269
|
|
- char fmt[] = "%Y-%m-%d:%H:%M";
|
270
|
|
- struct tm tm;
|
271
|
|
- int ret;
|
272
|
|
- ttail_set_flag_re_ex(ttail);
|
273
|
|
- ttail_set_prefix(ttail, re);
|
274
|
|
- ttail_set_fmt(ttail, fmt);
|
275
|
|
- ret = ttail_logline2date(ttail, "1337 1988-10-22:22:10 foobar", &tm);
|
276
|
|
- ck_assert_int_eq(ret, 1);
|
277
|
|
- ck_assert_int_eq(tm.tm_year, 0);
|
278
|
|
- ck_assert_int_eq(tm.tm_mon, 0);
|
279
|
|
- ck_assert_int_eq(tm.tm_mday, 0);
|
280
|
|
- ck_assert_int_eq(tm.tm_hour, 0);
|
281
|
|
- ck_assert_int_eq(tm.tm_min, 0);
|
282
|
|
-}
|
283
|
|
-END_TEST
|
284
|
|
-
|
285
|
|
-START_TEST (test_search_log2date_faildate)
|
286
|
|
-{
|
287
|
|
- char re[] = "^[0-9]+ ";
|
288
|
|
- char fmt[] = "%y-%m-%d:%H:%M";
|
289
|
|
- struct tm tm;
|
290
|
|
- int ret;
|
291
|
|
- ttail_set_flag_re_ex(ttail);
|
292
|
|
- ttail_set_prefix(ttail, re);
|
293
|
|
- ttail_set_fmt(ttail, fmt);
|
294
|
|
- ret = ttail_logline2date(ttail, "1337 1988-10-22:22:10 foobar", &tm);
|
295
|
|
- ck_assert_int_eq(ret, 2);
|
296
|
|
- ck_assert_int_eq(tm.tm_year, 0);
|
297
|
|
- ck_assert_int_eq(tm.tm_mon, 0);
|
298
|
|
- ck_assert_int_eq(tm.tm_mday, 0);
|
299
|
|
- ck_assert_int_eq(tm.tm_hour, 0);
|
300
|
|
- ck_assert_int_eq(tm.tm_min, 0);
|
301
|
|
-}
|
302
|
|
-END_TEST
|
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
|
|
- struct tm tm;
|
313
|
|
- memset(&tm, 0, sizeof(tm));
|
314
|
|
- for(i=1;i<ttail->logfile_sz;i++)
|
315
|
|
- {
|
316
|
|
- fclose(ttail->logfile[i]);
|
317
|
|
- ttail->logfile[i] = NULL;
|
318
|
|
- }
|
319
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
320
|
|
- ttail->prefix_sz = 0;
|
321
|
|
- ttail_set_fmt(ttail, "%B%n%d %H:%M");
|
322
|
|
- memcpy(&(ttail->date_min), &tm, sizeof(tm));
|
323
|
|
- ttail->flag |= TTAIL_FLAG_DATE_MIN;
|
324
|
|
-
|
325
|
|
- ret = ttail_search_files_init(ttail);
|
326
|
|
- ck_assert_int_eq(ret,0);
|
327
|
|
-
|
328
|
|
- ret = _ttail_search_closest_files(ttail);
|
329
|
|
- ck_assert_int_eq(ret, 0);
|
330
|
|
- ck_assert(ttail->session->file.off_min.id == 0);
|
331
|
|
- ck_assert(ttail->session->file.off_min.off == 0);
|
332
|
|
-}
|
333
|
|
-END_TEST
|
334
|
|
-
|
335
|
|
-START_TEST (test_search_files2)
|
336
|
|
-{
|
337
|
|
- int ret;
|
338
|
|
- size_t i;
|
339
|
|
- struct tm tm;
|
340
|
|
- memset(&tm, 0, sizeof(tm));
|
341
|
|
- for(i=1;i<ttail->logfile_sz;i++)
|
342
|
|
- {
|
343
|
|
- fclose(ttail->logfile[i]);
|
344
|
|
- ttail->logfile[i] = NULL;
|
345
|
|
- }
|
346
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
347
|
|
- ttail->prefix_sz = 0;
|
348
|
|
- ttail_set_fmt(ttail, "%B%n%d %H:%M");
|
349
|
|
-
|
350
|
|
- tm.tm_year = -1;
|
351
|
|
- tm.tm_mon = 2;
|
352
|
|
- tm.tm_mday = 6;
|
353
|
|
- tm.tm_hour = 0;
|
354
|
|
- tm.tm_min = 29;
|
355
|
|
- tm.tm_sec = -1;
|
356
|
|
- memcpy(&(ttail->date_min), &tm, sizeof(tm));
|
357
|
|
- ttail->flag |= TTAIL_FLAG_DATE_MIN;
|
358
|
|
-
|
359
|
|
- ret = ttail_search_files_init(ttail);
|
360
|
|
- ck_assert_int_eq(ret,0);
|
361
|
|
-
|
362
|
|
- ret = _ttail_search_closest_files(ttail);
|
363
|
|
- ck_assert_int_eq(ret, 0);
|
364
|
|
- ck_assert(ttail->session->file.off_min.id == 0);
|
365
|
|
- ck_assert_int_eq(ttail->session->file.off_min.off, 221);
|
366
|
|
-}
|
367
|
|
-END_TEST
|
368
|
|
-
|
369
|
|
-START_TEST (test_search_files3)
|
370
|
|
-{
|
371
|
|
- int ret;
|
372
|
|
- size_t i;
|
373
|
|
- struct tm tm;
|
374
|
|
- memset(&tm, 0, sizeof(tm));
|
375
|
|
- for(i=1;i<ttail->logfile_sz-1;i++)
|
376
|
|
- {
|
377
|
|
- fclose(ttail->logfile[i]);
|
378
|
|
- ttail->logfile[i] = NULL;
|
379
|
|
- }
|
380
|
|
- ttail->flag |= TTAIL_FLAG_PREFIX;
|
381
|
|
- ttail->prefix_sz = 0;
|
382
|
|
- ttail_set_fmt(ttail, "%B%n%d %H:%M");
|
383
|
|
-
|
384
|
|
- tm.tm_year = -1;
|
385
|
|
- tm.tm_mon = 2;
|
386
|
|
- tm.tm_mday = 6;
|
387
|
|
- tm.tm_hour = 1;
|
388
|
|
- tm.tm_min = 0;
|
389
|
|
- tm.tm_sec = -1;
|
390
|
|
- memcpy(&(ttail->date_min), &tm, sizeof(tm));
|
391
|
|
- ttail->flag |= TTAIL_FLAG_DATE_MIN;
|
392
|
|
-
|
393
|
|
- ret = ttail_search_files_init(ttail);
|
394
|
|
- ck_assert_int_eq(ret,0);
|
395
|
|
-
|
396
|
|
- ret = _ttail_search_closest_files(ttail);
|
397
|
|
- ck_assert_int_eq(ret, 0);
|
398
|
|
- ck_assert_int_eq(ttail->session->file.off_min.id, 5);
|
399
|
|
- ck_assert_int_eq(ttail->session->file.off_min.off, 0);
|
400
|
|
-}
|
401
|
|
-END_TEST
|
402
|
|
-
|
403
|
|
-Suite * ttail_search_files_suite(void)
|
404
|
|
-{
|
405
|
|
- Suite *s;
|
406
|
|
- TCase *tc_search_closest_fileinit, *tc_file_line,
|
407
|
|
- *tc_file_minmax;
|
408
|
|
- TCase *tc_search_subst, *tc_search_logline2date;
|
409
|
|
- TCase *tc_search_files;
|
410
|
|
-
|
411
|
|
- s = suite_create("ttail search_files checks");
|
412
|
|
- tc_search_closest_fileinit = tcase_create("\
|
413
|
|
-ttail_logline_closest_files_init() checks");
|
414
|
|
- tcase_add_checked_fixture(tc_search_closest_fileinit,
|
415
|
|
- setup_closest_fileinit, teardown_closest_fileinit);
|
416
|
|
- tcase_add_test(tc_search_closest_fileinit, test_search_closest_init);
|
417
|
|
- tcase_add_test(tc_search_closest_fileinit,
|
418
|
|
- test_search_closest_init_filesz);
|
419
|
|
- tcase_add_test(tc_search_closest_fileinit,
|
420
|
|
- test_search_closest_init_vfile);
|
421
|
|
-
|
422
|
|
- tc_file_line = tcase_create("ttail_file_*line*() checks");
|
423
|
|
- tcase_add_checked_fixture(tc_file_line,
|
424
|
|
- setup_file_line, teardown_file_line);
|
425
|
|
- tcase_add_test(tc_file_line, test_file_line_next);
|
426
|
|
- tcase_add_test(tc_file_line, test_file_line_start);
|
427
|
|
-
|
428
|
|
- tc_file_minmax = tcase_create("ttail_file_minmax() checks");
|
429
|
|
- tcase_add_checked_fixture(tc_file_minmax,
|
430
|
|
- setup_closest_fileinit, teardown_closest_fileinit);
|
431
|
|
- tcase_add_test(tc_file_minmax, test_file_minmax1);
|
432
|
|
-
|
433
|
|
- tc_search_subst = tcase_create("ttail_logline_subst() checks");
|
434
|
|
- tcase_add_checked_fixture(tc_search_subst,
|
435
|
|
- setup_closest_fileinit, teardown_closest_fileinit);
|
436
|
|
- tcase_add_test(tc_search_subst, test_search_subst_const1);
|
437
|
|
- tcase_add_test(tc_search_subst, test_search_subst_const2);
|
438
|
|
- tcase_add_test(tc_search_subst, test_search_subst_re1);
|
439
|
|
- tcase_add_test(tc_search_subst, test_search_subst_re2);
|
440
|
|
- tcase_add_test(tc_search_subst, test_search_subst_re_nomatch);
|
441
|
|
-
|
442
|
|
- tc_search_logline2date = tcase_create("ttail_logline2date() checks");
|
443
|
|
- tcase_add_checked_fixture(tc_search_logline2date,
|
444
|
|
- setup_closest_fileinit, teardown_closest_fileinit);
|
445
|
|
- tcase_add_test(tc_search_subst, test_search_log2date1);
|
446
|
|
- tcase_add_test(tc_search_subst, test_search_log2date_failpref);
|
447
|
|
- tcase_add_test(tc_search_subst, test_search_log2date_faildate);
|
448
|
|
-
|
449
|
|
- tc_search_files = tcase_create("ttail_logline2date() checks");
|
450
|
|
- tcase_add_checked_fixture(tc_search_files,
|
451
|
|
- setup_closest_fileinit, teardown_closest_fileinit);
|
452
|
|
- tcase_add_test(tc_search_files, test_search_files1);
|
453
|
|
- tcase_add_test(tc_search_files, test_search_files2);
|
454
|
|
- tcase_add_test(tc_search_files, test_search_files3);
|
455
|
|
-
|
456
|
|
-
|
457
|
|
- suite_add_tcase(s, tc_search_closest_fileinit);
|
458
|
|
- suite_add_tcase(s, tc_file_line);
|
459
|
|
- suite_add_tcase(s, tc_file_minmax);
|
460
|
|
- suite_add_tcase(s, tc_search_subst);
|
461
|
|
- suite_add_tcase(s, tc_search_logline2date);
|
462
|
|
- suite_add_tcase(s, tc_search_files);
|
463
|
|
- return s;
|
464
|
|
-}
|
465
|
|
-
|
466
|
|
-int main(int argc, char **argv)
|
467
|
|
-{
|
468
|
|
- int number_failed = 0;
|
469
|
|
- SRunner *sr;
|
470
|
|
-
|
471
|
|
- chdir(dirname(argv[0])); /* move in ./tests dir */
|
472
|
|
-
|
473
|
|
- sr = srunner_create(ttail_search_files_suite());
|
474
|
|
- srunner_set_fork_status(sr, CK_FORK);
|
475
|
|
- srunner_run_all(sr,CK_VERBOSE);
|
476
|
|
- number_failed = srunner_ntests_failed(sr);
|
477
|
|
- srunner_free(sr);
|
478
|
|
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
479
|
|
-
|
480
|
|
-}
|