enum test_mode {
MODE_DUMP,
- MODE_DEFAULTS,
MODE_TIMER,
MODE_CONTINUOUS,
MODE_MONITOR,
const char *mode_names[] = {
[MODE_DUMP] = "dump",
- [MODE_DEFAULTS] = "defaults",
[MODE_TIMER] = "timer",
[MODE_CONTINUOUS] = "continuous",
[MODE_MONITOR] = "monitor",
const char *mode_desc[] = {
[MODE_DUMP] = "test getting logs in the dump mode",
- [MODE_DEFAULTS] = "same, but relying on implicit defaults",
[MODE_TIMER] = "same, but waiting on each log to simulate work",
[MODE_CONTINUOUS] = "test getting logs in the continuous mode",
[MODE_MONITOR] = "test that monitor mode skips all the old logs",
int r;
- dlogutil_config_s *c = NULL;
- if (mode != MODE_DEFAULTS) {
- c = dlogutil_config_create();
- assert(c);
-
- dlogutil_config_buffer_add(c, LOG_ID_MAIN);
-
- switch (mode) {
- case MODE_PRIORITY:
- assert(dlogutil_config_filter_filterspec(c, "*:W") == 0);
- break;
- case MODE_PRIORITY_EXACT:
- assert(dlogutil_config_filter_filterspec(c, "*:=W") == 0);
- break;
- case MODE_PID_CORRECT:
- assert(dlogutil_config_filter_pid(c, pid) == 0);
- break;
- case MODE_PID_WRONG:
- assert(dlogutil_config_filter_pid(c, pid ^ 1) == 0);
- break;
- case MODE_TID_CORRECT:
- assert(dlogutil_config_filter_tid(c, pid) == 0);
- break;
- case MODE_TID_WRONG:
- assert(dlogutil_config_filter_tid(c, pid ^ 1) == 0);
- break;
- case MODE_TAG_CORRECT:
- dlogutil_config_filter_filterspec(c, "SRPOL_LOGGER");
- break;
- case MODE_TAG_WRONG:
- dlogutil_config_filter_filterspec(c, "SRPOL_WRONG");
- break;
- case MODE_PREFIX_CORRECT:
- dlogutil_config_filter_filterspec(c, "SRPOL*");
- break;
- case MODE_PREFIX_WRONG:
- dlogutil_config_filter_filterspec(c, "WRONG*");
- break;
- default:
- break;
- }
+ dlogutil_config_s *c = dlogutil_config_create();
+ assert(c);
+
+ dlogutil_config_buffer_add(c, LOG_ID_MAIN);
+
+ switch (mode) {
+ case MODE_PRIORITY:
+ assert(dlogutil_config_filter_filterspec(c, "*:W") == 0);
+ break;
+ case MODE_PRIORITY_EXACT:
+ assert(dlogutil_config_filter_filterspec(c, "*:=W") == 0);
+ break;
+ case MODE_PID_CORRECT:
+ assert(dlogutil_config_filter_pid(c, pid) == 0);
+ break;
+ case MODE_PID_WRONG:
+ assert(dlogutil_config_filter_pid(c, pid ^ 1) == 0);
+ break;
+ case MODE_TID_CORRECT:
+ assert(dlogutil_config_filter_tid(c, pid) == 0);
+ break;
+ case MODE_TID_WRONG:
+ assert(dlogutil_config_filter_tid(c, pid ^ 1) == 0);
+ break;
+ case MODE_TAG_CORRECT:
+ dlogutil_config_filter_filterspec(c, "SRPOL_LOGGER");
+ break;
+ case MODE_TAG_WRONG:
+ dlogutil_config_filter_filterspec(c, "SRPOL_WRONG");
+ break;
+ case MODE_PREFIX_CORRECT:
+ dlogutil_config_filter_filterspec(c, "SRPOL*");
+ break;
+ case MODE_PREFIX_WRONG:
+ dlogutil_config_filter_filterspec(c, "WRONG*");
+ break;
+ default:
+ break;
}
- // TODO
- else return;
dlogutil_state_s *s = NULL;
if (continuous)
}
dlogutil_state_destroy(s);
- if (mode != MODE_DEFAULTS)
- dlogutil_config_destroy(c);
+ dlogutil_config_destroy(c);
switch (mode) {
case MODE_DUMP:
- case MODE_DEFAULTS:
case MODE_TIMER:
case MODE_CONTINUOUS:
case MODE_PID_CORRECT:
switch (t) {
case MODE_DUMP:
- case MODE_DEFAULTS:
case MODE_TIMER:
case MODE_CONTINUOUS:
case MODE_MONITOR: