Commit | Line | Data |
---|---|---|
223c70b2 PP |
1 | /* |
2 | * Copyright 2017 - Philippe Proulx <pproulx@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; under version 2 of the License. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License along | |
14 | * with this program; if not, write to the Free Software Foundation, Inc., | |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #include <stdio.h> | |
19 | #include <stdlib.h> | |
20 | #include <stdint.h> | |
c55a9f58 | 21 | #include <stdbool.h> |
223c70b2 PP |
22 | #include <inttypes.h> |
23 | #include <string.h> | |
b8f13b8b | 24 | #include <babeltrace/assert-internal.h> |
223c70b2 PP |
25 | #include <babeltrace/ctf-ir/event-class.h> |
26 | #include <babeltrace/ctf-ir/event.h> | |
27 | #include <babeltrace/ctf-ir/field-types.h> | |
28 | #include <babeltrace/ctf-ir/fields.h> | |
29 | #include <babeltrace/ctf-ir/packet.h> | |
30 | #include <babeltrace/ctf-ir/stream-class.h> | |
31 | #include <babeltrace/ctf-ir/stream.h> | |
32 | #include <babeltrace/ctf-ir/trace.h> | |
223c70b2 PP |
33 | #include <babeltrace/graph/component-class-filter.h> |
34 | #include <babeltrace/graph/component-class-sink.h> | |
35 | #include <babeltrace/graph/component-class-source.h> | |
36 | #include <babeltrace/graph/component-class.h> | |
37 | #include <babeltrace/graph/component-sink.h> | |
38 | #include <babeltrace/graph/component-source.h> | |
39 | #include <babeltrace/graph/component.h> | |
73d5c1ad | 40 | #include <babeltrace/graph/connection.h> |
223c70b2 PP |
41 | #include <babeltrace/graph/graph.h> |
42 | #include <babeltrace/graph/notification-event.h> | |
43 | #include <babeltrace/graph/notification-inactivity.h> | |
44 | #include <babeltrace/graph/notification-iterator.h> | |
45 | #include <babeltrace/graph/notification-packet.h> | |
46 | #include <babeltrace/graph/notification-stream.h> | |
71afbadd | 47 | #include <babeltrace/graph/output-port-notification-iterator.h> |
223c70b2 PP |
48 | #include <babeltrace/graph/port.h> |
49 | #include <babeltrace/graph/private-component-source.h> | |
b9d103be | 50 | #include <babeltrace/graph/private-component-sink.h> |
223c70b2 PP |
51 | #include <babeltrace/graph/private-component.h> |
52 | #include <babeltrace/graph/private-connection.h> | |
94a96686 | 53 | #include <babeltrace/graph/private-connection-notification-iterator.h> |
fe7265b5 | 54 | #include <babeltrace/graph/private-connection-private-notification-iterator.h> |
223c70b2 PP |
55 | #include <babeltrace/graph/private-port.h> |
56 | #include <babeltrace/plugin/plugin.h> | |
57 | #include <babeltrace/ref.h> | |
58 | #include <glib.h> | |
59 | ||
60 | #include "tap/tap.h" | |
61 | ||
371361a1 | 62 | #define NR_TESTS 5 |
223c70b2 PP |
63 | |
64 | enum test { | |
65 | TEST_NO_AUTO_NOTIFS, | |
71afbadd | 66 | TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR, |
223c70b2 PP |
67 | }; |
68 | ||
69 | enum test_event_type { | |
70 | TEST_EV_TYPE_NOTIF_UNEXPECTED, | |
71 | TEST_EV_TYPE_NOTIF_EVENT, | |
72 | TEST_EV_TYPE_NOTIF_INACTIVITY, | |
73 | TEST_EV_TYPE_NOTIF_STREAM_BEGIN, | |
74 | TEST_EV_TYPE_NOTIF_PACKET_BEGIN, | |
75 | TEST_EV_TYPE_NOTIF_PACKET_END, | |
76 | TEST_EV_TYPE_NOTIF_STREAM_END, | |
77 | TEST_EV_TYPE_END, | |
78 | TEST_EV_TYPE_SENTINEL, | |
79 | }; | |
80 | ||
81 | struct test_event { | |
82 | enum test_event_type type; | |
839d52a5 PP |
83 | struct bt_stream *stream; |
84 | struct bt_packet *packet; | |
223c70b2 PP |
85 | }; |
86 | ||
223c70b2 PP |
87 | static bool debug = false; |
88 | static enum test current_test; | |
89 | static GArray *test_events; | |
f7c3ac09 | 90 | static struct bt_graph *graph; |
03e18d5d | 91 | static struct bt_private_connection_private_notification_iterator *cur_notif_iter; |
839d52a5 PP |
92 | static struct bt_stream_class *src_stream_class; |
93 | static struct bt_event_class *src_event_class; | |
94 | static struct bt_stream *src_stream1; | |
95 | static struct bt_stream *src_stream2; | |
96 | static struct bt_packet *src_stream1_packet1; | |
97 | static struct bt_packet *src_stream1_packet2; | |
98 | static struct bt_packet *src_stream2_packet1; | |
99 | static struct bt_packet *src_stream2_packet2; | |
223c70b2 PP |
100 | |
101 | enum { | |
102 | SEQ_END = -1, | |
103 | SEQ_STREAM1_BEGIN = -2, | |
104 | SEQ_STREAM2_BEGIN = -3, | |
105 | SEQ_STREAM1_END = -4, | |
106 | SEQ_STREAM2_END = -5, | |
107 | SEQ_STREAM1_PACKET1_BEGIN = -6, | |
108 | SEQ_STREAM1_PACKET2_BEGIN = -7, | |
109 | SEQ_STREAM2_PACKET1_BEGIN = -8, | |
110 | SEQ_STREAM2_PACKET2_BEGIN = -9, | |
111 | SEQ_STREAM1_PACKET1_END = -10, | |
112 | SEQ_STREAM1_PACKET2_END = -11, | |
113 | SEQ_STREAM2_PACKET1_END = -12, | |
114 | SEQ_STREAM2_PACKET2_END = -13, | |
115 | SEQ_EVENT_STREAM1_PACKET1 = -14, | |
116 | SEQ_EVENT_STREAM1_PACKET2 = -15, | |
117 | SEQ_EVENT_STREAM2_PACKET1 = -16, | |
118 | SEQ_EVENT_STREAM2_PACKET2 = -17, | |
119 | SEQ_INACTIVITY = -18, | |
120 | }; | |
121 | ||
122 | struct src_iter_user_data { | |
123 | int64_t *seq; | |
124 | size_t at; | |
125 | }; | |
126 | ||
127 | struct sink_user_data { | |
128 | struct bt_notification_iterator *notif_iter; | |
129 | }; | |
130 | ||
131 | /* | |
132 | * No automatic notifications generated in this block. | |
133 | * Stream 2 notifications are more indented. | |
134 | */ | |
135 | static int64_t seq_no_auto_notifs[] = { | |
136 | SEQ_STREAM1_BEGIN, | |
137 | SEQ_STREAM1_PACKET1_BEGIN, | |
138 | SEQ_EVENT_STREAM1_PACKET1, | |
139 | SEQ_EVENT_STREAM1_PACKET1, | |
140 | SEQ_STREAM2_BEGIN, | |
141 | SEQ_EVENT_STREAM1_PACKET1, | |
142 | SEQ_STREAM2_PACKET2_BEGIN, | |
143 | SEQ_EVENT_STREAM2_PACKET2, | |
144 | SEQ_EVENT_STREAM1_PACKET1, | |
145 | SEQ_STREAM1_PACKET1_END, | |
146 | SEQ_STREAM2_PACKET2_END, | |
147 | SEQ_STREAM1_PACKET2_BEGIN, | |
148 | SEQ_EVENT_STREAM1_PACKET2, | |
149 | SEQ_STREAM2_END, | |
150 | SEQ_STREAM1_PACKET2_END, | |
151 | SEQ_STREAM1_END, | |
152 | SEQ_END, | |
153 | }; | |
154 | ||
223c70b2 PP |
155 | static |
156 | void clear_test_events(void) | |
157 | { | |
158 | g_array_set_size(test_events, 0); | |
159 | } | |
160 | ||
161 | static | |
162 | void print_test_event(FILE *fp, const struct test_event *event) | |
163 | { | |
164 | fprintf(fp, "{ type = "); | |
165 | ||
166 | switch (event->type) { | |
167 | case TEST_EV_TYPE_NOTIF_UNEXPECTED: | |
168 | fprintf(fp, "TEST_EV_TYPE_NOTIF_UNEXPECTED"); | |
169 | break; | |
170 | case TEST_EV_TYPE_NOTIF_EVENT: | |
171 | fprintf(fp, "TEST_EV_TYPE_NOTIF_EVENT"); | |
172 | break; | |
173 | case TEST_EV_TYPE_NOTIF_INACTIVITY: | |
174 | fprintf(fp, "TEST_EV_TYPE_NOTIF_INACTIVITY"); | |
175 | break; | |
176 | case TEST_EV_TYPE_NOTIF_STREAM_BEGIN: | |
177 | fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN"); | |
178 | break; | |
179 | case TEST_EV_TYPE_NOTIF_STREAM_END: | |
180 | fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_END"); | |
181 | break; | |
182 | case TEST_EV_TYPE_NOTIF_PACKET_BEGIN: | |
183 | fprintf(fp, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN"); | |
184 | break; | |
185 | case TEST_EV_TYPE_NOTIF_PACKET_END: | |
186 | fprintf(fp, "TEST_EV_TYPE_NOTIF_PACKET_END"); | |
187 | break; | |
188 | case TEST_EV_TYPE_END: | |
189 | fprintf(fp, "TEST_EV_TYPE_END"); | |
190 | break; | |
191 | case TEST_EV_TYPE_SENTINEL: | |
192 | fprintf(fp, "TEST_EV_TYPE_SENTINEL"); | |
193 | break; | |
194 | default: | |
195 | fprintf(fp, "(UNKNOWN)"); | |
196 | break; | |
197 | } | |
198 | ||
199 | fprintf(fp, ", stream = %p, packet = %p }", event->stream, | |
200 | event->packet); | |
201 | } | |
202 | ||
203 | static | |
204 | void append_test_event(struct test_event *event) | |
205 | { | |
206 | g_array_append_val(test_events, *event); | |
207 | } | |
208 | ||
209 | static | |
210 | bool compare_single_test_events(const struct test_event *ev_a, | |
211 | const struct test_event *ev_b) | |
212 | { | |
213 | if (debug) { | |
214 | fprintf(stderr, ":: Comparing test events: "); | |
215 | print_test_event(stderr, ev_a); | |
216 | fprintf(stderr, " vs. "); | |
217 | print_test_event(stderr, ev_b); | |
218 | fprintf(stderr, "\n"); | |
219 | } | |
220 | ||
221 | if (ev_a->type != ev_b->type) { | |
222 | return false; | |
223 | } | |
224 | ||
225 | switch (ev_a->type) { | |
226 | case TEST_EV_TYPE_END: | |
227 | case TEST_EV_TYPE_SENTINEL: | |
228 | break; | |
229 | default: | |
230 | if (ev_a->stream != ev_b->stream) { | |
231 | return false; | |
232 | } | |
233 | ||
234 | if (ev_a->packet != ev_b->packet) { | |
235 | return false; | |
236 | } | |
237 | break; | |
238 | } | |
239 | ||
240 | return true; | |
241 | } | |
242 | ||
243 | static | |
244 | bool compare_test_events(const struct test_event *expected_events) | |
245 | { | |
246 | const struct test_event *expected_event = expected_events; | |
247 | size_t i = 0; | |
248 | ||
b8f13b8b | 249 | BT_ASSERT(expected_events); |
223c70b2 PP |
250 | |
251 | while (true) { | |
252 | const struct test_event *event; | |
253 | ||
254 | if (expected_event->type == TEST_EV_TYPE_SENTINEL) { | |
255 | break; | |
256 | } | |
257 | ||
258 | if (i >= test_events->len) { | |
259 | return false; | |
260 | } | |
261 | ||
262 | event = &g_array_index(test_events, struct test_event, i); | |
263 | ||
264 | if (!compare_single_test_events(event, expected_event)) { | |
265 | return false; | |
266 | } | |
267 | ||
268 | i++; | |
269 | expected_event++; | |
270 | } | |
271 | ||
272 | if (i != test_events->len) { | |
273 | return false; | |
274 | } | |
275 | ||
276 | return true; | |
277 | } | |
278 | ||
279 | static | |
280 | void init_static_data(void) | |
281 | { | |
282 | int ret; | |
839d52a5 PP |
283 | struct bt_trace *trace; |
284 | struct bt_field_type *empty_struct_ft; | |
223c70b2 PP |
285 | |
286 | /* Test events */ | |
287 | test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event)); | |
b8f13b8b | 288 | BT_ASSERT(test_events); |
223c70b2 PP |
289 | |
290 | /* Metadata */ | |
839d52a5 | 291 | empty_struct_ft = bt_field_type_structure_create(); |
b8f13b8b | 292 | BT_ASSERT(empty_struct_ft); |
839d52a5 | 293 | trace = bt_trace_create(); |
b8f13b8b | 294 | BT_ASSERT(trace); |
8deee039 | 295 | ret = bt_trace_set_packet_header_field_type(trace, empty_struct_ft); |
b8f13b8b | 296 | BT_ASSERT(ret == 0); |
839d52a5 | 297 | src_stream_class = bt_stream_class_create("my-stream-class"); |
b8f13b8b | 298 | BT_ASSERT(src_stream_class); |
8deee039 | 299 | ret = bt_stream_class_set_packet_context_field_type(src_stream_class, |
223c70b2 | 300 | empty_struct_ft); |
b8f13b8b | 301 | BT_ASSERT(ret == 0); |
8deee039 | 302 | ret = bt_stream_class_set_event_header_field_type(src_stream_class, |
223c70b2 | 303 | empty_struct_ft); |
b8f13b8b | 304 | BT_ASSERT(ret == 0); |
8deee039 | 305 | ret = bt_stream_class_set_event_context_field_type(src_stream_class, |
223c70b2 | 306 | empty_struct_ft); |
b8f13b8b | 307 | BT_ASSERT(ret == 0); |
839d52a5 | 308 | src_event_class = bt_event_class_create("my-event-class"); |
8deee039 | 309 | ret = bt_event_class_set_context_field_type(src_event_class, |
223c70b2 | 310 | empty_struct_ft); |
b8f13b8b | 311 | BT_ASSERT(ret == 0); |
8deee039 | 312 | ret = bt_event_class_set_payload_field_type(src_event_class, |
223c70b2 | 313 | empty_struct_ft); |
b8f13b8b | 314 | BT_ASSERT(ret == 0); |
839d52a5 | 315 | ret = bt_stream_class_add_event_class(src_stream_class, |
223c70b2 | 316 | src_event_class); |
b8f13b8b | 317 | BT_ASSERT(ret == 0); |
839d52a5 | 318 | ret = bt_trace_add_stream_class(trace, src_stream_class); |
b8f13b8b | 319 | BT_ASSERT(ret == 0); |
8deee039 | 320 | src_stream1 = bt_stream_create(src_stream_class, "stream-1", 0); |
b8f13b8b | 321 | BT_ASSERT(src_stream1); |
8deee039 | 322 | src_stream2 = bt_stream_create(src_stream_class, "stream-2", 1); |
b8f13b8b | 323 | BT_ASSERT(src_stream2); |
839d52a5 | 324 | src_stream1_packet1 = bt_packet_create(src_stream1); |
b8f13b8b | 325 | BT_ASSERT(src_stream1_packet1); |
839d52a5 | 326 | src_stream1_packet2 = bt_packet_create(src_stream1); |
b8f13b8b | 327 | BT_ASSERT(src_stream1_packet2); |
839d52a5 | 328 | src_stream2_packet1 = bt_packet_create(src_stream2); |
b8f13b8b | 329 | BT_ASSERT(src_stream2_packet1); |
839d52a5 | 330 | src_stream2_packet2 = bt_packet_create(src_stream2); |
b8f13b8b | 331 | BT_ASSERT(src_stream2_packet2); |
223c70b2 PP |
332 | |
333 | if (debug) { | |
334 | fprintf(stderr, ":: stream 1: %p\n", src_stream1); | |
335 | fprintf(stderr, ":: stream 2: %p\n", src_stream2); | |
336 | fprintf(stderr, ":: stream 1, packet 1: %p\n", src_stream1_packet1); | |
337 | fprintf(stderr, ":: stream 1, packet 2: %p\n", src_stream1_packet2); | |
338 | fprintf(stderr, ":: stream 2, packet 1: %p\n", src_stream2_packet1); | |
339 | fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2); | |
340 | } | |
341 | ||
342 | bt_put(trace); | |
343 | bt_put(empty_struct_ft); | |
344 | } | |
345 | ||
346 | static | |
347 | void fini_static_data(void) | |
348 | { | |
349 | /* Test events */ | |
350 | g_array_free(test_events, TRUE); | |
351 | ||
352 | /* Metadata */ | |
223c70b2 PP |
353 | bt_put(src_stream_class); |
354 | bt_put(src_event_class); | |
355 | bt_put(src_stream1); | |
356 | bt_put(src_stream2); | |
357 | bt_put(src_stream1_packet1); | |
358 | bt_put(src_stream1_packet2); | |
359 | bt_put(src_stream2_packet1); | |
360 | bt_put(src_stream2_packet2); | |
361 | } | |
362 | ||
363 | static | |
364 | void src_iter_finalize( | |
fe7265b5 | 365 | struct bt_private_connection_private_notification_iterator *private_notification_iterator) |
223c70b2 PP |
366 | { |
367 | struct src_iter_user_data *user_data = | |
fe7265b5 | 368 | bt_private_connection_private_notification_iterator_get_user_data( |
223c70b2 PP |
369 | private_notification_iterator); |
370 | ||
371 | if (user_data) { | |
372 | g_free(user_data); | |
373 | } | |
374 | } | |
375 | ||
376 | static | |
377 | enum bt_notification_iterator_status src_iter_init( | |
fe7265b5 | 378 | struct bt_private_connection_private_notification_iterator *priv_notif_iter, |
223c70b2 PP |
379 | struct bt_private_port *private_port) |
380 | { | |
381 | struct src_iter_user_data *user_data = | |
382 | g_new0(struct src_iter_user_data, 1); | |
383 | int ret; | |
384 | ||
b8f13b8b | 385 | BT_ASSERT(user_data); |
71afbadd PP |
386 | ret = bt_private_connection_private_notification_iterator_set_user_data( |
387 | priv_notif_iter, user_data); | |
b8f13b8b | 388 | BT_ASSERT(ret == 0); |
223c70b2 PP |
389 | |
390 | switch (current_test) { | |
391 | case TEST_NO_AUTO_NOTIFS: | |
71afbadd | 392 | case TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR: |
223c70b2 PP |
393 | user_data->seq = seq_no_auto_notifs; |
394 | break; | |
223c70b2 | 395 | default: |
0fbb9a9f | 396 | abort(); |
223c70b2 PP |
397 | } |
398 | ||
399 | return BT_NOTIFICATION_ITERATOR_STATUS_OK; | |
400 | } | |
401 | ||
223c70b2 | 402 | static |
3fd7b79d PP |
403 | void src_iter_next_seq_one(struct src_iter_user_data *user_data, |
404 | struct bt_notification **notif) | |
223c70b2 | 405 | { |
839d52a5 | 406 | struct bt_packet *event_packet = NULL; |
223c70b2 | 407 | |
3fd7b79d | 408 | switch (user_data->seq[user_data->at]) { |
223c70b2 | 409 | case SEQ_INACTIVITY: |
03e18d5d | 410 | *notif = bt_notification_inactivity_create(cur_notif_iter); |
223c70b2 PP |
411 | break; |
412 | case SEQ_STREAM1_BEGIN: | |
03e18d5d | 413 | *notif = bt_notification_stream_begin_create(cur_notif_iter, |
3fd7b79d | 414 | src_stream1); |
223c70b2 PP |
415 | break; |
416 | case SEQ_STREAM2_BEGIN: | |
03e18d5d | 417 | *notif = bt_notification_stream_begin_create(cur_notif_iter, |
3fd7b79d | 418 | src_stream2); |
223c70b2 PP |
419 | break; |
420 | case SEQ_STREAM1_END: | |
03e18d5d PP |
421 | *notif = bt_notification_stream_end_create(cur_notif_iter, |
422 | src_stream1); | |
223c70b2 PP |
423 | break; |
424 | case SEQ_STREAM2_END: | |
03e18d5d PP |
425 | *notif = bt_notification_stream_end_create(cur_notif_iter, |
426 | src_stream2); | |
223c70b2 PP |
427 | break; |
428 | case SEQ_STREAM1_PACKET1_BEGIN: | |
03e18d5d | 429 | *notif = bt_notification_packet_begin_create(cur_notif_iter, |
3fd7b79d | 430 | src_stream1_packet1); |
223c70b2 PP |
431 | break; |
432 | case SEQ_STREAM1_PACKET2_BEGIN: | |
03e18d5d | 433 | *notif = bt_notification_packet_begin_create(cur_notif_iter, |
3fd7b79d | 434 | src_stream1_packet2); |
223c70b2 PP |
435 | break; |
436 | case SEQ_STREAM2_PACKET1_BEGIN: | |
03e18d5d | 437 | *notif = bt_notification_packet_begin_create(cur_notif_iter, |
3fd7b79d | 438 | src_stream2_packet1); |
223c70b2 PP |
439 | break; |
440 | case SEQ_STREAM2_PACKET2_BEGIN: | |
03e18d5d | 441 | *notif = bt_notification_packet_begin_create(cur_notif_iter, |
3fd7b79d | 442 | src_stream2_packet2); |
223c70b2 PP |
443 | break; |
444 | case SEQ_STREAM1_PACKET1_END: | |
03e18d5d | 445 | *notif = bt_notification_packet_end_create(cur_notif_iter, |
3fd7b79d | 446 | src_stream1_packet1); |
223c70b2 PP |
447 | break; |
448 | case SEQ_STREAM1_PACKET2_END: | |
03e18d5d | 449 | *notif = bt_notification_packet_end_create(cur_notif_iter, |
3fd7b79d | 450 | src_stream1_packet2); |
223c70b2 PP |
451 | break; |
452 | case SEQ_STREAM2_PACKET1_END: | |
03e18d5d | 453 | *notif = bt_notification_packet_end_create(cur_notif_iter, |
3fd7b79d | 454 | src_stream2_packet1); |
223c70b2 PP |
455 | break; |
456 | case SEQ_STREAM2_PACKET2_END: | |
03e18d5d | 457 | *notif = bt_notification_packet_end_create(cur_notif_iter, |
3fd7b79d | 458 | src_stream2_packet2); |
223c70b2 PP |
459 | break; |
460 | case SEQ_EVENT_STREAM1_PACKET1: | |
461 | event_packet = src_stream1_packet1; | |
462 | break; | |
463 | case SEQ_EVENT_STREAM1_PACKET2: | |
464 | event_packet = src_stream1_packet2; | |
465 | break; | |
466 | case SEQ_EVENT_STREAM2_PACKET1: | |
467 | event_packet = src_stream2_packet1; | |
468 | break; | |
469 | case SEQ_EVENT_STREAM2_PACKET2: | |
470 | event_packet = src_stream2_packet2; | |
471 | break; | |
472 | default: | |
0fbb9a9f | 473 | abort(); |
223c70b2 PP |
474 | } |
475 | ||
476 | if (event_packet) { | |
03e18d5d PP |
477 | *notif = bt_notification_event_create(cur_notif_iter, |
478 | src_event_class, event_packet); | |
3fd7b79d PP |
479 | } |
480 | ||
481 | BT_ASSERT(*notif); | |
482 | user_data->at++; | |
483 | } | |
484 | ||
485 | static | |
486 | enum bt_notification_iterator_status src_iter_next_seq( | |
487 | struct src_iter_user_data *user_data, | |
488 | bt_notification_array notifs, uint64_t capacity, | |
489 | uint64_t *count) | |
490 | { | |
491 | enum bt_notification_iterator_status status = | |
492 | BT_NOTIFICATION_ITERATOR_STATUS_OK; | |
493 | uint64_t i = 0; | |
494 | ||
495 | BT_ASSERT(user_data->seq); | |
496 | ||
497 | if (user_data->seq[user_data->at] == SEQ_END) { | |
498 | status = BT_NOTIFICATION_ITERATOR_STATUS_END; | |
499 | goto end; | |
223c70b2 PP |
500 | } |
501 | ||
3fd7b79d PP |
502 | while (i < capacity && user_data->seq[user_data->at] != SEQ_END) { |
503 | src_iter_next_seq_one(user_data, ¬ifs[i]); | |
504 | i++; | |
223c70b2 PP |
505 | } |
506 | ||
3fd7b79d PP |
507 | BT_ASSERT(i > 0 && i <= capacity); |
508 | *count = i; | |
509 | ||
510 | end: | |
511 | return status; | |
223c70b2 PP |
512 | } |
513 | ||
514 | static | |
3fd7b79d PP |
515 | enum bt_notification_iterator_status src_iter_next( |
516 | struct bt_private_connection_private_notification_iterator *priv_iterator, | |
517 | bt_notification_array notifs, uint64_t capacity, | |
518 | uint64_t *count) | |
223c70b2 | 519 | { |
223c70b2 | 520 | struct src_iter_user_data *user_data = |
fe7265b5 | 521 | bt_private_connection_private_notification_iterator_get_user_data(priv_iterator); |
223c70b2 | 522 | |
b8f13b8b | 523 | BT_ASSERT(user_data); |
03e18d5d | 524 | cur_notif_iter = priv_iterator; |
3fd7b79d | 525 | return src_iter_next_seq(user_data, notifs, capacity, count); |
223c70b2 PP |
526 | } |
527 | ||
528 | static | |
529 | enum bt_component_status src_init( | |
530 | struct bt_private_component *private_component, | |
531 | struct bt_value *params, void *init_method_data) | |
532 | { | |
147337a3 | 533 | int ret; |
b9d103be | 534 | |
147337a3 PP |
535 | ret = bt_private_component_source_add_output_private_port( |
536 | private_component, "out", NULL, NULL); | |
b8f13b8b | 537 | BT_ASSERT(ret == 0); |
223c70b2 PP |
538 | return BT_COMPONENT_STATUS_OK; |
539 | } | |
540 | ||
541 | static | |
542 | void src_finalize(struct bt_private_component *private_component) | |
543 | { | |
544 | } | |
545 | ||
546 | static | |
3fd7b79d | 547 | void append_test_events_from_notification(struct bt_notification *notification) |
223c70b2 | 548 | { |
223c70b2 | 549 | struct test_event test_event = { 0 }; |
223c70b2 PP |
550 | |
551 | switch (bt_notification_get_type(notification)) { | |
552 | case BT_NOTIFICATION_TYPE_EVENT: | |
553 | { | |
839d52a5 | 554 | struct bt_event *event; |
223c70b2 PP |
555 | |
556 | test_event.type = TEST_EV_TYPE_NOTIF_EVENT; | |
a6918753 | 557 | event = bt_notification_event_borrow_event(notification); |
b8f13b8b | 558 | BT_ASSERT(event); |
a6918753 | 559 | test_event.packet = bt_event_borrow_packet(event); |
b8f13b8b | 560 | BT_ASSERT(test_event.packet); |
223c70b2 PP |
561 | break; |
562 | } | |
563 | case BT_NOTIFICATION_TYPE_INACTIVITY: | |
564 | test_event.type = TEST_EV_TYPE_NOTIF_INACTIVITY; | |
565 | break; | |
566 | case BT_NOTIFICATION_TYPE_STREAM_BEGIN: | |
567 | test_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; | |
568 | test_event.stream = | |
a6918753 | 569 | bt_notification_stream_begin_borrow_stream(notification); |
b8f13b8b | 570 | BT_ASSERT(test_event.stream); |
223c70b2 PP |
571 | break; |
572 | case BT_NOTIFICATION_TYPE_STREAM_END: | |
573 | test_event.type = TEST_EV_TYPE_NOTIF_STREAM_END; | |
574 | test_event.stream = | |
a6918753 | 575 | bt_notification_stream_end_borrow_stream(notification); |
b8f13b8b | 576 | BT_ASSERT(test_event.stream); |
223c70b2 PP |
577 | break; |
578 | case BT_NOTIFICATION_TYPE_PACKET_BEGIN: | |
579 | test_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN; | |
580 | test_event.packet = | |
a6918753 | 581 | bt_notification_packet_begin_borrow_packet(notification); |
b8f13b8b | 582 | BT_ASSERT(test_event.packet); |
223c70b2 PP |
583 | break; |
584 | case BT_NOTIFICATION_TYPE_PACKET_END: | |
585 | test_event.type = TEST_EV_TYPE_NOTIF_PACKET_END; | |
586 | test_event.packet = | |
a6918753 | 587 | bt_notification_packet_end_borrow_packet(notification); |
b8f13b8b | 588 | BT_ASSERT(test_event.packet); |
223c70b2 PP |
589 | break; |
590 | default: | |
591 | test_event.type = TEST_EV_TYPE_NOTIF_UNEXPECTED; | |
592 | break; | |
593 | } | |
594 | ||
595 | if (test_event.packet) { | |
a6918753 | 596 | test_event.stream = bt_packet_borrow_stream(test_event.packet); |
b8f13b8b | 597 | BT_ASSERT(test_event.stream); |
223c70b2 PP |
598 | } |
599 | ||
3fd7b79d PP |
600 | append_test_event(&test_event); |
601 | } | |
602 | ||
603 | static | |
604 | enum bt_notification_iterator_status common_consume( | |
605 | struct bt_notification_iterator *notif_iter, | |
606 | bool is_output_port_notif_iter) | |
607 | { | |
608 | enum bt_notification_iterator_status ret; | |
609 | bt_notification_array notifications = NULL; | |
610 | uint64_t count = 0; | |
611 | struct test_event test_event = { 0 }; | |
612 | uint64_t i; | |
613 | ||
614 | BT_ASSERT(notif_iter); | |
615 | ||
616 | if (is_output_port_notif_iter) { | |
617 | ret = bt_output_port_notification_iterator_next(notif_iter, | |
618 | ¬ifications, &count); | |
619 | } else { | |
620 | ret = bt_private_connection_notification_iterator_next( | |
621 | notif_iter, ¬ifications, &count); | |
622 | } | |
623 | ||
624 | if (ret < 0) { | |
625 | goto end; | |
626 | } | |
627 | ||
628 | switch (ret) { | |
629 | case BT_NOTIFICATION_ITERATOR_STATUS_END: | |
630 | test_event.type = TEST_EV_TYPE_END; | |
223c70b2 | 631 | append_test_event(&test_event); |
3fd7b79d PP |
632 | goto end; |
633 | case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: | |
634 | abort(); | |
635 | default: | |
636 | break; | |
223c70b2 PP |
637 | } |
638 | ||
3fd7b79d PP |
639 | BT_ASSERT(notifications); |
640 | BT_ASSERT(count > 0); | |
641 | ||
642 | for (i = 0; i < count; i++) { | |
643 | append_test_events_from_notification(notifications[i]); | |
644 | bt_put(notifications[i]); | |
645 | } | |
646 | ||
647 | end: | |
223c70b2 PP |
648 | return ret; |
649 | } | |
650 | ||
71afbadd PP |
651 | static |
652 | enum bt_component_status sink_consume( | |
653 | struct bt_private_component *priv_component) | |
654 | { | |
655 | enum bt_component_status ret = BT_COMPONENT_STATUS_OK; | |
656 | struct sink_user_data *user_data = | |
657 | bt_private_component_get_user_data(priv_component); | |
658 | enum bt_notification_iterator_status it_ret; | |
659 | ||
b8f13b8b | 660 | BT_ASSERT(user_data && user_data->notif_iter); |
94a96686 | 661 | it_ret = common_consume(user_data->notif_iter, false); |
71afbadd PP |
662 | |
663 | if (it_ret < 0) { | |
664 | ret = BT_COMPONENT_STATUS_ERROR; | |
665 | goto end; | |
666 | } | |
667 | ||
668 | switch (it_ret) { | |
669 | case BT_NOTIFICATION_ITERATOR_STATUS_END: | |
670 | ret = BT_COMPONENT_STATUS_END; | |
671 | BT_PUT(user_data->notif_iter); | |
672 | goto end; | |
673 | case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: | |
674 | abort(); | |
675 | default: | |
676 | break; | |
677 | } | |
678 | ||
679 | end: | |
680 | return ret; | |
681 | } | |
682 | ||
223c70b2 | 683 | static |
634f394c PP |
684 | enum bt_component_status sink_port_connected( |
685 | struct bt_private_component *private_component, | |
223c70b2 PP |
686 | struct bt_private_port *self_private_port, |
687 | struct bt_port *other_port) | |
688 | { | |
689 | struct bt_private_connection *priv_conn = | |
690 | bt_private_port_get_private_connection(self_private_port); | |
691 | struct sink_user_data *user_data = bt_private_component_get_user_data( | |
692 | private_component); | |
73d5c1ad | 693 | enum bt_connection_status conn_status; |
223c70b2 | 694 | |
b8f13b8b PP |
695 | BT_ASSERT(user_data); |
696 | BT_ASSERT(priv_conn); | |
73d5c1ad | 697 | conn_status = bt_private_connection_create_notification_iterator( |
6ff151ad | 698 | priv_conn, &user_data->notif_iter); |
b8f13b8b | 699 | BT_ASSERT(conn_status == 0); |
223c70b2 | 700 | bt_put(priv_conn); |
634f394c | 701 | return BT_COMPONENT_STATUS_OK; |
223c70b2 PP |
702 | } |
703 | ||
704 | static | |
705 | enum bt_component_status sink_init( | |
706 | struct bt_private_component *private_component, | |
707 | struct bt_value *params, void *init_method_data) | |
708 | { | |
709 | struct sink_user_data *user_data = g_new0(struct sink_user_data, 1); | |
710 | int ret; | |
711 | ||
b8f13b8b | 712 | BT_ASSERT(user_data); |
223c70b2 PP |
713 | ret = bt_private_component_set_user_data(private_component, |
714 | user_data); | |
b8f13b8b | 715 | BT_ASSERT(ret == 0); |
147337a3 PP |
716 | ret = bt_private_component_sink_add_input_private_port( |
717 | private_component, "in", NULL, NULL); | |
b8f13b8b | 718 | BT_ASSERT(ret == 0); |
223c70b2 PP |
719 | return BT_COMPONENT_STATUS_OK; |
720 | } | |
721 | ||
722 | static | |
723 | void sink_finalize(struct bt_private_component *private_component) | |
724 | { | |
725 | struct sink_user_data *user_data = bt_private_component_get_user_data( | |
726 | private_component); | |
727 | ||
728 | if (user_data) { | |
729 | bt_put(user_data->notif_iter); | |
730 | g_free(user_data); | |
731 | } | |
732 | } | |
733 | ||
734 | static | |
36712f1d | 735 | void create_source_sink(struct bt_graph *graph, struct bt_component **source, |
223c70b2 PP |
736 | struct bt_component **sink) |
737 | { | |
738 | struct bt_component_class *src_comp_class; | |
739 | struct bt_component_class *sink_comp_class; | |
740 | int ret; | |
741 | ||
742 | /* Create source component */ | |
71afbadd PP |
743 | if (source) { |
744 | src_comp_class = bt_component_class_source_create("src", | |
745 | src_iter_next); | |
b8f13b8b | 746 | BT_ASSERT(src_comp_class); |
71afbadd PP |
747 | ret = bt_component_class_set_init_method(src_comp_class, |
748 | src_init); | |
b8f13b8b | 749 | BT_ASSERT(ret == 0); |
71afbadd PP |
750 | ret = bt_component_class_set_finalize_method(src_comp_class, |
751 | src_finalize); | |
b8f13b8b | 752 | BT_ASSERT(ret == 0); |
71afbadd PP |
753 | ret = bt_component_class_source_set_notification_iterator_init_method( |
754 | src_comp_class, src_iter_init); | |
b8f13b8b | 755 | BT_ASSERT(ret == 0); |
71afbadd PP |
756 | ret = bt_component_class_source_set_notification_iterator_finalize_method( |
757 | src_comp_class, src_iter_finalize); | |
b8f13b8b | 758 | BT_ASSERT(ret == 0); |
71afbadd PP |
759 | ret = bt_graph_add_component(graph, src_comp_class, "source", |
760 | NULL, source); | |
b8f13b8b | 761 | BT_ASSERT(ret == 0); |
71afbadd PP |
762 | bt_put(src_comp_class); |
763 | } | |
223c70b2 PP |
764 | |
765 | /* Create sink component */ | |
71afbadd PP |
766 | if (sink) { |
767 | sink_comp_class = bt_component_class_sink_create("sink", | |
768 | sink_consume); | |
b8f13b8b | 769 | BT_ASSERT(sink_comp_class); |
71afbadd PP |
770 | ret = bt_component_class_set_init_method(sink_comp_class, |
771 | sink_init); | |
b8f13b8b | 772 | BT_ASSERT(ret == 0); |
71afbadd PP |
773 | ret = bt_component_class_set_finalize_method(sink_comp_class, |
774 | sink_finalize); | |
775 | ret = bt_component_class_set_port_connected_method( | |
776 | sink_comp_class, sink_port_connected); | |
b8f13b8b | 777 | BT_ASSERT(ret == 0); |
71afbadd PP |
778 | ret = bt_graph_add_component(graph, sink_comp_class, "sink", |
779 | NULL, sink); | |
b8f13b8b | 780 | BT_ASSERT(ret == 0); |
71afbadd PP |
781 | bt_put(sink_comp_class); |
782 | } | |
223c70b2 PP |
783 | } |
784 | ||
785 | static | |
786 | void do_std_test(enum test test, const char *name, | |
787 | const struct test_event *expected_test_events) | |
788 | { | |
789 | struct bt_component *src_comp; | |
790 | struct bt_component *sink_comp; | |
791 | struct bt_port *upstream_port; | |
792 | struct bt_port *downstream_port; | |
223c70b2 PP |
793 | enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK; |
794 | ||
795 | clear_test_events(); | |
796 | current_test = test; | |
797 | diag("test: %s", name); | |
b8f13b8b | 798 | BT_ASSERT(!graph); |
223c70b2 | 799 | graph = bt_graph_create(); |
b8f13b8b | 800 | BT_ASSERT(graph); |
36712f1d | 801 | create_source_sink(graph, &src_comp, &sink_comp); |
223c70b2 PP |
802 | |
803 | /* Connect source to sink */ | |
b9d103be | 804 | upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out"); |
b8f13b8b | 805 | BT_ASSERT(upstream_port); |
b9d103be | 806 | downstream_port = bt_component_sink_get_input_port_by_name(sink_comp, "in"); |
b8f13b8b | 807 | BT_ASSERT(downstream_port); |
a256a42d PP |
808 | graph_status = bt_graph_connect_ports(graph, upstream_port, |
809 | downstream_port, NULL); | |
223c70b2 PP |
810 | bt_put(upstream_port); |
811 | bt_put(downstream_port); | |
812 | ||
813 | /* Run the graph until the end */ | |
814 | while (graph_status == BT_GRAPH_STATUS_OK || | |
815 | graph_status == BT_GRAPH_STATUS_AGAIN) { | |
816 | graph_status = bt_graph_run(graph); | |
817 | } | |
818 | ||
819 | ok(graph_status == BT_GRAPH_STATUS_END, "graph finishes without any error"); | |
820 | ||
821 | /* Compare the resulting test events */ | |
822 | if (expected_test_events) { | |
823 | ok(compare_test_events(expected_test_events), | |
824 | "the produced sequence of test events is the expected one"); | |
825 | } | |
826 | ||
827 | bt_put(src_comp); | |
828 | bt_put(sink_comp); | |
f7c3ac09 | 829 | BT_PUT(graph); |
223c70b2 PP |
830 | } |
831 | ||
832 | static | |
833 | void test_no_auto_notifs(void) | |
834 | { | |
835 | const struct test_event expected_test_events[] = { | |
836 | { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, | |
837 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
838 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
839 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
840 | { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, }, | |
841 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
842 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
843 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
844 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
845 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
846 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
847 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
848 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
849 | { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, }, | |
850 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
851 | { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, | |
852 | { .type = TEST_EV_TYPE_END, }, | |
853 | { .type = TEST_EV_TYPE_SENTINEL, }, | |
854 | }; | |
855 | ||
856 | do_std_test(TEST_NO_AUTO_NOTIFS, "no automatic notifications", | |
857 | expected_test_events); | |
858 | } | |
859 | ||
71afbadd PP |
860 | static |
861 | void test_output_port_notification_iterator(void) | |
862 | { | |
863 | const struct test_event expected_test_events[] = { | |
864 | { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, | |
865 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
866 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
867 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
868 | { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, }, | |
869 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
870 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
871 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
872 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
873 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, | |
874 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, }, | |
875 | { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
876 | { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
877 | { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, }, | |
878 | { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, | |
879 | { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, | |
880 | { .type = TEST_EV_TYPE_END, }, | |
881 | { .type = TEST_EV_TYPE_SENTINEL, }, | |
882 | }; | |
883 | struct bt_component *src_comp; | |
884 | struct bt_notification_iterator *notif_iter; | |
885 | enum bt_notification_iterator_status iter_status = | |
886 | BT_NOTIFICATION_ITERATOR_STATUS_OK; | |
887 | struct bt_port *upstream_port; | |
71afbadd PP |
888 | |
889 | clear_test_events(); | |
890 | current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR; | |
891 | diag("test: output port notification iterator"); | |
b8f13b8b | 892 | BT_ASSERT(!graph); |
71afbadd | 893 | graph = bt_graph_create(); |
b8f13b8b | 894 | BT_ASSERT(graph); |
71afbadd PP |
895 | create_source_sink(graph, &src_comp, NULL); |
896 | ||
897 | /* Create notification iterator on source's output port */ | |
898 | upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out"); | |
899 | notif_iter = bt_output_port_notification_iterator_create(upstream_port, | |
6ff151ad | 900 | NULL); |
71afbadd PP |
901 | ok(notif_iter, "bt_output_port_notification_iterator_create() succeeds"); |
902 | bt_put(upstream_port); | |
903 | ||
904 | /* Consume the notification iterator */ | |
905 | while (iter_status == BT_NOTIFICATION_ITERATOR_STATUS_OK) { | |
94a96686 | 906 | iter_status = common_consume(notif_iter, true); |
71afbadd PP |
907 | } |
908 | ||
909 | ok(iter_status == BT_NOTIFICATION_ITERATOR_STATUS_END, | |
910 | "output port notification iterator finishes without any error"); | |
911 | ||
912 | /* Compare the resulting test events */ | |
913 | ok(compare_test_events(expected_test_events), | |
914 | "the produced sequence of test events is the expected one"); | |
915 | ||
916 | bt_put(src_comp); | |
f7c3ac09 | 917 | BT_PUT(graph); |
71afbadd PP |
918 | bt_put(notif_iter); |
919 | } | |
920 | ||
223c70b2 PP |
921 | #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG" |
922 | ||
923 | int main(int argc, char **argv) | |
924 | { | |
925 | if (getenv(DEBUG_ENV_VAR) && strcmp(getenv(DEBUG_ENV_VAR), "1") == 0) { | |
926 | debug = true; | |
927 | } | |
928 | ||
929 | plan_tests(NR_TESTS); | |
930 | init_static_data(); | |
931 | test_no_auto_notifs(); | |
71afbadd | 932 | test_output_port_notification_iterator(); |
223c70b2 PP |
933 | fini_static_data(); |
934 | return exit_status(); | |
935 | } |