2 * Copyright 2017 - Philippe Proulx <pproulx@efficios.com>
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.
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.
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.
24 #include <babeltrace/ctf-ir/event-class.h>
25 #include <babeltrace/ctf-ir/event.h>
26 #include <babeltrace/ctf-ir/field-types.h>
27 #include <babeltrace/ctf-ir/fields.h>
28 #include <babeltrace/ctf-ir/packet.h>
29 #include <babeltrace/ctf-ir/stream-class.h>
30 #include <babeltrace/ctf-ir/stream.h>
31 #include <babeltrace/ctf-ir/trace.h>
32 #include <babeltrace/graph/clock-class-priority-map.h>
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-filter.h>
38 #include <babeltrace/graph/component-sink.h>
39 #include <babeltrace/graph/component-source.h>
40 #include <babeltrace/graph/component.h>
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/port.h>
47 #include <babeltrace/graph/private-component-source.h>
48 #include <babeltrace/graph/private-component.h>
49 #include <babeltrace/graph/private-connection.h>
50 #include <babeltrace/graph/private-notification-iterator.h>
51 #include <babeltrace/graph/private-port.h>
52 #include <babeltrace/plugin/plugin.h>
53 #include <babeltrace/ref.h>
62 TEST_NO_UPSTREAM_CONNECTION
,
64 TEST_4_PORTS_WITH_RETRIES
,
65 TEST_SINGLE_END_THEN_MULTIPLE_FULL
,
66 TEST_SINGLE_AGAIN_END_THEN_MULTIPLE_FULL
,
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_PACKET_BEGIN
,
74 TEST_EV_TYPE_NOTIF_PACKET_END
,
75 TEST_EV_TYPE_NOTIF_STREAM_BEGIN
,
76 TEST_EV_TYPE_NOTIF_STREAM_END
,
79 TEST_EV_TYPE_SENTINEL
,
83 enum test_event_type type
;
87 struct source_muxer_sink
{
88 struct bt_component
*source
;
89 struct bt_component
*muxer
;
90 struct bt_component
*sink
;
93 struct graph_listener_data
{
94 struct bt_graph
*graph
;
95 struct bt_component
*source
;
96 struct bt_component
*muxer
;
97 struct bt_component
*sink
;
100 static bool debug
= false;
101 static enum test current_test
;
102 static GArray
*test_events
;
103 static struct bt_clock_class_priority_map
*src_cc_prio_map
;
104 static struct bt_clock_class_priority_map
*src_empty_cc_prio_map
;
105 static struct bt_ctf_clock_class
*src_clock_class
;
106 static struct bt_ctf_stream_class
*src_stream_class
;
107 static struct bt_ctf_event_class
*src_event_class
;
108 static struct bt_ctf_packet
*src_packet0
;
109 static struct bt_ctf_packet
*src_packet1
;
110 static struct bt_ctf_packet
*src_packet2
;
111 static struct bt_ctf_packet
*src_packet3
;
116 SEQ_PACKET_BEGIN
= -3,
120 struct src_iter_user_data
{
124 struct bt_ctf_packet
*packet
;
127 struct sink_user_data
{
128 struct bt_notification_iterator
*notif_iter
;
131 static int64_t seq1
[] = {
132 24, 53, 97, 105, 119, 210, 222, 240, 292, 317, 353, 407, 433,
133 473, 487, 504, 572, 615, 708, 766, 850, 852, 931, 951, 956, 996,
137 static int64_t seq2
[] = {
138 51, 59, 68, 77, 91, 121, 139, 170, 179, 266, 352, 454, 478, 631,
139 644, 668, 714, 744, 750, 778, 790, 836, SEQ_END
,
142 static int64_t seq3
[] = {
143 8, 71, 209, 254, 298, 320, 350, 393, 419, 624, 651, 678, 717,
144 731, 733, 788, 819, 820, 857, 892, 903, 944, 998, SEQ_END
,
147 static int64_t seq4
[] = {
148 41, 56, 120, 138, 154, 228, 471, 479, 481, 525, 591, 605, 612,
149 618, 632, 670, 696, 825, 863, 867, 871, 884, 953, 985, 999,
153 static int64_t seq1_with_again
[] = {
154 24, 53, 97, 105, 119, 210, SEQ_AGAIN
, 222, 240, 292, 317, 353,
155 407, 433, 473, 487, 504, 572, 615, 708, 766, 850, 852, 931, 951,
159 static int64_t seq2_with_again
[] = {
160 51, 59, 68, 77, 91, 121, 139, 170, 179, 266, 352, 454, 478, 631,
161 644, 668, 714, 744, 750, 778, 790, 836, SEQ_AGAIN
, SEQ_END
,
164 static int64_t seq3_with_again
[] = {
165 8, 71, 209, 254, 298, 320, 350, 393, 419, 624, 651, SEQ_AGAIN
,
166 678, 717, 731, 733, 788, 819, 820, 857, 892, 903, 944, 998,
170 static int64_t seq4_with_again
[] = {
171 SEQ_AGAIN
, 41, 56, 120, 138, 154, 228, 471, 479, 481, 525, 591,
172 605, 612, 618, 632, 670, 696, 825, 863, 867, 871, 884, 953, 985,
176 static int64_t seq5
[] = {
177 1, 4, 189, 1001, SEQ_END
,
181 void clear_test_events(void)
183 g_array_set_size(test_events
, 0);
187 void print_test_event(FILE *fp
, const struct test_event
*event
)
189 fprintf(fp
, "{ type = ");
191 switch (event
->type
) {
192 case TEST_EV_TYPE_NOTIF_UNEXPECTED
:
193 fprintf(fp
, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
195 case TEST_EV_TYPE_NOTIF_EVENT
:
196 fprintf(fp
, "TEST_EV_TYPE_NOTIF_EVENT");
198 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
199 fprintf(fp
, "TEST_EV_TYPE_NOTIF_INACTIVITY");
201 case TEST_EV_TYPE_NOTIF_PACKET_BEGIN
:
202 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
204 case TEST_EV_TYPE_NOTIF_PACKET_END
:
205 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_END");
207 case TEST_EV_TYPE_NOTIF_STREAM_BEGIN
:
208 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
210 case TEST_EV_TYPE_NOTIF_STREAM_END
:
211 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_END");
213 case TEST_EV_TYPE_AGAIN
:
214 fprintf(fp
, "TEST_EV_TYPE_AGAIN");
216 case TEST_EV_TYPE_END
:
217 fprintf(fp
, "TEST_EV_TYPE_END");
219 case TEST_EV_TYPE_SENTINEL
:
220 fprintf(fp
, "TEST_EV_TYPE_SENTINEL");
223 fprintf(fp
, "(UNKNOWN)");
227 switch (event
->type
) {
228 case TEST_EV_TYPE_NOTIF_EVENT
:
229 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
230 fprintf(fp
, ", ts-ns = %" PRId64
, event
->ts_ns
);
239 void append_test_event(struct test_event
*event
)
241 g_array_append_val(test_events
, *event
);
245 bool compare_single_test_events(const struct test_event
*ev_a
,
246 const struct test_event
*ev_b
)
249 fprintf(stderr
, ":: Comparing test events: ");
250 print_test_event(stderr
, ev_a
);
251 fprintf(stderr
, " vs. ");
252 print_test_event(stderr
, ev_b
);
253 fprintf(stderr
, "\n");
256 if (ev_a
->type
!= ev_b
->type
) {
260 switch (ev_a
->type
) {
261 case TEST_EV_TYPE_NOTIF_EVENT
:
262 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
263 if (ev_a
->ts_ns
!= ev_b
->ts_ns
) {
275 bool compare_test_events(const struct test_event
*expected_events
)
277 const struct test_event
*expected_event
= expected_events
;
280 assert(expected_events
);
283 const struct test_event
*event
;
285 if (expected_event
->type
== TEST_EV_TYPE_SENTINEL
) {
289 if (i
>= test_events
->len
) {
293 event
= &g_array_index(test_events
, struct test_event
, i
);
295 if (!compare_single_test_events(event
, expected_event
)) {
303 if (i
!= test_events
->len
) {
305 fprintf(stderr
, ":: Length mismatch\n");
315 void init_static_data(void)
318 struct bt_ctf_trace
*trace
;
319 struct bt_ctf_stream
*stream
;
320 struct bt_ctf_field_type
*empty_struct_ft
;
323 test_events
= g_array_new(FALSE
, TRUE
, sizeof(struct test_event
));
327 empty_struct_ft
= bt_ctf_field_type_structure_create();
328 assert(empty_struct_ft
);
329 trace
= bt_ctf_trace_create();
331 ret
= bt_ctf_trace_set_native_byte_order(trace
,
332 BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
);
334 ret
= bt_ctf_trace_set_packet_header_type(trace
, empty_struct_ft
);
336 src_clock_class
= bt_ctf_clock_class_create("my-clock");
337 assert(src_clock_class
);
338 ret
= bt_ctf_clock_class_set_is_absolute(src_clock_class
, 1);
340 ret
= bt_ctf_trace_add_clock_class(trace
, src_clock_class
);
342 src_empty_cc_prio_map
= bt_clock_class_priority_map_create();
343 assert(src_empty_cc_prio_map
);
344 src_cc_prio_map
= bt_clock_class_priority_map_create();
345 assert(src_cc_prio_map
);
346 ret
= bt_clock_class_priority_map_add_clock_class(src_cc_prio_map
,
349 src_stream_class
= bt_ctf_stream_class_create("my-stream-class");
350 assert(src_stream_class
);
351 ret
= bt_ctf_stream_class_set_packet_context_type(src_stream_class
,
354 ret
= bt_ctf_stream_class_set_event_header_type(src_stream_class
,
357 ret
= bt_ctf_stream_class_set_event_context_type(src_stream_class
,
360 src_event_class
= bt_ctf_event_class_create("my-event-class");
361 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
364 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
367 ret
= bt_ctf_stream_class_add_event_class(src_stream_class
,
370 ret
= bt_ctf_trace_add_stream_class(trace
, src_stream_class
);
372 stream
= bt_ctf_stream_create(src_stream_class
, "stream0");
374 src_packet0
= bt_ctf_packet_create(stream
);
377 stream
= bt_ctf_stream_create(src_stream_class
, "stream1");
379 src_packet1
= bt_ctf_packet_create(stream
);
382 stream
= bt_ctf_stream_create(src_stream_class
, "stream2");
384 src_packet2
= bt_ctf_packet_create(stream
);
387 stream
= bt_ctf_stream_create(src_stream_class
, "stream3");
389 src_packet3
= bt_ctf_packet_create(stream
);
394 bt_put(empty_struct_ft
);
398 void fini_static_data(void)
401 g_array_free(test_events
, TRUE
);
404 bt_put(src_empty_cc_prio_map
);
405 bt_put(src_cc_prio_map
);
406 bt_put(src_clock_class
);
407 bt_put(src_stream_class
);
408 bt_put(src_event_class
);
416 void src_iter_finalize(
417 struct bt_private_notification_iterator
*private_notification_iterator
)
419 struct src_iter_user_data
*user_data
=
420 bt_private_notification_iterator_get_user_data(
421 private_notification_iterator
);
429 enum bt_notification_iterator_status
src_iter_init(
430 struct bt_private_notification_iterator
*priv_notif_iter
,
431 struct bt_private_port
*private_port
)
433 struct src_iter_user_data
*user_data
=
434 g_new0(struct src_iter_user_data
, 1);
435 struct bt_port
*port
= bt_port_from_private_port(private_port
);
436 const char *port_name
;
441 ret
= bt_private_notification_iterator_set_user_data(priv_notif_iter
,
444 port_name
= bt_port_get_name(port
);
446 user_data
->iter_index
= port_name
[3] - '0';
449 switch (user_data
->iter_index
) {
451 user_data
->packet
= src_packet0
;
454 user_data
->packet
= src_packet1
;
457 user_data
->packet
= src_packet2
;
460 user_data
->packet
= src_packet3
;
466 switch (current_test
) {
468 if (user_data
->iter_index
== 1) {
469 user_data
->seq
= seq5
;
472 case TEST_SIMPLE_4_PORTS
:
473 if (user_data
->iter_index
== 0) {
474 user_data
->seq
= seq1
;
475 } else if (user_data
->iter_index
== 1) {
476 user_data
->seq
= seq2
;
477 } else if (user_data
->iter_index
== 2) {
478 user_data
->seq
= seq3
;
480 user_data
->seq
= seq4
;
483 case TEST_4_PORTS_WITH_RETRIES
:
484 if (user_data
->iter_index
== 0) {
485 user_data
->seq
= seq1_with_again
;
486 } else if (user_data
->iter_index
== 1) {
487 user_data
->seq
= seq2_with_again
;
488 } else if (user_data
->iter_index
== 2) {
489 user_data
->seq
= seq3_with_again
;
491 user_data
->seq
= seq4_with_again
;
494 case TEST_SINGLE_END_THEN_MULTIPLE_FULL
:
495 case TEST_SINGLE_AGAIN_END_THEN_MULTIPLE_FULL
:
496 if (user_data
->iter_index
== 0) {
497 /* Ignore: this iterator only returns END */
498 } else if (user_data
->iter_index
== 1) {
499 user_data
->seq
= seq2
;
501 user_data
->seq
= seq3
;
508 return BT_NOTIFICATION_ITERATOR_STATUS_OK
;
512 struct bt_ctf_event
*src_create_event(struct bt_ctf_packet
*packet
,
515 struct bt_ctf_event
*event
= bt_ctf_event_create(src_event_class
);
519 ret
= bt_ctf_event_set_packet(event
, packet
);
523 struct bt_ctf_clock_value
*clock_value
;
525 clock_value
= bt_ctf_clock_value_create(src_clock_class
,
528 ret
= bt_ctf_event_set_clock_value(event
, clock_value
);
536 struct bt_notification_iterator_next_return
src_iter_next_seq(
537 struct src_iter_user_data
*user_data
)
539 struct bt_notification_iterator_next_return next_return
= {
540 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
544 assert(user_data
->seq
);
545 cur_ts_ns
= user_data
->seq
[user_data
->at
];
550 BT_NOTIFICATION_ITERATOR_STATUS_END
;
554 BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
;
556 case SEQ_PACKET_BEGIN
:
557 next_return
.notification
=
558 bt_notification_packet_begin_create(user_data
->packet
);
559 assert(next_return
.notification
);
562 next_return
.notification
=
563 bt_notification_packet_end_create(user_data
->packet
);
564 assert(next_return
.notification
);
568 struct bt_ctf_event
*event
= src_create_event(
569 user_data
->packet
, cur_ts_ns
);
572 next_return
.notification
= bt_notification_event_create(event
,
575 assert(next_return
.notification
);
580 if (next_return
.status
!= BT_NOTIFICATION_ITERATOR_STATUS_END
) {
588 struct bt_notification_iterator_next_return
src_iter_next(
589 struct bt_private_notification_iterator
*priv_iterator
)
591 struct bt_notification_iterator_next_return next_return
= {
592 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
593 .notification
= NULL
,
595 struct src_iter_user_data
*user_data
=
596 bt_private_notification_iterator_get_user_data(priv_iterator
);
597 struct bt_private_component
*private_component
=
598 bt_private_notification_iterator_get_private_component(priv_iterator
);
601 assert(private_component
);
603 switch (current_test
) {
605 if (user_data
->iter_index
== 0) {
606 if (user_data
->at
== 0) {
607 next_return
.notification
=
608 bt_notification_packet_begin_create(
610 assert(next_return
.notification
);
611 } else if (user_data
->at
< 6) {
612 struct bt_ctf_event
*event
= src_create_event(
613 user_data
->packet
, -1);
616 next_return
.notification
=
617 bt_notification_event_create(event
,
618 src_empty_cc_prio_map
);
619 assert(next_return
.notification
);
623 BT_NOTIFICATION_ITERATOR_STATUS_END
;
628 next_return
= src_iter_next_seq(user_data
);
631 case TEST_SIMPLE_4_PORTS
:
632 case TEST_4_PORTS_WITH_RETRIES
:
633 next_return
= src_iter_next_seq(user_data
);
635 case TEST_SINGLE_END_THEN_MULTIPLE_FULL
:
636 if (user_data
->iter_index
== 0) {
637 struct bt_private_port
*priv_port
;
639 priv_port
= bt_private_component_source_add_output_private_port(
640 private_component
, "out1", NULL
);
643 priv_port
= bt_private_component_source_add_output_private_port(
644 private_component
, "out2", NULL
);
647 next_return
.status
= BT_NOTIFICATION_ITERATOR_STATUS_END
;
649 next_return
= src_iter_next_seq(user_data
);
652 case TEST_SINGLE_AGAIN_END_THEN_MULTIPLE_FULL
:
653 if (user_data
->iter_index
== 0) {
654 if (user_data
->at
== 0) {
655 next_return
.status
= BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
;
658 struct bt_private_port
*priv_port
;
660 priv_port
= bt_private_component_source_add_output_private_port(
661 private_component
, "out1", NULL
);
664 priv_port
= bt_private_component_source_add_output_private_port(
665 private_component
, "out2", NULL
);
668 next_return
.status
= BT_NOTIFICATION_ITERATOR_STATUS_END
;
671 next_return
= src_iter_next_seq(user_data
);
678 bt_put(private_component
);
683 enum bt_component_status
src_init(
684 struct bt_private_component
*private_component
,
685 struct bt_value
*params
, void *init_method_data
)
687 struct bt_private_port
*priv_port
;
691 priv_port
= bt_private_component_source_get_default_output_private_port(
694 ret
= bt_private_port_remove_from_component(priv_port
);
699 switch (current_test
) {
703 case TEST_SINGLE_END_THEN_MULTIPLE_FULL
:
704 case TEST_SINGLE_AGAIN_END_THEN_MULTIPLE_FULL
:
713 priv_port
= bt_private_component_source_add_output_private_port(
714 private_component
, "out0", NULL
);
720 priv_port
= bt_private_component_source_add_output_private_port(
721 private_component
, "out1", NULL
);
727 priv_port
= bt_private_component_source_add_output_private_port(
728 private_component
, "out2", NULL
);
734 priv_port
= bt_private_component_source_add_output_private_port(
735 private_component
, "out3", NULL
);
740 return BT_COMPONENT_STATUS_OK
;
744 void src_finalize(struct bt_private_component
*private_component
)
749 enum bt_component_status
sink_consume(
750 struct bt_private_component
*priv_component
)
752 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
753 struct bt_notification
*notification
= NULL
;
754 struct sink_user_data
*user_data
=
755 bt_private_component_get_user_data(priv_component
);
756 enum bt_notification_iterator_status it_ret
;
757 struct test_event test_event
;
758 bool do_append_test_event
= true;
760 assert(user_data
&& user_data
->notif_iter
);
761 it_ret
= bt_notification_iterator_next(user_data
->notif_iter
);
764 ret
= BT_COMPONENT_STATUS_ERROR
;
765 do_append_test_event
= false;
770 case BT_NOTIFICATION_ITERATOR_STATUS_END
:
771 test_event
.type
= TEST_EV_TYPE_END
;
772 ret
= BT_COMPONENT_STATUS_END
;
773 BT_PUT(user_data
->notif_iter
);
775 case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
:
776 test_event
.type
= TEST_EV_TYPE_AGAIN
;
777 ret
= BT_COMPONENT_STATUS_AGAIN
;
783 notification
= bt_notification_iterator_get_notification(
784 user_data
->notif_iter
);
785 assert(notification
);
787 switch (bt_notification_get_type(notification
)) {
788 case BT_NOTIFICATION_TYPE_EVENT
:
790 struct bt_ctf_event
*event
;
791 struct bt_clock_class_priority_map
*cc_prio_map
;
793 test_event
.type
= TEST_EV_TYPE_NOTIF_EVENT
;
795 bt_notification_event_get_clock_class_priority_map(
798 event
= bt_notification_event_get_event(notification
);
801 if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map
) > 0) {
802 struct bt_ctf_clock_value
*clock_value
;
803 struct bt_ctf_clock_class
*clock_class
=
804 bt_clock_class_priority_map_get_highest_priority_clock_class(
808 clock_value
= bt_ctf_event_get_clock_value(event
,
811 ret
= bt_ctf_clock_value_get_value_ns_from_epoch(
812 clock_value
, &test_event
.ts_ns
);
817 test_event
.ts_ns
= -1;
824 case BT_NOTIFICATION_TYPE_INACTIVITY
:
826 struct bt_clock_class_priority_map
*cc_prio_map
;
828 test_event
.type
= TEST_EV_TYPE_NOTIF_INACTIVITY
;
829 cc_prio_map
= bt_notification_event_get_clock_class_priority_map(
833 if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map
) > 0) {
834 struct bt_ctf_clock_value
*clock_value
;
835 struct bt_ctf_clock_class
*clock_class
=
836 bt_clock_class_priority_map_get_highest_priority_clock_class(
841 bt_notification_inactivity_get_clock_value(
842 notification
, clock_class
);
844 ret
= bt_ctf_clock_value_get_value_ns_from_epoch(
845 clock_value
, &test_event
.ts_ns
);
850 test_event
.ts_ns
= -1;
856 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
857 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
859 case BT_NOTIFICATION_TYPE_PACKET_END
:
860 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
862 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
863 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
865 case BT_NOTIFICATION_TYPE_STREAM_END
:
866 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
869 test_event
.type
= TEST_EV_TYPE_NOTIF_UNEXPECTED
;
874 if (do_append_test_event
) {
875 append_test_event(&test_event
);
878 bt_put(notification
);
883 void sink_port_connected(struct bt_private_component
*private_component
,
884 struct bt_private_port
*self_private_port
,
885 struct bt_port
*other_port
)
887 struct bt_private_connection
*priv_conn
=
888 bt_private_port_get_private_connection(self_private_port
);
889 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
894 user_data
->notif_iter
=
895 bt_private_connection_create_notification_iterator(priv_conn
);
896 assert(user_data
->notif_iter
);
901 enum bt_component_status
sink_init(
902 struct bt_private_component
*private_component
,
903 struct bt_value
*params
, void *init_method_data
)
905 struct sink_user_data
*user_data
= g_new0(struct sink_user_data
, 1);
909 ret
= bt_private_component_set_user_data(private_component
,
912 return BT_COMPONENT_STATUS_OK
;
916 void sink_finalize(struct bt_private_component
*private_component
)
918 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
922 bt_put(user_data
->notif_iter
);
928 void create_source_muxer_sink(struct bt_component
**source
,
929 struct bt_component
**muxer
,
930 struct bt_component
**sink
)
932 struct bt_component_class
*src_comp_class
;
933 struct bt_component_class
*muxer_comp_class
;
934 struct bt_component_class
*sink_comp_class
;
937 /* Create source component */
938 src_comp_class
= bt_component_class_source_create("src", src_iter_next
);
939 assert(src_comp_class
);
940 ret
= bt_component_class_set_init_method(src_comp_class
, src_init
);
942 ret
= bt_component_class_set_finalize_method(src_comp_class
,
945 ret
= bt_component_class_source_set_notification_iterator_init_method(
946 src_comp_class
, src_iter_init
);
948 ret
= bt_component_class_source_set_notification_iterator_finalize_method(
949 src_comp_class
, src_iter_finalize
);
951 *source
= bt_component_create(src_comp_class
, "source", NULL
);
954 /* Create muxer component */
955 muxer_comp_class
= bt_plugin_find_component_class("utils", "muxer",
956 BT_COMPONENT_CLASS_TYPE_FILTER
);
957 assert(muxer_comp_class
);
958 *muxer
= bt_component_create(muxer_comp_class
, "muxer", NULL
);
961 /* Create sink component */
962 sink_comp_class
= bt_component_class_sink_create("sink", sink_consume
);
963 assert(sink_comp_class
);
964 ret
= bt_component_class_set_init_method(sink_comp_class
, sink_init
);
966 ret
= bt_component_class_set_finalize_method(sink_comp_class
,
968 ret
= bt_component_class_set_port_connected_method(sink_comp_class
,
969 sink_port_connected
);
971 *sink
= bt_component_create(sink_comp_class
, "sink", NULL
);
973 bt_put(src_comp_class
);
974 bt_put(muxer_comp_class
);
975 bt_put(sink_comp_class
);
979 void do_std_test(enum test test
, const char *name
,
980 const struct test_event
*expected_test_events
,
983 struct bt_component
*src_comp
;
984 struct bt_component
*muxer_comp
;
985 struct bt_component
*sink_comp
;
986 struct bt_port
*upstream_port
;
987 struct bt_port
*downstream_port
;
988 struct bt_graph
*graph
;
992 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
996 diag("test: %s", name
);
997 create_source_muxer_sink(&src_comp
, &muxer_comp
, &sink_comp
);
998 graph
= bt_graph_create();
1001 /* Connect source output ports to muxer input ports */
1002 if (with_upstream
) {
1003 count
= bt_component_source_get_output_port_count(src_comp
);
1006 for (i
= 0; i
< count
; i
++) {
1007 upstream_port
= bt_component_source_get_output_port_by_index(
1009 assert(upstream_port
);
1010 downstream_port
= bt_component_filter_get_input_port_by_index(
1012 assert(downstream_port
);
1013 conn
= bt_graph_connect_ports(graph
,
1014 upstream_port
, downstream_port
);
1017 bt_put(upstream_port
);
1018 bt_put(downstream_port
);
1022 /* Connect muxer output port to sink input port */
1023 upstream_port
= bt_component_filter_get_output_port_by_name(muxer_comp
,
1025 assert(upstream_port
);
1026 downstream_port
= bt_component_sink_get_default_input_port(sink_comp
);
1027 assert(downstream_port
);
1028 conn
= bt_graph_connect_ports(graph
, upstream_port
, downstream_port
);
1031 bt_put(upstream_port
);
1032 bt_put(downstream_port
);
1034 while (graph_status
== BT_GRAPH_STATUS_OK
||
1035 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
1036 graph_status
= bt_graph_run(graph
);
1039 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
1040 ok(compare_test_events(expected_test_events
),
1041 "the produced sequence of test events is the expected one");
1050 void test_no_ts(void)
1052 const struct test_event expected_test_events
[] = {
1053 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1054 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1055 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1056 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1057 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= -1, },
1058 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= -1, },
1059 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= -1, },
1060 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= -1, },
1061 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= -1, },
1062 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1063 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1064 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 1, },
1065 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 4, },
1066 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 189, },
1067 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 1001, },
1068 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1069 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1070 { .type
= TEST_EV_TYPE_END
, },
1071 { .type
= TEST_EV_TYPE_SENTINEL
, },
1074 do_std_test(TEST_NO_TS
, "event notifications with no time",
1075 expected_test_events
, true);
1079 void test_no_upstream_connection(void)
1081 const struct test_event expected_test_events
[] = {
1082 { .type
= TEST_EV_TYPE_END
, },
1083 { .type
= TEST_EV_TYPE_SENTINEL
, },
1086 do_std_test(TEST_NO_UPSTREAM_CONNECTION
, "no upstream connection",
1087 expected_test_events
, false);
1091 void test_simple_4_ports(void)
1093 const struct test_event expected_test_events
[] = {
1094 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1095 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1096 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1097 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1098 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1099 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1100 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1101 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1102 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 8 },
1103 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 24 },
1104 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 41 },
1105 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 51 },
1106 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 53 },
1107 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 56 },
1108 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 59 },
1109 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 68 },
1110 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 71 },
1111 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 77 },
1112 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 91 },
1113 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 97 },
1114 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 105 },
1115 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 119 },
1116 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 120 },
1117 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 121 },
1118 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 138 },
1119 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 139 },
1120 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 154 },
1121 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 170 },
1122 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 179 },
1123 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 209 },
1124 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 210 },
1125 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 222 },
1126 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 228 },
1127 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 240 },
1128 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 254 },
1129 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 266 },
1130 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 292 },
1131 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 298 },
1132 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 317 },
1133 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 320 },
1134 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 350 },
1135 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 352 },
1136 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 353 },
1137 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 393 },
1138 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 407 },
1139 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 419 },
1140 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 433 },
1141 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 454 },
1142 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 471 },
1143 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 473 },
1144 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 478 },
1145 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 479 },
1146 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 481 },
1147 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 487 },
1148 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 504 },
1149 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 525 },
1150 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 572 },
1151 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 591 },
1152 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 605 },
1153 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 612 },
1154 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 615 },
1155 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 618 },
1156 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 624 },
1157 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 631 },
1158 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 632 },
1159 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 644 },
1160 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 651 },
1161 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 668 },
1162 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 670 },
1163 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 678 },
1164 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 696 },
1165 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 708 },
1166 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 714 },
1167 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 717 },
1168 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 731 },
1169 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 733 },
1170 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 744 },
1171 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 750 },
1172 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 766 },
1173 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 778 },
1174 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 788 },
1175 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 790 },
1176 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 819 },
1177 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 820 },
1178 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 825 },
1179 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 836 },
1180 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1181 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1182 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 850 },
1183 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 852 },
1184 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 857 },
1185 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 863 },
1186 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 867 },
1187 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 871 },
1188 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 884 },
1189 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 892 },
1190 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 903 },
1191 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 931 },
1192 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 944 },
1193 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 951 },
1194 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 953 },
1195 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 956 },
1196 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 985 },
1197 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 996 },
1198 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1199 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1200 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 998 },
1201 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1202 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1203 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 999 },
1204 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1205 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1206 { .type
= TEST_EV_TYPE_END
, },
1207 { .type
= TEST_EV_TYPE_SENTINEL
, },
1210 do_std_test(TEST_SIMPLE_4_PORTS
, "simple: 4 ports without retries",
1211 expected_test_events
, true);
1215 void test_4_ports_with_retries(void)
1217 const struct test_event expected_test_events
[] = {
1218 { .type
= TEST_EV_TYPE_AGAIN
, },
1219 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1220 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1221 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1222 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1223 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1224 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1225 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1226 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1227 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 8 },
1228 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 24 },
1229 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 41 },
1230 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 51 },
1231 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 53 },
1232 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 56 },
1233 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 59 },
1234 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 68 },
1235 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 71 },
1236 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 77 },
1237 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 91 },
1238 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 97 },
1239 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 105 },
1240 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 119 },
1241 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 120 },
1242 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 121 },
1243 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 138 },
1244 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 139 },
1245 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 154 },
1246 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 170 },
1247 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 179 },
1248 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 209 },
1249 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 210 },
1250 { .type
= TEST_EV_TYPE_AGAIN
, },
1251 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 222 },
1252 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 228 },
1253 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 240 },
1254 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 254 },
1255 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 266 },
1256 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 292 },
1257 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 298 },
1258 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 317 },
1259 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 320 },
1260 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 350 },
1261 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 352 },
1262 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 353 },
1263 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 393 },
1264 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 407 },
1265 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 419 },
1266 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 433 },
1267 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 454 },
1268 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 471 },
1269 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 473 },
1270 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 478 },
1271 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 479 },
1272 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 481 },
1273 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 487 },
1274 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 504 },
1275 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 525 },
1276 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 572 },
1277 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 591 },
1278 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 605 },
1279 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 612 },
1280 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 615 },
1281 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 618 },
1282 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 624 },
1283 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 631 },
1284 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 632 },
1285 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 644 },
1286 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 651 },
1287 { .type
= TEST_EV_TYPE_AGAIN
, },
1288 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 668 },
1289 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 670 },
1290 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 678 },
1291 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 696 },
1292 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 708 },
1293 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 714 },
1294 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 717 },
1295 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 731 },
1296 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 733 },
1297 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 744 },
1298 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 750 },
1299 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 766 },
1300 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 778 },
1301 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 788 },
1302 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 790 },
1303 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 819 },
1304 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 820 },
1305 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 825 },
1306 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 836 },
1307 { .type
= TEST_EV_TYPE_AGAIN
, },
1308 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1309 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1310 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 850 },
1311 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 852 },
1312 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 857 },
1313 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 863 },
1314 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 867 },
1315 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 871 },
1316 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 884 },
1317 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 892 },
1318 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 903 },
1319 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 931 },
1320 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 944 },
1321 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 951 },
1322 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 953 },
1323 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 956 },
1324 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 985 },
1325 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 996 },
1326 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1327 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1328 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 998 },
1329 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1330 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1331 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 999 },
1332 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1333 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1334 { .type
= TEST_EV_TYPE_END
, },
1335 { .type
= TEST_EV_TYPE_SENTINEL
, },
1338 do_std_test(TEST_4_PORTS_WITH_RETRIES
, "4 ports with retries",
1339 expected_test_events
, true);
1343 void connect_port_to_first_avail_muxer_port(struct bt_graph
*graph
,
1344 struct bt_port
*source_port
,
1345 struct bt_component
*muxer_comp
)
1347 struct bt_port
*avail_muxer_port
= NULL
;
1352 count
= bt_component_filter_get_input_port_count(muxer_comp
);
1355 for (i
= 0; i
< count
; i
++) {
1356 struct bt_port
*muxer_port
=
1357 bt_component_filter_get_input_port_by_index(
1362 if (!bt_port_is_connected(muxer_port
)) {
1363 BT_MOVE(avail_muxer_port
, muxer_port
);
1370 conn
= bt_graph_connect_ports(graph
, source_port
, avail_muxer_port
);
1373 bt_put(avail_muxer_port
);
1377 void graph_port_added_listener_connect_to_avail_muxer_port(struct bt_port
*port
,
1380 struct graph_listener_data
*graph_listener_data
= data
;
1381 struct bt_component
*comp
;
1383 comp
= bt_port_get_component(port
);
1386 if (comp
!= graph_listener_data
->source
) {
1390 connect_port_to_first_avail_muxer_port(graph_listener_data
->graph
,
1391 port
, graph_listener_data
->muxer
);
1398 void test_single_end_then_multiple_full(void)
1400 struct bt_component
*src_comp
;
1401 struct bt_component
*muxer_comp
;
1402 struct bt_component
*sink_comp
;
1403 struct bt_port
*upstream_port
;
1404 struct bt_port
*downstream_port
;
1405 struct bt_graph
*graph
;
1410 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
1411 struct graph_listener_data graph_listener_data
;
1412 const struct test_event expected_test_events
[] = {
1413 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1414 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1415 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1416 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1417 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 8 },
1418 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 51 },
1419 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 59 },
1420 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 68 },
1421 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 71 },
1422 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 77 },
1423 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 91 },
1424 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 121 },
1425 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 139 },
1426 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 170 },
1427 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 179 },
1428 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 209 },
1429 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 254 },
1430 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 266 },
1431 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 298 },
1432 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 320 },
1433 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 350 },
1434 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 352 },
1435 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 393 },
1436 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 419 },
1437 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 454 },
1438 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 478 },
1439 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 624 },
1440 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 631 },
1441 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 644 },
1442 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 651 },
1443 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 668 },
1444 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 678 },
1445 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 714 },
1446 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 717 },
1447 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 731 },
1448 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 733 },
1449 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 744 },
1450 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 750 },
1451 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 778 },
1452 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 788 },
1453 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 790 },
1454 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 819 },
1455 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 820 },
1456 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 836 },
1457 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1458 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1459 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 857 },
1460 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 892 },
1461 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 903 },
1462 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 944 },
1463 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 998 },
1464 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1465 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1466 { .type
= TEST_EV_TYPE_END
, },
1467 { .type
= TEST_EV_TYPE_SENTINEL
, },
1470 clear_test_events();
1471 current_test
= TEST_SINGLE_END_THEN_MULTIPLE_FULL
;
1472 diag("test: single end then multiple full");
1473 create_source_muxer_sink(&src_comp
, &muxer_comp
, &sink_comp
);
1474 graph
= bt_graph_create();
1476 graph_listener_data
.graph
= graph
;
1477 graph_listener_data
.source
= src_comp
;
1478 graph_listener_data
.muxer
= muxer_comp
;
1479 graph_listener_data
.sink
= sink_comp
;
1480 ret
= bt_graph_add_port_added_listener(graph
,
1481 graph_port_added_listener_connect_to_avail_muxer_port
,
1482 &graph_listener_data
);
1485 /* Connect source output ports to muxer input ports */
1486 count
= bt_component_source_get_output_port_count(src_comp
);
1489 for (i
= 0; i
< count
; i
++) {
1490 upstream_port
= bt_component_source_get_output_port_by_index(
1492 assert(upstream_port
);
1493 connect_port_to_first_avail_muxer_port(graph
,
1494 upstream_port
, muxer_comp
);
1495 bt_put(upstream_port
);
1498 /* Connect muxer output port to sink input port */
1499 upstream_port
= bt_component_filter_get_output_port_by_name(muxer_comp
,
1501 assert(upstream_port
);
1502 downstream_port
= bt_component_sink_get_default_input_port(sink_comp
);
1503 assert(downstream_port
);
1504 conn
= bt_graph_connect_ports(graph
, upstream_port
, downstream_port
);
1507 bt_put(upstream_port
);
1508 bt_put(downstream_port
);
1510 while (graph_status
== BT_GRAPH_STATUS_OK
||
1511 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
1512 graph_status
= bt_graph_run(graph
);
1515 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
1516 ok(compare_test_events(expected_test_events
),
1517 "the produced sequence of test events is the expected one");
1526 void test_single_again_end_then_multiple_full(void)
1528 struct bt_component
*src_comp
;
1529 struct bt_component
*muxer_comp
;
1530 struct bt_component
*sink_comp
;
1531 struct bt_port
*upstream_port
;
1532 struct bt_port
*downstream_port
;
1533 struct bt_graph
*graph
;
1538 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
1539 struct graph_listener_data graph_listener_data
;
1540 const struct test_event expected_test_events
[] = {
1541 { .type
= TEST_EV_TYPE_AGAIN
, },
1542 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1543 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1544 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, },
1545 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, },
1546 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 8 },
1547 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 51 },
1548 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 59 },
1549 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 68 },
1550 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 71 },
1551 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 77 },
1552 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 91 },
1553 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 121 },
1554 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 139 },
1555 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 170 },
1556 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 179 },
1557 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 209 },
1558 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 254 },
1559 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 266 },
1560 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 298 },
1561 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 320 },
1562 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 350 },
1563 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 352 },
1564 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 393 },
1565 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 419 },
1566 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 454 },
1567 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 478 },
1568 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 624 },
1569 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 631 },
1570 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 644 },
1571 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 651 },
1572 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 668 },
1573 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 678 },
1574 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 714 },
1575 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 717 },
1576 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 731 },
1577 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 733 },
1578 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 744 },
1579 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 750 },
1580 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 778 },
1581 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 788 },
1582 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 790 },
1583 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 819 },
1584 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 820 },
1585 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 836 },
1586 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1587 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1588 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 857 },
1589 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 892 },
1590 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 903 },
1591 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 944 },
1592 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .ts_ns
= 998 },
1593 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, },
1594 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, },
1595 { .type
= TEST_EV_TYPE_END
, },
1596 { .type
= TEST_EV_TYPE_SENTINEL
, },
1599 clear_test_events();
1600 current_test
= TEST_SINGLE_AGAIN_END_THEN_MULTIPLE_FULL
;
1601 diag("test: single again then end then multiple full");
1602 create_source_muxer_sink(&src_comp
, &muxer_comp
, &sink_comp
);
1603 graph
= bt_graph_create();
1605 graph_listener_data
.graph
= graph
;
1606 graph_listener_data
.source
= src_comp
;
1607 graph_listener_data
.muxer
= muxer_comp
;
1608 graph_listener_data
.sink
= sink_comp
;
1609 ret
= bt_graph_add_port_added_listener(graph
,
1610 graph_port_added_listener_connect_to_avail_muxer_port
,
1611 &graph_listener_data
);
1614 /* Connect source output ports to muxer input ports */
1615 count
= bt_component_source_get_output_port_count(src_comp
);
1618 for (i
= 0; i
< count
; i
++) {
1619 upstream_port
= bt_component_source_get_output_port_by_index(
1621 assert(upstream_port
);
1622 connect_port_to_first_avail_muxer_port(graph
,
1623 upstream_port
, muxer_comp
);
1624 bt_put(upstream_port
);
1627 /* Connect muxer output port to sink input port */
1628 upstream_port
= bt_component_filter_get_output_port_by_name(muxer_comp
,
1630 assert(upstream_port
);
1631 downstream_port
= bt_component_sink_get_default_input_port(sink_comp
);
1632 assert(downstream_port
);
1633 conn
= bt_graph_connect_ports(graph
, upstream_port
, downstream_port
);
1636 bt_put(upstream_port
);
1637 bt_put(downstream_port
);
1639 while (graph_status
== BT_GRAPH_STATUS_OK
||
1640 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
1641 graph_status
= bt_graph_run(graph
);
1644 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
1645 ok(compare_test_events(expected_test_events
),
1646 "the produced sequence of test events is the expected one");
1654 #define DEBUG_ENV_VAR "TEST_UTILS_MUXER_DEBUG"
1656 int main(int argc
, char **argv
)
1658 if (getenv(DEBUG_ENV_VAR
) && strcmp(getenv(DEBUG_ENV_VAR
), "1") == 0) {
1662 plan_tests(NR_TESTS
);
1665 test_no_upstream_connection();
1666 test_simple_4_ports();
1667 test_4_ports_with_retries();
1668 test_single_end_then_multiple_full();
1669 test_single_again_end_then_multiple_full();
1671 return exit_status();