2 * Copyright (c) 2018-2020, Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "libdlog_base_wrap.c"
21 fail_conf_read = true;
23 assert(dlog_print(DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NOT_PERMITTED);
24 assert(write_to_log != wtl_android);
25 assert(write_to_log != wtl_pipe);
26 fail_conf_read = false;
30 assert(dlog_print(DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NOT_PERMITTED);
31 assert(write_to_log != wtl_android);
32 assert(write_to_log != wtl_pipe);
33 conf_read_called = false;
34 assert(dlog_print(DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NOT_PERMITTED);
35 assert(conf_read_called); // should retry reinitializing
38 log_config_set(&CONFIG, "backend", "Hej, zamawiam Bentoye. Czekam do 11:15.");
40 assert(dlog_print(DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NOT_PERMITTED);
41 assert(write_to_log != wtl_pipe);
42 assert(write_to_log != wtl_android);
45 log_config_set(&CONFIG, "backend", "logger");
46 log_config_set(&CONFIG, "limiter", "1");
47 log_config_set(&CONFIG, "debugmode", "0");
48 use_dynamic_conf = true;
49 limiter_ret = (struct pass_log_result) { .decision = DECISION_ALLOWED };
51 assert(write_to_log != wtl_pipe); // ceci n'est pas une pipe
52 assert(write_to_log == wtl_android);
53 assert(limiter_created);
55 assert(__dlog_print((log_id_t) -1, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_INVALID_PARAMETER);
56 assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, NULL , "msg") == DLOG_ERROR_INVALID_PARAMETER);
58 assert(__dlog_sec_print((log_id_t) -1, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_INVALID_PARAMETER);
59 assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_ERROR, NULL , "msg") == DLOG_ERROR_INVALID_PARAMETER);
61 limiter_ret = (struct pass_log_result) { .decision = DECISION_ALLOWED };
66 assert(__dlog_print(LOG_ID_SYSTEM, DLOG_ERROR, "tag", "msg") == 45835705);
67 fail_snprintf = false;