2 * Copyright (c) 2019-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 "logutil_wrap.c"
21 struct sort_vector sv;
22 sort_vector_init(&sv);
23 sv.sort_by = DLOGUTIL_SORT_SENT_MONO;
25 sv.size = DEFAULT_SORT_BUFFER_SIZE;
26 sort_vector_finalize(&sv);
27 assert(sort_vector_time_span(&sv, (struct timespec) { .tv_nsec = -1 }) == 0);
29 struct fd_ops test_ops = {
30 .has_log = test_has_log,
31 .peek_entry = test_peek_entry,
34 struct fd_info fd_stor[10] = {};
35 struct fdi_internal ii_stor[10] = {};
36 dlogutil_entry_s ent_stor[10 - 3] = {};
37 for (int i = 0; i < 10; ++i) {
39 ii_stor[i].has_log = false;
41 ent_stor[i - 3].sec_sent_mono = i % 2;
42 ent_stor[i - 3].nsec_sent_mono = i;
44 ii_stor[i].has_log = true;
45 ii_stor[i].ent = &ent_stor[i - 3];
49 fd_stor[i].ops = &test_ops;
50 fd_stor[i].priv_data = &ii_stor[t];
53 struct fd_info *fds[10] = {};
54 for (int i = 0; i < 10; ++i) {
58 dlogutil_entry_s *vector_overflown = NULL;
59 bool need_epoll = false, all_drained = false;
60 fdi_push_log_ret = -EIO;
61 assert(put_logs_into_vector(fds, 10, &sv, (struct log_filter *)0xEEE, false, &need_epoll, &all_drained, &vector_overflown) == -EIO);
62 assert(!vector_overflown);
64 sort_vector_free(&sv);