return (struct pass_log_result) { .decision = DECISION_ALLOWED, };
/* Decide, if it should go through or stop */
+ // LCOV_EXCL_START : no limiter when gathering coverage since other tests need to send logs. See above
time_t now = time(NULL);
if (0 > now)
return (struct pass_log_result) { .decision = DECISION_ALLOWED, };
r->hit++;
return (struct pass_log_result) { .decision = DECISION_ALLOWED, };
+ // LCOV_EXCL_STOP
}
struct pass_log_result __log_limiter_pass_log(struct limiter_data *limiter_data, const char *tag, int prio)
return __log_limiter_pass_log_pid(limiter_data, tag, prio, getpid());
}
+
struct iteration_data {
struct rule **rules_table;
struct limiter_data *limiter_data;
if (strncmp(key, "pidlimit|", sizeof "pidlimit|" - 1))
return;
+ // LCOV_EXCL_START : no limiter when gathering coverage since other tests need to send logs. See above
int pid = atoi(key + sizeof "pidlimit|" - 1);
int limit;
p->pid = pid;
list_add(&data->limiter_data->pid_rules, p);
+ // LCOV_EXCL_STOP
}
static void __config_iteration(const char *key, const char *value, void *userdata)
const int r = __log_limiter_initialize(ret, ret->original_rules_table);
if (r) {
+ // LCOV_EXCL_START : error case.
rules_destroy(&ret->original_rules_table);
if (ret->pid_rules != NULL)
return ret;
free(ret);
return NULL;
}
+ // LCOV_EXCL_STOP
}
for (struct rule *i = ret->original_rules_table; i; i = i->prev)
@bindir@/tizen-unittests/dlog/test_capi_coverage
-for MODE in monitor priority_exact pid_wrong tid_wrong tag_wrong prefix_wrong sorting clear alias negative; do
+for MODE in monitor priority_exact pid_wrong tid_wrong tag_wrong prefix_wrong sorting clear alias negative misc; do
@bindir@/tizen-unittests/dlog/test_libdlogutil_cov $MODE 0 pipe
done
LOGGER=$!
sleep 5
echo "blabla" > /dev/kmsg
+
+# run dlogsend/dlogutil again because this counts for a different backend.
dlogsend -b main "blablabla"
dlogsend -c 999 -b main "blablabla999"
dlogsend -t FLOOD -b main "blablabla"
+dlog_redirect_stdout --outtag FOO -- /usr/bin/echo Hi
+dlog_redirect_stdout --errtag BAR -- /usr/bin/sh -c "echo Hi >&2"
+dlog_redirect_stdout --outbuffer radio --outtag MONTAG --outprio W -- /usr/bin/echo Hi
+dlog_redirect_stdout --errbuffer radio --errtag DIENSTAG --errprio I -- /usr/bin/sh -c "echo Hi >&2"
sleep 0.3233
dlogutil -db main
+dlogutil -db main TEST:*
+dlogutil -db main TEST:=E
+dlogutil -db main TEST:E
+dlogutil -db main *:E
+dlogutil -db main --pid 123
+dlogutil -db main --tid 123
+dlogutil -b main -c
+dlogutil -b main -g
dlogutil -u 10 -db main
dlogutil -u 1 -db main
dlogutil --sort-by recv_real -db main
MODE_CLEAR,
MODE_ALIAS,
MODE_NEGATIVE,
+ MODE_MISC,
MODE_INVALID,
};
[MODE_CLEAR] = "clear",
[MODE_ALIAS] = "alias",
[MODE_NEGATIVE] = "negative",
+ [MODE_MISC] = "misc",
};
const char *mode_desc[] = {
[MODE_CLEAR] = "test clearing functionality -- in this case, the PID is ignored",
[MODE_ALIAS] = "test buffer aliasing -- in this case, the PID is ignored",
[MODE_NEGATIVE] = "test whether libdlogutil errors out correctly",
+ [MODE_MISC] = "run some miscellaneous calls",
};
void print_usage_and_die(const char *name)
dlogutil_state_destroy(state);
}
+void misc_calls(void)
+{
+ dlogutil_config_s *config = dlogutil_config_create();
+
+ dlogutil_config_sorting_disable(config);
+ dlogutil_config_sorting_enable(config);
+ dlogutil_config_buffer_add(config, LOG_ID_MAIN);
+ dlogutil_config_buffer_add(config, LOG_ID_APPS);
+
+ dlogutil_state_s *state;
+ assert(dlogutil_config_connect(config, &state) == 0);
+ dlogutil_config_destroy(config);
+
+ dlogutil_entry_s *e;
+ int r = dlogutil_get_log(state, -1, &e);
+ if (r == 0) {
+ pid_t x;
+ dlogutil_entry_get_tid(e, &x);
+ dlogutil_entry_get_pid(e, &x);
+ log_priority p;
+ dlogutil_entry_get_priority(e, &p);
+ free(e);
+ } else {
+ dlogutil_entry_get_tid(NULL, NULL);
+ dlogutil_entry_get_pid(NULL, NULL);
+ dlogutil_entry_get_priority(NULL, NULL);
+ }
+
+ dlogutil_state_destroy(state);
+}
int main(int argc, char **argv)
{
case MODE_NEGATIVE:
negative_main();
break;
+ case MODE_MISC:
+ misc_calls();
+ break;
default:
assert(false);
}