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.
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>
33 #include <babeltrace/graph/clock-class-priority-map.h>
34 #include <babeltrace/graph/component-class-filter.h>
35 #include <babeltrace/graph/component-class-sink.h>
36 #include <babeltrace/graph/component-class-source.h>
37 #include <babeltrace/graph/component-class.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/notification-stream.h>
47 #include <babeltrace/graph/port.h>
48 #include <babeltrace/graph/private-component-source.h>
49 #include <babeltrace/graph/private-component-sink.h>
50 #include <babeltrace/graph/private-component.h>
51 #include <babeltrace/graph/private-connection.h>
52 #include <babeltrace/graph/private-notification-iterator.h>
53 #include <babeltrace/graph/private-port.h>
54 #include <babeltrace/plugin/plugin.h>
55 #include <babeltrace/ref.h>
64 TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
65 TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
66 TEST_AUTO_STREAM_END_FROM_END
,
67 TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
68 TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
69 TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
70 TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
71 TEST_AUTO_PACKET_END_FROM_STREAM_END
,
72 TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
73 TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
74 TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
77 enum test_event_type
{
78 TEST_EV_TYPE_NOTIF_UNEXPECTED
,
79 TEST_EV_TYPE_NOTIF_EVENT
,
80 TEST_EV_TYPE_NOTIF_INACTIVITY
,
81 TEST_EV_TYPE_NOTIF_STREAM_BEGIN
,
82 TEST_EV_TYPE_NOTIF_PACKET_BEGIN
,
83 TEST_EV_TYPE_NOTIF_PACKET_END
,
84 TEST_EV_TYPE_NOTIF_STREAM_END
,
86 TEST_EV_TYPE_SENTINEL
,
90 enum test_event_type type
;
91 struct bt_ctf_stream
*stream
;
92 struct bt_ctf_packet
*packet
;
95 struct source_muxer_sink
{
96 struct bt_component
*source
;
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_empty_cc_prio_map
;
104 static struct bt_ctf_stream_class
*src_stream_class
;
105 static struct bt_ctf_event_class
*src_event_class
;
106 static struct bt_ctf_stream
*src_stream1
;
107 static struct bt_ctf_stream
*src_stream2
;
108 static struct bt_ctf_packet
*src_stream1_packet1
;
109 static struct bt_ctf_packet
*src_stream1_packet2
;
110 static struct bt_ctf_packet
*src_stream2_packet1
;
111 static struct bt_ctf_packet
*src_stream2_packet2
;
115 SEQ_STREAM1_BEGIN
= -2,
116 SEQ_STREAM2_BEGIN
= -3,
117 SEQ_STREAM1_END
= -4,
118 SEQ_STREAM2_END
= -5,
119 SEQ_STREAM1_PACKET1_BEGIN
= -6,
120 SEQ_STREAM1_PACKET2_BEGIN
= -7,
121 SEQ_STREAM2_PACKET1_BEGIN
= -8,
122 SEQ_STREAM2_PACKET2_BEGIN
= -9,
123 SEQ_STREAM1_PACKET1_END
= -10,
124 SEQ_STREAM1_PACKET2_END
= -11,
125 SEQ_STREAM2_PACKET1_END
= -12,
126 SEQ_STREAM2_PACKET2_END
= -13,
127 SEQ_EVENT_STREAM1_PACKET1
= -14,
128 SEQ_EVENT_STREAM1_PACKET2
= -15,
129 SEQ_EVENT_STREAM2_PACKET1
= -16,
130 SEQ_EVENT_STREAM2_PACKET2
= -17,
131 SEQ_INACTIVITY
= -18,
134 struct src_iter_user_data
{
139 struct sink_user_data
{
140 struct bt_notification_iterator
*notif_iter
;
144 * No automatic notifications generated in this block.
145 * Stream 2 notifications are more indented.
147 static int64_t seq_no_auto_notifs
[] = {
149 SEQ_STREAM1_PACKET1_BEGIN
,
150 SEQ_EVENT_STREAM1_PACKET1
,
151 SEQ_EVENT_STREAM1_PACKET1
,
153 SEQ_EVENT_STREAM1_PACKET1
,
154 SEQ_STREAM2_PACKET2_BEGIN
,
155 SEQ_EVENT_STREAM2_PACKET2
,
156 SEQ_EVENT_STREAM1_PACKET1
,
157 SEQ_STREAM1_PACKET1_END
,
158 SEQ_STREAM2_PACKET2_END
,
159 SEQ_STREAM1_PACKET2_BEGIN
,
160 SEQ_EVENT_STREAM1_PACKET2
,
162 SEQ_STREAM1_PACKET2_END
,
167 /* Automatic "stream begin" from "packet begin" */
168 static int64_t seq_auto_stream_begin_from_packet_begin
[] = {
169 /* Automatic "stream begin" here */
170 SEQ_STREAM1_PACKET1_BEGIN
,
171 SEQ_STREAM1_PACKET1_END
,
176 /* Automatic "stream begin" from "stream end" */
177 static int64_t seq_auto_stream_begin_from_stream_end
[] = {
178 /* Automatic "stream begin" here */
183 /* Automatic "stream end" from END */
184 static int64_t seq_auto_stream_end_from_end
[] = {
186 /* Automatic "packet end" here */
190 /* Automatic "packet begin" from "packet end" */
191 static int64_t seq_auto_packet_begin_from_packet_end
[] = {
193 /* Automatic "packet begin" here */
194 SEQ_STREAM1_PACKET1_END
,
199 /* Automatic "packet begin" from event */
200 static int64_t seq_auto_packet_begin_from_event
[] = {
202 /* Automatic "packet begin" here */
203 SEQ_EVENT_STREAM1_PACKET1
,
204 SEQ_STREAM1_PACKET1_END
,
209 /* Automatic "packet end" from "packet begin" */
210 static int64_t seq_auto_packet_end_from_packet_begin
[] = {
212 SEQ_STREAM1_PACKET1_BEGIN
,
213 /* Automatic "packet end" here */
214 SEQ_STREAM1_PACKET2_BEGIN
,
215 SEQ_STREAM1_PACKET2_END
,
220 /* Automatic "packet end" and "packet begin" from event */
221 static int64_t seq_auto_packet_end_packet_begin_from_event
[] = {
223 SEQ_STREAM1_PACKET1_BEGIN
,
224 /* Automatic "packet end" here */
225 /* Automatic "packet begin" here */
226 SEQ_EVENT_STREAM1_PACKET2
,
227 SEQ_STREAM1_PACKET2_END
,
232 /* Automatic "packet end" from "stream end" */
233 static int64_t seq_auto_packet_end_from_stream_end
[] = {
235 SEQ_STREAM1_PACKET1_BEGIN
,
236 /* Automatic "packet end" here */
241 /* Automatic "packet end" and "stream end" from END */
242 static int64_t seq_auto_packet_end_stream_end_from_end
[] = {
244 SEQ_STREAM1_PACKET1_BEGIN
,
245 /* Automatic "packet end" here */
246 /* Automatic "stream end" here */
250 /* Multiple automatic "stream end" from END */
251 static int64_t seq_multiple_auto_stream_end_from_end
[] = {
254 /* Automatic "stream end" here */
255 /* Automatic "stream end" here */
259 /* Multiple automatic "packet end" and "stream end" from END */
260 static int64_t seq_multiple_auto_packet_end_stream_end_from_end
[] = {
263 SEQ_STREAM1_PACKET1_BEGIN
,
264 SEQ_STREAM2_PACKET1_BEGIN
,
265 /* Automatic "packet end" here */
266 /* Automatic "stream end" here */
267 /* Automatic "packet end" here */
268 /* Automatic "stream end" here */
273 void clear_test_events(void)
275 g_array_set_size(test_events
, 0);
279 void print_test_event(FILE *fp
, const struct test_event
*event
)
281 fprintf(fp
, "{ type = ");
283 switch (event
->type
) {
284 case TEST_EV_TYPE_NOTIF_UNEXPECTED
:
285 fprintf(fp
, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
287 case TEST_EV_TYPE_NOTIF_EVENT
:
288 fprintf(fp
, "TEST_EV_TYPE_NOTIF_EVENT");
290 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
291 fprintf(fp
, "TEST_EV_TYPE_NOTIF_INACTIVITY");
293 case TEST_EV_TYPE_NOTIF_STREAM_BEGIN
:
294 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
296 case TEST_EV_TYPE_NOTIF_STREAM_END
:
297 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_END");
299 case TEST_EV_TYPE_NOTIF_PACKET_BEGIN
:
300 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
302 case TEST_EV_TYPE_NOTIF_PACKET_END
:
303 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_END");
305 case TEST_EV_TYPE_END
:
306 fprintf(fp
, "TEST_EV_TYPE_END");
308 case TEST_EV_TYPE_SENTINEL
:
309 fprintf(fp
, "TEST_EV_TYPE_SENTINEL");
312 fprintf(fp
, "(UNKNOWN)");
316 fprintf(fp
, ", stream = %p, packet = %p }", event
->stream
,
321 void append_test_event(struct test_event
*event
)
323 g_array_append_val(test_events
, *event
);
327 bool compare_single_test_events(const struct test_event
*ev_a
,
328 const struct test_event
*ev_b
)
331 fprintf(stderr
, ":: Comparing test events: ");
332 print_test_event(stderr
, ev_a
);
333 fprintf(stderr
, " vs. ");
334 print_test_event(stderr
, ev_b
);
335 fprintf(stderr
, "\n");
338 if (ev_a
->type
!= ev_b
->type
) {
342 switch (ev_a
->type
) {
343 case TEST_EV_TYPE_END
:
344 case TEST_EV_TYPE_SENTINEL
:
347 if (ev_a
->stream
!= ev_b
->stream
) {
351 if (ev_a
->packet
!= ev_b
->packet
) {
361 bool compare_test_events(const struct test_event
*expected_events
)
363 const struct test_event
*expected_event
= expected_events
;
366 assert(expected_events
);
369 const struct test_event
*event
;
371 if (expected_event
->type
== TEST_EV_TYPE_SENTINEL
) {
375 if (i
>= test_events
->len
) {
379 event
= &g_array_index(test_events
, struct test_event
, i
);
381 if (!compare_single_test_events(event
, expected_event
)) {
389 if (i
!= test_events
->len
) {
397 void init_static_data(void)
400 struct bt_ctf_trace
*trace
;
401 struct bt_ctf_field_type
*empty_struct_ft
;
404 test_events
= g_array_new(FALSE
, TRUE
, sizeof(struct test_event
));
408 empty_struct_ft
= bt_ctf_field_type_structure_create();
409 assert(empty_struct_ft
);
410 trace
= bt_ctf_trace_create();
412 ret
= bt_ctf_trace_set_packet_header_type(trace
, empty_struct_ft
);
414 src_empty_cc_prio_map
= bt_clock_class_priority_map_create();
415 assert(src_empty_cc_prio_map
);
416 src_stream_class
= bt_ctf_stream_class_create("my-stream-class");
417 assert(src_stream_class
);
418 ret
= bt_ctf_stream_class_set_packet_context_type(src_stream_class
,
421 ret
= bt_ctf_stream_class_set_event_header_type(src_stream_class
,
424 ret
= bt_ctf_stream_class_set_event_context_type(src_stream_class
,
427 src_event_class
= bt_ctf_event_class_create("my-event-class");
428 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
431 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
434 ret
= bt_ctf_stream_class_add_event_class(src_stream_class
,
437 ret
= bt_ctf_trace_add_stream_class(trace
, src_stream_class
);
439 src_stream1
= bt_ctf_stream_create(src_stream_class
, "stream-1");
441 src_stream2
= bt_ctf_stream_create(src_stream_class
, "stream-2");
443 src_stream1_packet1
= bt_ctf_packet_create(src_stream1
);
444 assert(src_stream1_packet1
);
445 src_stream1_packet2
= bt_ctf_packet_create(src_stream1
);
446 assert(src_stream1_packet2
);
447 src_stream2_packet1
= bt_ctf_packet_create(src_stream2
);
448 assert(src_stream2_packet1
);
449 src_stream2_packet2
= bt_ctf_packet_create(src_stream2
);
450 assert(src_stream2_packet2
);
453 fprintf(stderr
, ":: stream 1: %p\n", src_stream1
);
454 fprintf(stderr
, ":: stream 2: %p\n", src_stream2
);
455 fprintf(stderr
, ":: stream 1, packet 1: %p\n", src_stream1_packet1
);
456 fprintf(stderr
, ":: stream 1, packet 2: %p\n", src_stream1_packet2
);
457 fprintf(stderr
, ":: stream 2, packet 1: %p\n", src_stream2_packet1
);
458 fprintf(stderr
, ":: stream 2, packet 2: %p\n", src_stream2_packet2
);
462 bt_put(empty_struct_ft
);
466 void fini_static_data(void)
469 g_array_free(test_events
, TRUE
);
472 bt_put(src_empty_cc_prio_map
);
473 bt_put(src_stream_class
);
474 bt_put(src_event_class
);
477 bt_put(src_stream1_packet1
);
478 bt_put(src_stream1_packet2
);
479 bt_put(src_stream2_packet1
);
480 bt_put(src_stream2_packet2
);
484 void src_iter_finalize(
485 struct bt_private_notification_iterator
*private_notification_iterator
)
487 struct src_iter_user_data
*user_data
=
488 bt_private_notification_iterator_get_user_data(
489 private_notification_iterator
);
497 enum bt_notification_iterator_status
src_iter_init(
498 struct bt_private_notification_iterator
*priv_notif_iter
,
499 struct bt_private_port
*private_port
)
501 struct src_iter_user_data
*user_data
=
502 g_new0(struct src_iter_user_data
, 1);
506 ret
= bt_private_notification_iterator_set_user_data(priv_notif_iter
,
510 switch (current_test
) {
511 case TEST_NO_AUTO_NOTIFS
:
512 user_data
->seq
= seq_no_auto_notifs
;
514 case TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
:
515 user_data
->seq
= seq_auto_stream_begin_from_packet_begin
;
517 case TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
:
518 user_data
->seq
= seq_auto_stream_begin_from_stream_end
;
520 case TEST_AUTO_STREAM_END_FROM_END
:
521 user_data
->seq
= seq_auto_stream_end_from_end
;
523 case TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
:
524 user_data
->seq
= seq_auto_packet_begin_from_packet_end
;
526 case TEST_AUTO_PACKET_BEGIN_FROM_EVENT
:
527 user_data
->seq
= seq_auto_packet_begin_from_event
;
529 case TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
:
530 user_data
->seq
= seq_auto_packet_end_from_packet_begin
;
532 case TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
:
533 user_data
->seq
= seq_auto_packet_end_packet_begin_from_event
;
535 case TEST_AUTO_PACKET_END_FROM_STREAM_END
:
536 user_data
->seq
= seq_auto_packet_end_from_stream_end
;
538 case TEST_AUTO_PACKET_END_STREAM_END_FROM_END
:
539 user_data
->seq
= seq_auto_packet_end_stream_end_from_end
;
541 case TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
:
542 user_data
->seq
= seq_multiple_auto_stream_end_from_end
;
544 case TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
:
545 user_data
->seq
= seq_multiple_auto_packet_end_stream_end_from_end
;
551 return BT_NOTIFICATION_ITERATOR_STATUS_OK
;
555 struct bt_ctf_event
*src_create_event(struct bt_ctf_packet
*packet
)
557 struct bt_ctf_event
*event
= bt_ctf_event_create(src_event_class
);
561 ret
= bt_ctf_event_set_packet(event
, packet
);
567 struct bt_notification_iterator_next_return
src_iter_next_seq(
568 struct src_iter_user_data
*user_data
)
570 struct bt_notification_iterator_next_return next_return
= {
571 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
574 struct bt_ctf_packet
*event_packet
= NULL
;
576 assert(user_data
->seq
);
577 cur_ts_ns
= user_data
->seq
[user_data
->at
];
582 BT_NOTIFICATION_ITERATOR_STATUS_END
;
585 next_return
.notification
=
586 bt_notification_inactivity_create(src_empty_cc_prio_map
);
587 assert(next_return
.notification
);
589 case SEQ_STREAM1_BEGIN
:
590 next_return
.notification
=
591 bt_notification_stream_begin_create(src_stream1
);
592 assert(next_return
.notification
);
594 case SEQ_STREAM2_BEGIN
:
595 next_return
.notification
=
596 bt_notification_stream_begin_create(src_stream2
);
597 assert(next_return
.notification
);
599 case SEQ_STREAM1_END
:
600 next_return
.notification
=
601 bt_notification_stream_end_create(src_stream1
);
602 assert(next_return
.notification
);
604 case SEQ_STREAM2_END
:
605 next_return
.notification
=
606 bt_notification_stream_end_create(src_stream2
);
607 assert(next_return
.notification
);
609 case SEQ_STREAM1_PACKET1_BEGIN
:
610 next_return
.notification
=
611 bt_notification_packet_begin_create(src_stream1_packet1
);
612 assert(next_return
.notification
);
614 case SEQ_STREAM1_PACKET2_BEGIN
:
615 next_return
.notification
=
616 bt_notification_packet_begin_create(src_stream1_packet2
);
617 assert(next_return
.notification
);
619 case SEQ_STREAM2_PACKET1_BEGIN
:
620 next_return
.notification
=
621 bt_notification_packet_begin_create(src_stream2_packet1
);
622 assert(next_return
.notification
);
624 case SEQ_STREAM2_PACKET2_BEGIN
:
625 next_return
.notification
=
626 bt_notification_packet_begin_create(src_stream2_packet2
);
627 assert(next_return
.notification
);
629 case SEQ_STREAM1_PACKET1_END
:
630 next_return
.notification
=
631 bt_notification_packet_end_create(src_stream1_packet1
);
632 assert(next_return
.notification
);
634 case SEQ_STREAM1_PACKET2_END
:
635 next_return
.notification
=
636 bt_notification_packet_end_create(src_stream1_packet2
);
637 assert(next_return
.notification
);
639 case SEQ_STREAM2_PACKET1_END
:
640 next_return
.notification
=
641 bt_notification_packet_end_create(src_stream2_packet1
);
642 assert(next_return
.notification
);
644 case SEQ_STREAM2_PACKET2_END
:
645 next_return
.notification
=
646 bt_notification_packet_end_create(src_stream2_packet2
);
647 assert(next_return
.notification
);
649 case SEQ_EVENT_STREAM1_PACKET1
:
650 event_packet
= src_stream1_packet1
;
652 case SEQ_EVENT_STREAM1_PACKET2
:
653 event_packet
= src_stream1_packet2
;
655 case SEQ_EVENT_STREAM2_PACKET1
:
656 event_packet
= src_stream2_packet1
;
658 case SEQ_EVENT_STREAM2_PACKET2
:
659 event_packet
= src_stream2_packet2
;
666 struct bt_ctf_event
*event
= src_create_event(event_packet
);
669 next_return
.notification
= bt_notification_event_create(event
,
670 src_empty_cc_prio_map
);
672 assert(next_return
.notification
);
675 if (next_return
.status
!= BT_NOTIFICATION_ITERATOR_STATUS_END
) {
683 struct bt_notification_iterator_next_return
src_iter_next(
684 struct bt_private_notification_iterator
*priv_iterator
)
686 struct bt_notification_iterator_next_return next_return
= {
687 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
688 .notification
= NULL
,
690 struct src_iter_user_data
*user_data
=
691 bt_private_notification_iterator_get_user_data(priv_iterator
);
694 next_return
= src_iter_next_seq(user_data
);
699 enum bt_component_status
src_init(
700 struct bt_private_component
*private_component
,
701 struct bt_value
*params
, void *init_method_data
)
705 ret
= bt_private_component_source_add_output_private_port(
706 private_component
, "out", NULL
, NULL
);
708 return BT_COMPONENT_STATUS_OK
;
712 void src_finalize(struct bt_private_component
*private_component
)
717 enum bt_component_status
sink_consume(
718 struct bt_private_component
*priv_component
)
720 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
721 struct bt_notification
*notification
= NULL
;
722 struct sink_user_data
*user_data
=
723 bt_private_component_get_user_data(priv_component
);
724 enum bt_notification_iterator_status it_ret
;
725 struct test_event test_event
= { 0 };
726 bool do_append_test_event
= true;
728 assert(user_data
&& user_data
->notif_iter
);
729 it_ret
= bt_notification_iterator_next(user_data
->notif_iter
);
732 ret
= BT_COMPONENT_STATUS_ERROR
;
733 do_append_test_event
= false;
738 case BT_NOTIFICATION_ITERATOR_STATUS_END
:
739 test_event
.type
= TEST_EV_TYPE_END
;
740 ret
= BT_COMPONENT_STATUS_END
;
741 BT_PUT(user_data
->notif_iter
);
743 case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
:
749 notification
= bt_notification_iterator_get_notification(
750 user_data
->notif_iter
);
751 assert(notification
);
753 switch (bt_notification_get_type(notification
)) {
754 case BT_NOTIFICATION_TYPE_EVENT
:
756 struct bt_ctf_event
*event
;
758 test_event
.type
= TEST_EV_TYPE_NOTIF_EVENT
;
759 event
= bt_notification_event_get_event(notification
);
761 test_event
.packet
= bt_ctf_event_get_packet(event
);
763 assert(test_event
.packet
);
764 bt_put(test_event
.packet
);
767 case BT_NOTIFICATION_TYPE_INACTIVITY
:
768 test_event
.type
= TEST_EV_TYPE_NOTIF_INACTIVITY
;
770 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
771 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
773 bt_notification_stream_begin_get_stream(notification
);
774 assert(test_event
.stream
);
775 bt_put(test_event
.stream
);
777 case BT_NOTIFICATION_TYPE_STREAM_END
:
778 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
780 bt_notification_stream_end_get_stream(notification
);
781 assert(test_event
.stream
);
782 bt_put(test_event
.stream
);
784 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
785 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
787 bt_notification_packet_begin_get_packet(notification
);
788 assert(test_event
.packet
);
789 bt_put(test_event
.packet
);
791 case BT_NOTIFICATION_TYPE_PACKET_END
:
792 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
794 bt_notification_packet_end_get_packet(notification
);
795 assert(test_event
.packet
);
796 bt_put(test_event
.packet
);
799 test_event
.type
= TEST_EV_TYPE_NOTIF_UNEXPECTED
;
803 if (test_event
.packet
) {
804 test_event
.stream
= bt_ctf_packet_get_stream(test_event
.packet
);
805 assert(test_event
.stream
);
806 bt_put(test_event
.stream
);
810 if (do_append_test_event
) {
811 append_test_event(&test_event
);
814 bt_put(notification
);
819 void sink_port_connected(struct bt_private_component
*private_component
,
820 struct bt_private_port
*self_private_port
,
821 struct bt_port
*other_port
)
823 struct bt_private_connection
*priv_conn
=
824 bt_private_port_get_private_connection(self_private_port
);
825 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
830 user_data
->notif_iter
=
831 bt_private_connection_create_notification_iterator(priv_conn
,
833 assert(user_data
->notif_iter
);
838 enum bt_component_status
sink_init(
839 struct bt_private_component
*private_component
,
840 struct bt_value
*params
, void *init_method_data
)
842 struct sink_user_data
*user_data
= g_new0(struct sink_user_data
, 1);
846 ret
= bt_private_component_set_user_data(private_component
,
849 ret
= bt_private_component_sink_add_input_private_port(
850 private_component
, "in", NULL
, NULL
);
852 return BT_COMPONENT_STATUS_OK
;
856 void sink_finalize(struct bt_private_component
*private_component
)
858 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
862 bt_put(user_data
->notif_iter
);
868 void create_source_sink(struct bt_component
**source
,
869 struct bt_component
**sink
)
871 struct bt_component_class
*src_comp_class
;
872 struct bt_component_class
*sink_comp_class
;
875 /* Create source component */
876 src_comp_class
= bt_component_class_source_create("src", src_iter_next
);
877 assert(src_comp_class
);
878 ret
= bt_component_class_set_init_method(src_comp_class
, src_init
);
880 ret
= bt_component_class_set_finalize_method(src_comp_class
,
883 ret
= bt_component_class_source_set_notification_iterator_init_method(
884 src_comp_class
, src_iter_init
);
886 ret
= bt_component_class_source_set_notification_iterator_finalize_method(
887 src_comp_class
, src_iter_finalize
);
889 *source
= bt_component_create(src_comp_class
, "source", NULL
);
892 /* Create sink component */
893 sink_comp_class
= bt_component_class_sink_create("sink", sink_consume
);
894 assert(sink_comp_class
);
895 ret
= bt_component_class_set_init_method(sink_comp_class
, sink_init
);
897 ret
= bt_component_class_set_finalize_method(sink_comp_class
,
899 ret
= bt_component_class_set_port_connected_method(sink_comp_class
,
900 sink_port_connected
);
902 *sink
= bt_component_create(sink_comp_class
, "sink", NULL
);
904 bt_put(src_comp_class
);
905 bt_put(sink_comp_class
);
909 void do_std_test(enum test test
, const char *name
,
910 const struct test_event
*expected_test_events
)
912 struct bt_component
*src_comp
;
913 struct bt_component
*sink_comp
;
914 struct bt_port
*upstream_port
;
915 struct bt_port
*downstream_port
;
916 struct bt_graph
*graph
;
917 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
921 diag("test: %s", name
);
922 create_source_sink(&src_comp
, &sink_comp
);
923 graph
= bt_graph_create();
926 /* Connect source to sink */
927 upstream_port
= bt_component_source_get_output_port_by_name(src_comp
, "out");
928 assert(upstream_port
);
929 downstream_port
= bt_component_sink_get_input_port_by_name(sink_comp
, "in");
930 assert(downstream_port
);
931 graph_status
= bt_graph_connect_ports(graph
, upstream_port
,
932 downstream_port
, NULL
);
933 bt_put(upstream_port
);
934 bt_put(downstream_port
);
936 /* Run the graph until the end */
937 while (graph_status
== BT_GRAPH_STATUS_OK
||
938 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
939 graph_status
= bt_graph_run(graph
);
942 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
944 /* Compare the resulting test events */
945 if (expected_test_events
) {
946 ok(compare_test_events(expected_test_events
),
947 "the produced sequence of test events is the expected one");
956 void test_no_auto_notifs(void)
958 const struct test_event expected_test_events
[] = {
959 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
960 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
961 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
962 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
963 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream2
, .packet
= NULL
, },
964 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
965 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
966 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
967 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
968 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
969 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
970 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
971 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
972 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream2
, .packet
= NULL
, },
973 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
974 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
975 { .type
= TEST_EV_TYPE_END
, },
976 { .type
= TEST_EV_TYPE_SENTINEL
, },
979 do_std_test(TEST_NO_AUTO_NOTIFS
, "no automatic notifications",
980 expected_test_events
);
984 void test_auto_stream_begin_from_packet_begin(void)
986 const struct test_event expected_test_events
[] = {
987 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
988 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
989 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
990 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
991 { .type
= TEST_EV_TYPE_END
, },
992 { .type
= TEST_EV_TYPE_SENTINEL
, },
995 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
996 "automatic \"stream begin\" notif. caused by \"packet begin\" notif.",
997 expected_test_events
);
1001 void test_auto_stream_begin_from_stream_end(void)
1003 const struct test_event expected_test_events
[] = {
1004 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1005 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1006 { .type
= TEST_EV_TYPE_END
, },
1007 { .type
= TEST_EV_TYPE_SENTINEL
, },
1010 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
1011 "automatic \"stream begin\" notif. caused by \"stream end\" notif.",
1012 expected_test_events
);
1016 void test_auto_stream_end_from_end(void)
1018 const struct test_event expected_test_events
[] = {
1019 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1020 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1021 { .type
= TEST_EV_TYPE_END
, },
1022 { .type
= TEST_EV_TYPE_SENTINEL
, },
1025 do_std_test(TEST_AUTO_STREAM_END_FROM_END
,
1026 "automatic \"stream end\" notif. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1027 expected_test_events
);
1031 void test_auto_packet_begin_from_packet_end(void)
1033 const struct test_event expected_test_events
[] = {
1034 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1035 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1036 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1037 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1038 { .type
= TEST_EV_TYPE_END
, },
1039 { .type
= TEST_EV_TYPE_SENTINEL
, },
1042 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
1043 "automatic \"packet begin\" notif. caused by \"packet end\" notif.",
1044 expected_test_events
);
1048 void test_auto_packet_begin_from_event(void)
1050 const struct test_event expected_test_events
[] = {
1051 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1052 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1053 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1054 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1055 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1056 { .type
= TEST_EV_TYPE_END
, },
1057 { .type
= TEST_EV_TYPE_SENTINEL
, },
1060 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
1061 "automatic \"packet begin\" notif. caused by event notif.",
1062 expected_test_events
);
1066 void test_auto_packet_end_from_packet_begin(void)
1068 const struct test_event expected_test_events
[] = {
1069 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1070 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1071 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1072 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1073 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1074 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1075 { .type
= TEST_EV_TYPE_END
, },
1076 { .type
= TEST_EV_TYPE_SENTINEL
, },
1079 do_std_test(TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
1080 "automatic \"packet end\" notif. caused by \"packet begin\" notif.",
1081 expected_test_events
);
1085 void test_auto_packet_end_packet_begin_from_event(void)
1087 const struct test_event expected_test_events
[] = {
1088 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1089 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1090 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1091 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1092 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1093 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1094 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1095 { .type
= TEST_EV_TYPE_END
, },
1096 { .type
= TEST_EV_TYPE_SENTINEL
, },
1099 do_std_test(TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
1100 "automatic \"packet end\" and \"packet begin\" notifs. caused by event notif.",
1101 expected_test_events
);
1105 void test_auto_packet_end_from_stream_end(void)
1107 const struct test_event expected_test_events
[] = {
1108 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1109 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1110 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1111 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1112 { .type
= TEST_EV_TYPE_END
, },
1113 { .type
= TEST_EV_TYPE_SENTINEL
, },
1116 do_std_test(TEST_AUTO_PACKET_END_FROM_STREAM_END
,
1117 "automatic \"packet end\" notif. caused by \"stream end\" notif.",
1118 expected_test_events
);
1122 void test_auto_packet_end_stream_end_from_end(void)
1124 const struct test_event expected_test_events
[] = {
1125 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1126 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1127 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1128 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1129 { .type
= TEST_EV_TYPE_END
, },
1130 { .type
= TEST_EV_TYPE_SENTINEL
, },
1133 do_std_test(TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
1134 "automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1135 expected_test_events
);
1139 void test_multiple_auto_stream_end_from_end(void)
1141 bool expected
= true;
1142 struct test_event expected_event
;
1143 struct test_event expected_event2
;
1144 struct test_event
*event
;
1145 struct test_event
*event2
;
1147 do_std_test(TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
1148 "multiple automatic \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1151 if (test_events
->len
!= 5) {
1156 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1157 expected_event
.stream
= src_stream1
;
1158 expected_event
.packet
= NULL
;
1159 event
= &g_array_index(test_events
, struct test_event
, 0);
1160 if (!compare_single_test_events(event
, &expected_event
)) {
1165 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1166 expected_event
.stream
= src_stream2
;
1167 expected_event
.packet
= NULL
;
1168 event
= &g_array_index(test_events
, struct test_event
, 1);
1169 if (!compare_single_test_events(event
, &expected_event
)) {
1174 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1175 expected_event
.stream
= src_stream1
;
1176 expected_event
.packet
= NULL
;
1177 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1178 expected_event2
.stream
= src_stream2
;
1179 expected_event2
.packet
= NULL
;
1180 event
= &g_array_index(test_events
, struct test_event
, 2);
1181 event2
= &g_array_index(test_events
, struct test_event
, 3);
1182 if (!(compare_single_test_events(event
, &expected_event
) &&
1183 compare_single_test_events(event2
, &expected_event2
)) &&
1184 !(compare_single_test_events(event2
, &expected_event
) &&
1185 compare_single_test_events(event
, &expected_event2
))) {
1190 expected_event
.type
= TEST_EV_TYPE_END
;
1191 expected_event
.stream
= NULL
;
1192 expected_event
.packet
= NULL
;
1193 event
= &g_array_index(test_events
, struct test_event
, 4);
1194 if (!compare_single_test_events(event
, &expected_event
)) {
1201 "the produced sequence of test events is the expected one");
1205 void test_multiple_auto_packet_end_stream_end_from_end(void)
1207 bool expected
= true;
1208 struct test_event expected_event
;
1209 struct test_event expected_event2
;
1210 struct test_event
*event
;
1211 struct test_event
*event2
;
1213 do_std_test(TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
1214 "multiple automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1217 if (test_events
->len
!= 9) {
1222 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1223 expected_event
.stream
= src_stream1
;
1224 expected_event
.packet
= NULL
;
1225 event
= &g_array_index(test_events
, struct test_event
, 0);
1226 if (!compare_single_test_events(event
, &expected_event
)) {
1231 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1232 expected_event
.stream
= src_stream2
;
1233 expected_event
.packet
= NULL
;
1234 event
= &g_array_index(test_events
, struct test_event
, 1);
1235 if (!compare_single_test_events(event
, &expected_event
)) {
1240 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1241 expected_event
.stream
= src_stream1
;
1242 expected_event
.packet
= src_stream1_packet1
;
1243 event
= &g_array_index(test_events
, struct test_event
, 2);
1244 if (!compare_single_test_events(event
, &expected_event
)) {
1249 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1250 expected_event
.stream
= src_stream2
;
1251 expected_event
.packet
= src_stream2_packet1
;
1252 event
= &g_array_index(test_events
, struct test_event
, 3);
1253 if (!compare_single_test_events(event
, &expected_event
)) {
1258 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1259 expected_event
.stream
= src_stream1
;
1260 expected_event
.packet
= src_stream1_packet1
;
1261 expected_event2
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1262 expected_event2
.stream
= src_stream2
;
1263 expected_event2
.packet
= src_stream2_packet1
;
1264 event
= &g_array_index(test_events
, struct test_event
, 4);
1265 event2
= &g_array_index(test_events
, struct test_event
, 6);
1266 if (!(compare_single_test_events(event
, &expected_event
) &&
1267 compare_single_test_events(event2
, &expected_event2
)) &&
1268 !(compare_single_test_events(event2
, &expected_event
) &&
1269 compare_single_test_events(event
, &expected_event2
))) {
1274 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1275 expected_event
.stream
= src_stream1
;
1276 expected_event
.packet
= NULL
;
1277 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1278 expected_event2
.stream
= src_stream2
;
1279 expected_event2
.packet
= NULL
;
1280 event
= &g_array_index(test_events
, struct test_event
, 5);
1281 event2
= &g_array_index(test_events
, struct test_event
, 7);
1282 if (!(compare_single_test_events(event
, &expected_event
) &&
1283 compare_single_test_events(event2
, &expected_event2
)) &&
1284 !(compare_single_test_events(event2
, &expected_event
) &&
1285 compare_single_test_events(event
, &expected_event2
))) {
1290 expected_event
.type
= TEST_EV_TYPE_END
;
1291 expected_event
.stream
= NULL
;
1292 expected_event
.packet
= NULL
;
1293 event
= &g_array_index(test_events
, struct test_event
, 8);
1294 if (!compare_single_test_events(event
, &expected_event
)) {
1301 "the produced sequence of test events is the expected one");
1304 #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
1306 int main(int argc
, char **argv
)
1308 if (getenv(DEBUG_ENV_VAR
) && strcmp(getenv(DEBUG_ENV_VAR
), "1") == 0) {
1312 plan_tests(NR_TESTS
);
1314 test_no_auto_notifs();
1315 test_auto_stream_begin_from_packet_begin();
1316 test_auto_stream_begin_from_stream_end();
1317 test_auto_stream_end_from_end();
1318 test_auto_packet_begin_from_packet_end();
1319 test_auto_packet_begin_from_event();
1320 test_auto_packet_end_from_packet_begin();
1321 test_auto_packet_end_packet_begin_from_event();
1322 test_auto_packet_end_from_stream_end();
1323 test_auto_packet_end_stream_end_from_end();
1324 test_multiple_auto_stream_end_from_end();
1325 test_multiple_auto_packet_end_stream_end_from_end();
1327 return exit_status();