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-sink.h>
38 #include <babeltrace/graph/component-source.h>
39 #include <babeltrace/graph/component.h>
40 #include <babeltrace/graph/graph.h>
41 #include <babeltrace/graph/notification-event.h>
42 #include <babeltrace/graph/notification-inactivity.h>
43 #include <babeltrace/graph/notification-iterator.h>
44 #include <babeltrace/graph/notification-packet.h>
45 #include <babeltrace/graph/notification-stream.h>
46 #include <babeltrace/graph/port.h>
47 #include <babeltrace/graph/private-component-source.h>
48 #include <babeltrace/graph/private-component-sink.h>
49 #include <babeltrace/graph/private-component.h>
50 #include <babeltrace/graph/private-connection.h>
51 #include <babeltrace/graph/private-notification-iterator.h>
52 #include <babeltrace/graph/private-port.h>
53 #include <babeltrace/plugin/plugin.h>
54 #include <babeltrace/ref.h>
63 TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
64 TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
65 TEST_AUTO_STREAM_END_FROM_END
,
66 TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
67 TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
68 TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
69 TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
70 TEST_AUTO_PACKET_END_FROM_STREAM_END
,
71 TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
72 TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
73 TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
76 enum test_event_type
{
77 TEST_EV_TYPE_NOTIF_UNEXPECTED
,
78 TEST_EV_TYPE_NOTIF_EVENT
,
79 TEST_EV_TYPE_NOTIF_INACTIVITY
,
80 TEST_EV_TYPE_NOTIF_STREAM_BEGIN
,
81 TEST_EV_TYPE_NOTIF_PACKET_BEGIN
,
82 TEST_EV_TYPE_NOTIF_PACKET_END
,
83 TEST_EV_TYPE_NOTIF_STREAM_END
,
85 TEST_EV_TYPE_SENTINEL
,
89 enum test_event_type type
;
90 struct bt_ctf_stream
*stream
;
91 struct bt_ctf_packet
*packet
;
94 struct source_muxer_sink
{
95 struct bt_component
*source
;
96 struct bt_component
*sink
;
99 static bool debug
= false;
100 static enum test current_test
;
101 static GArray
*test_events
;
102 static struct bt_clock_class_priority_map
*src_empty_cc_prio_map
;
103 static struct bt_ctf_stream_class
*src_stream_class
;
104 static struct bt_ctf_event_class
*src_event_class
;
105 static struct bt_ctf_stream
*src_stream1
;
106 static struct bt_ctf_stream
*src_stream2
;
107 static struct bt_ctf_packet
*src_stream1_packet1
;
108 static struct bt_ctf_packet
*src_stream1_packet2
;
109 static struct bt_ctf_packet
*src_stream2_packet1
;
110 static struct bt_ctf_packet
*src_stream2_packet2
;
114 SEQ_STREAM1_BEGIN
= -2,
115 SEQ_STREAM2_BEGIN
= -3,
116 SEQ_STREAM1_END
= -4,
117 SEQ_STREAM2_END
= -5,
118 SEQ_STREAM1_PACKET1_BEGIN
= -6,
119 SEQ_STREAM1_PACKET2_BEGIN
= -7,
120 SEQ_STREAM2_PACKET1_BEGIN
= -8,
121 SEQ_STREAM2_PACKET2_BEGIN
= -9,
122 SEQ_STREAM1_PACKET1_END
= -10,
123 SEQ_STREAM1_PACKET2_END
= -11,
124 SEQ_STREAM2_PACKET1_END
= -12,
125 SEQ_STREAM2_PACKET2_END
= -13,
126 SEQ_EVENT_STREAM1_PACKET1
= -14,
127 SEQ_EVENT_STREAM1_PACKET2
= -15,
128 SEQ_EVENT_STREAM2_PACKET1
= -16,
129 SEQ_EVENT_STREAM2_PACKET2
= -17,
130 SEQ_INACTIVITY
= -18,
133 struct src_iter_user_data
{
138 struct sink_user_data
{
139 struct bt_notification_iterator
*notif_iter
;
143 * No automatic notifications generated in this block.
144 * Stream 2 notifications are more indented.
146 static int64_t seq_no_auto_notifs
[] = {
148 SEQ_STREAM1_PACKET1_BEGIN
,
149 SEQ_EVENT_STREAM1_PACKET1
,
150 SEQ_EVENT_STREAM1_PACKET1
,
152 SEQ_EVENT_STREAM1_PACKET1
,
153 SEQ_STREAM2_PACKET2_BEGIN
,
154 SEQ_EVENT_STREAM2_PACKET2
,
155 SEQ_EVENT_STREAM1_PACKET1
,
156 SEQ_STREAM1_PACKET1_END
,
157 SEQ_STREAM2_PACKET2_END
,
158 SEQ_STREAM1_PACKET2_BEGIN
,
159 SEQ_EVENT_STREAM1_PACKET2
,
161 SEQ_STREAM1_PACKET2_END
,
166 /* Automatic "stream begin" from "packet begin" */
167 static int64_t seq_auto_stream_begin_from_packet_begin
[] = {
168 /* Automatic "stream begin" here */
169 SEQ_STREAM1_PACKET1_BEGIN
,
170 SEQ_STREAM1_PACKET1_END
,
175 /* Automatic "stream begin" from "stream end" */
176 static int64_t seq_auto_stream_begin_from_stream_end
[] = {
177 /* Automatic "stream begin" here */
182 /* Automatic "stream end" from END */
183 static int64_t seq_auto_stream_end_from_end
[] = {
185 /* Automatic "packet end" here */
189 /* Automatic "packet begin" from "packet end" */
190 static int64_t seq_auto_packet_begin_from_packet_end
[] = {
192 /* Automatic "packet begin" here */
193 SEQ_STREAM1_PACKET1_END
,
198 /* Automatic "packet begin" from event */
199 static int64_t seq_auto_packet_begin_from_event
[] = {
201 /* Automatic "packet begin" here */
202 SEQ_EVENT_STREAM1_PACKET1
,
203 SEQ_STREAM1_PACKET1_END
,
208 /* Automatic "packet end" from "packet begin" */
209 static int64_t seq_auto_packet_end_from_packet_begin
[] = {
211 SEQ_STREAM1_PACKET1_BEGIN
,
212 /* Automatic "packet end" here */
213 SEQ_STREAM1_PACKET2_BEGIN
,
214 SEQ_STREAM1_PACKET2_END
,
219 /* Automatic "packet end" and "packet begin" from event */
220 static int64_t seq_auto_packet_end_packet_begin_from_event
[] = {
222 SEQ_STREAM1_PACKET1_BEGIN
,
223 /* Automatic "packet end" here */
224 /* Automatic "packet begin" here */
225 SEQ_EVENT_STREAM1_PACKET2
,
226 SEQ_STREAM1_PACKET2_END
,
231 /* Automatic "packet end" from "stream end" */
232 static int64_t seq_auto_packet_end_from_stream_end
[] = {
234 SEQ_STREAM1_PACKET1_BEGIN
,
235 /* Automatic "packet end" here */
240 /* Automatic "packet end" and "stream end" from END */
241 static int64_t seq_auto_packet_end_stream_end_from_end
[] = {
243 SEQ_STREAM1_PACKET1_BEGIN
,
244 /* Automatic "packet end" here */
245 /* Automatic "stream end" here */
249 /* Multiple automatic "stream end" from END */
250 static int64_t seq_multiple_auto_stream_end_from_end
[] = {
253 /* Automatic "stream end" here */
254 /* Automatic "stream end" here */
258 /* Multiple automatic "packet end" and "stream end" from END */
259 static int64_t seq_multiple_auto_packet_end_stream_end_from_end
[] = {
262 SEQ_STREAM1_PACKET1_BEGIN
,
263 SEQ_STREAM2_PACKET1_BEGIN
,
264 /* Automatic "packet end" here */
265 /* Automatic "stream end" here */
266 /* Automatic "packet end" here */
267 /* Automatic "stream end" here */
272 void clear_test_events(void)
274 g_array_set_size(test_events
, 0);
278 void print_test_event(FILE *fp
, const struct test_event
*event
)
280 fprintf(fp
, "{ type = ");
282 switch (event
->type
) {
283 case TEST_EV_TYPE_NOTIF_UNEXPECTED
:
284 fprintf(fp
, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
286 case TEST_EV_TYPE_NOTIF_EVENT
:
287 fprintf(fp
, "TEST_EV_TYPE_NOTIF_EVENT");
289 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
290 fprintf(fp
, "TEST_EV_TYPE_NOTIF_INACTIVITY");
292 case TEST_EV_TYPE_NOTIF_STREAM_BEGIN
:
293 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
295 case TEST_EV_TYPE_NOTIF_STREAM_END
:
296 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_END");
298 case TEST_EV_TYPE_NOTIF_PACKET_BEGIN
:
299 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
301 case TEST_EV_TYPE_NOTIF_PACKET_END
:
302 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_END");
304 case TEST_EV_TYPE_END
:
305 fprintf(fp
, "TEST_EV_TYPE_END");
307 case TEST_EV_TYPE_SENTINEL
:
308 fprintf(fp
, "TEST_EV_TYPE_SENTINEL");
311 fprintf(fp
, "(UNKNOWN)");
315 fprintf(fp
, ", stream = %p, packet = %p }", event
->stream
,
320 void append_test_event(struct test_event
*event
)
322 g_array_append_val(test_events
, *event
);
326 bool compare_single_test_events(const struct test_event
*ev_a
,
327 const struct test_event
*ev_b
)
330 fprintf(stderr
, ":: Comparing test events: ");
331 print_test_event(stderr
, ev_a
);
332 fprintf(stderr
, " vs. ");
333 print_test_event(stderr
, ev_b
);
334 fprintf(stderr
, "\n");
337 if (ev_a
->type
!= ev_b
->type
) {
341 switch (ev_a
->type
) {
342 case TEST_EV_TYPE_END
:
343 case TEST_EV_TYPE_SENTINEL
:
346 if (ev_a
->stream
!= ev_b
->stream
) {
350 if (ev_a
->packet
!= ev_b
->packet
) {
360 bool compare_test_events(const struct test_event
*expected_events
)
362 const struct test_event
*expected_event
= expected_events
;
365 assert(expected_events
);
368 const struct test_event
*event
;
370 if (expected_event
->type
== TEST_EV_TYPE_SENTINEL
) {
374 if (i
>= test_events
->len
) {
378 event
= &g_array_index(test_events
, struct test_event
, i
);
380 if (!compare_single_test_events(event
, expected_event
)) {
388 if (i
!= test_events
->len
) {
396 void init_static_data(void)
399 struct bt_ctf_trace
*trace
;
400 struct bt_ctf_field_type
*empty_struct_ft
;
403 test_events
= g_array_new(FALSE
, TRUE
, sizeof(struct test_event
));
407 empty_struct_ft
= bt_ctf_field_type_structure_create();
408 assert(empty_struct_ft
);
409 trace
= bt_ctf_trace_create();
411 ret
= bt_ctf_trace_set_native_byte_order(trace
,
412 BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
);
414 ret
= bt_ctf_trace_set_packet_header_type(trace
, empty_struct_ft
);
416 src_empty_cc_prio_map
= bt_clock_class_priority_map_create();
417 assert(src_empty_cc_prio_map
);
418 src_stream_class
= bt_ctf_stream_class_create("my-stream-class");
419 assert(src_stream_class
);
420 ret
= bt_ctf_stream_class_set_packet_context_type(src_stream_class
,
423 ret
= bt_ctf_stream_class_set_event_header_type(src_stream_class
,
426 ret
= bt_ctf_stream_class_set_event_context_type(src_stream_class
,
429 src_event_class
= bt_ctf_event_class_create("my-event-class");
430 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
433 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
436 ret
= bt_ctf_stream_class_add_event_class(src_stream_class
,
439 ret
= bt_ctf_trace_add_stream_class(trace
, src_stream_class
);
441 src_stream1
= bt_ctf_stream_create(src_stream_class
, "stream-1");
443 src_stream2
= bt_ctf_stream_create(src_stream_class
, "stream-2");
445 src_stream1_packet1
= bt_ctf_packet_create(src_stream1
);
446 assert(src_stream1_packet1
);
447 src_stream1_packet2
= bt_ctf_packet_create(src_stream1
);
448 assert(src_stream1_packet2
);
449 src_stream2_packet1
= bt_ctf_packet_create(src_stream2
);
450 assert(src_stream2_packet1
);
451 src_stream2_packet2
= bt_ctf_packet_create(src_stream2
);
452 assert(src_stream2_packet2
);
455 fprintf(stderr
, ":: stream 1: %p\n", src_stream1
);
456 fprintf(stderr
, ":: stream 2: %p\n", src_stream2
);
457 fprintf(stderr
, ":: stream 1, packet 1: %p\n", src_stream1_packet1
);
458 fprintf(stderr
, ":: stream 1, packet 2: %p\n", src_stream1_packet2
);
459 fprintf(stderr
, ":: stream 2, packet 1: %p\n", src_stream2_packet1
);
460 fprintf(stderr
, ":: stream 2, packet 2: %p\n", src_stream2_packet2
);
464 bt_put(empty_struct_ft
);
468 void fini_static_data(void)
471 g_array_free(test_events
, TRUE
);
474 bt_put(src_empty_cc_prio_map
);
475 bt_put(src_stream_class
);
476 bt_put(src_event_class
);
479 bt_put(src_stream1_packet1
);
480 bt_put(src_stream1_packet2
);
481 bt_put(src_stream2_packet1
);
482 bt_put(src_stream2_packet2
);
486 void src_iter_finalize(
487 struct bt_private_notification_iterator
*private_notification_iterator
)
489 struct src_iter_user_data
*user_data
=
490 bt_private_notification_iterator_get_user_data(
491 private_notification_iterator
);
499 enum bt_notification_iterator_status
src_iter_init(
500 struct bt_private_notification_iterator
*priv_notif_iter
,
501 struct bt_private_port
*private_port
)
503 struct src_iter_user_data
*user_data
=
504 g_new0(struct src_iter_user_data
, 1);
508 ret
= bt_private_notification_iterator_set_user_data(priv_notif_iter
,
512 switch (current_test
) {
513 case TEST_NO_AUTO_NOTIFS
:
514 user_data
->seq
= seq_no_auto_notifs
;
516 case TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
:
517 user_data
->seq
= seq_auto_stream_begin_from_packet_begin
;
519 case TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
:
520 user_data
->seq
= seq_auto_stream_begin_from_stream_end
;
522 case TEST_AUTO_STREAM_END_FROM_END
:
523 user_data
->seq
= seq_auto_stream_end_from_end
;
525 case TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
:
526 user_data
->seq
= seq_auto_packet_begin_from_packet_end
;
528 case TEST_AUTO_PACKET_BEGIN_FROM_EVENT
:
529 user_data
->seq
= seq_auto_packet_begin_from_event
;
531 case TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
:
532 user_data
->seq
= seq_auto_packet_end_from_packet_begin
;
534 case TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
:
535 user_data
->seq
= seq_auto_packet_end_packet_begin_from_event
;
537 case TEST_AUTO_PACKET_END_FROM_STREAM_END
:
538 user_data
->seq
= seq_auto_packet_end_from_stream_end
;
540 case TEST_AUTO_PACKET_END_STREAM_END_FROM_END
:
541 user_data
->seq
= seq_auto_packet_end_stream_end_from_end
;
543 case TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
:
544 user_data
->seq
= seq_multiple_auto_stream_end_from_end
;
546 case TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
:
547 user_data
->seq
= seq_multiple_auto_packet_end_stream_end_from_end
;
553 return BT_NOTIFICATION_ITERATOR_STATUS_OK
;
557 struct bt_ctf_event
*src_create_event(struct bt_ctf_packet
*packet
)
559 struct bt_ctf_event
*event
= bt_ctf_event_create(src_event_class
);
563 ret
= bt_ctf_event_set_packet(event
, packet
);
569 struct bt_notification_iterator_next_return
src_iter_next_seq(
570 struct src_iter_user_data
*user_data
)
572 struct bt_notification_iterator_next_return next_return
= {
573 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
576 struct bt_ctf_packet
*event_packet
= NULL
;
578 assert(user_data
->seq
);
579 cur_ts_ns
= user_data
->seq
[user_data
->at
];
584 BT_NOTIFICATION_ITERATOR_STATUS_END
;
587 next_return
.notification
=
588 bt_notification_inactivity_create(src_empty_cc_prio_map
);
589 assert(next_return
.notification
);
591 case SEQ_STREAM1_BEGIN
:
592 next_return
.notification
=
593 bt_notification_stream_begin_create(src_stream1
);
594 assert(next_return
.notification
);
596 case SEQ_STREAM2_BEGIN
:
597 next_return
.notification
=
598 bt_notification_stream_begin_create(src_stream2
);
599 assert(next_return
.notification
);
601 case SEQ_STREAM1_END
:
602 next_return
.notification
=
603 bt_notification_stream_end_create(src_stream1
);
604 assert(next_return
.notification
);
606 case SEQ_STREAM2_END
:
607 next_return
.notification
=
608 bt_notification_stream_end_create(src_stream2
);
609 assert(next_return
.notification
);
611 case SEQ_STREAM1_PACKET1_BEGIN
:
612 next_return
.notification
=
613 bt_notification_packet_begin_create(src_stream1_packet1
);
614 assert(next_return
.notification
);
616 case SEQ_STREAM1_PACKET2_BEGIN
:
617 next_return
.notification
=
618 bt_notification_packet_begin_create(src_stream1_packet2
);
619 assert(next_return
.notification
);
621 case SEQ_STREAM2_PACKET1_BEGIN
:
622 next_return
.notification
=
623 bt_notification_packet_begin_create(src_stream2_packet1
);
624 assert(next_return
.notification
);
626 case SEQ_STREAM2_PACKET2_BEGIN
:
627 next_return
.notification
=
628 bt_notification_packet_begin_create(src_stream2_packet2
);
629 assert(next_return
.notification
);
631 case SEQ_STREAM1_PACKET1_END
:
632 next_return
.notification
=
633 bt_notification_packet_end_create(src_stream1_packet1
);
634 assert(next_return
.notification
);
636 case SEQ_STREAM1_PACKET2_END
:
637 next_return
.notification
=
638 bt_notification_packet_end_create(src_stream1_packet2
);
639 assert(next_return
.notification
);
641 case SEQ_STREAM2_PACKET1_END
:
642 next_return
.notification
=
643 bt_notification_packet_end_create(src_stream2_packet1
);
644 assert(next_return
.notification
);
646 case SEQ_STREAM2_PACKET2_END
:
647 next_return
.notification
=
648 bt_notification_packet_end_create(src_stream2_packet2
);
649 assert(next_return
.notification
);
651 case SEQ_EVENT_STREAM1_PACKET1
:
652 event_packet
= src_stream1_packet1
;
654 case SEQ_EVENT_STREAM1_PACKET2
:
655 event_packet
= src_stream1_packet2
;
657 case SEQ_EVENT_STREAM2_PACKET1
:
658 event_packet
= src_stream2_packet1
;
660 case SEQ_EVENT_STREAM2_PACKET2
:
661 event_packet
= src_stream2_packet2
;
668 struct bt_ctf_event
*event
= src_create_event(event_packet
);
671 next_return
.notification
= bt_notification_event_create(event
,
672 src_empty_cc_prio_map
);
674 assert(next_return
.notification
);
677 if (next_return
.status
!= BT_NOTIFICATION_ITERATOR_STATUS_END
) {
685 struct bt_notification_iterator_next_return
src_iter_next(
686 struct bt_private_notification_iterator
*priv_iterator
)
688 struct bt_notification_iterator_next_return next_return
= {
689 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
690 .notification
= NULL
,
692 struct src_iter_user_data
*user_data
=
693 bt_private_notification_iterator_get_user_data(priv_iterator
);
696 next_return
= src_iter_next_seq(user_data
);
701 enum bt_component_status
src_init(
702 struct bt_private_component
*private_component
,
703 struct bt_value
*params
, void *init_method_data
)
707 priv_port
= bt_private_component_source_add_output_private_port(
708 private_component
, "out", NULL
);
711 return BT_COMPONENT_STATUS_OK
;
715 void src_finalize(struct bt_private_component
*private_component
)
720 enum bt_component_status
sink_consume(
721 struct bt_private_component
*priv_component
)
723 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
724 struct bt_notification
*notification
= NULL
;
725 struct sink_user_data
*user_data
=
726 bt_private_component_get_user_data(priv_component
);
727 enum bt_notification_iterator_status it_ret
;
728 struct test_event test_event
= { 0 };
729 bool do_append_test_event
= true;
731 assert(user_data
&& user_data
->notif_iter
);
732 it_ret
= bt_notification_iterator_next(user_data
->notif_iter
);
735 ret
= BT_COMPONENT_STATUS_ERROR
;
736 do_append_test_event
= false;
741 case BT_NOTIFICATION_ITERATOR_STATUS_END
:
742 test_event
.type
= TEST_EV_TYPE_END
;
743 ret
= BT_COMPONENT_STATUS_END
;
744 BT_PUT(user_data
->notif_iter
);
746 case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
:
752 notification
= bt_notification_iterator_get_notification(
753 user_data
->notif_iter
);
754 assert(notification
);
756 switch (bt_notification_get_type(notification
)) {
757 case BT_NOTIFICATION_TYPE_EVENT
:
759 struct bt_ctf_event
*event
;
761 test_event
.type
= TEST_EV_TYPE_NOTIF_EVENT
;
762 event
= bt_notification_event_get_event(notification
);
764 test_event
.packet
= bt_ctf_event_get_packet(event
);
766 assert(test_event
.packet
);
767 bt_put(test_event
.packet
);
770 case BT_NOTIFICATION_TYPE_INACTIVITY
:
771 test_event
.type
= TEST_EV_TYPE_NOTIF_INACTIVITY
;
773 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
774 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
776 bt_notification_stream_begin_get_stream(notification
);
777 assert(test_event
.stream
);
778 bt_put(test_event
.stream
);
780 case BT_NOTIFICATION_TYPE_STREAM_END
:
781 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
783 bt_notification_stream_end_get_stream(notification
);
784 assert(test_event
.stream
);
785 bt_put(test_event
.stream
);
787 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
788 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
790 bt_notification_packet_begin_get_packet(notification
);
791 assert(test_event
.packet
);
792 bt_put(test_event
.packet
);
794 case BT_NOTIFICATION_TYPE_PACKET_END
:
795 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
797 bt_notification_packet_end_get_packet(notification
);
798 assert(test_event
.packet
);
799 bt_put(test_event
.packet
);
802 test_event
.type
= TEST_EV_TYPE_NOTIF_UNEXPECTED
;
806 if (test_event
.packet
) {
807 test_event
.stream
= bt_ctf_packet_get_stream(test_event
.packet
);
808 assert(test_event
.stream
);
809 bt_put(test_event
.stream
);
813 if (do_append_test_event
) {
814 append_test_event(&test_event
);
817 bt_put(notification
);
822 void sink_port_connected(struct bt_private_component
*private_component
,
823 struct bt_private_port
*self_private_port
,
824 struct bt_port
*other_port
)
826 struct bt_private_connection
*priv_conn
=
827 bt_private_port_get_private_connection(self_private_port
);
828 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
833 user_data
->notif_iter
=
834 bt_private_connection_create_notification_iterator(priv_conn
,
836 assert(user_data
->notif_iter
);
841 enum bt_component_status
sink_init(
842 struct bt_private_component
*private_component
,
843 struct bt_value
*params
, void *init_method_data
)
845 struct sink_user_data
*user_data
= g_new0(struct sink_user_data
, 1);
850 ret
= bt_private_component_set_user_data(private_component
,
853 priv_port
= bt_private_component_sink_add_input_private_port(
854 private_component
, "in", NULL
);
857 return BT_COMPONENT_STATUS_OK
;
861 void sink_finalize(struct bt_private_component
*private_component
)
863 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
867 bt_put(user_data
->notif_iter
);
873 void create_source_sink(struct bt_component
**source
,
874 struct bt_component
**sink
)
876 struct bt_component_class
*src_comp_class
;
877 struct bt_component_class
*sink_comp_class
;
880 /* Create source component */
881 src_comp_class
= bt_component_class_source_create("src", src_iter_next
);
882 assert(src_comp_class
);
883 ret
= bt_component_class_set_init_method(src_comp_class
, src_init
);
885 ret
= bt_component_class_set_finalize_method(src_comp_class
,
888 ret
= bt_component_class_source_set_notification_iterator_init_method(
889 src_comp_class
, src_iter_init
);
891 ret
= bt_component_class_source_set_notification_iterator_finalize_method(
892 src_comp_class
, src_iter_finalize
);
894 *source
= bt_component_create(src_comp_class
, "source", NULL
);
897 /* Create sink component */
898 sink_comp_class
= bt_component_class_sink_create("sink", sink_consume
);
899 assert(sink_comp_class
);
900 ret
= bt_component_class_set_init_method(sink_comp_class
, sink_init
);
902 ret
= bt_component_class_set_finalize_method(sink_comp_class
,
904 ret
= bt_component_class_set_port_connected_method(sink_comp_class
,
905 sink_port_connected
);
907 *sink
= bt_component_create(sink_comp_class
, "sink", NULL
);
909 bt_put(src_comp_class
);
910 bt_put(sink_comp_class
);
914 void do_std_test(enum test test
, const char *name
,
915 const struct test_event
*expected_test_events
)
917 struct bt_component
*src_comp
;
918 struct bt_component
*sink_comp
;
919 struct bt_port
*upstream_port
;
920 struct bt_port
*downstream_port
;
921 struct bt_graph
*graph
;
923 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
927 diag("test: %s", name
);
928 create_source_sink(&src_comp
, &sink_comp
);
929 graph
= bt_graph_create();
932 /* Connect source to sink */
933 upstream_port
= bt_component_source_get_output_port_by_name(src_comp
, "out");
934 assert(upstream_port
);
935 downstream_port
= bt_component_sink_get_input_port_by_name(sink_comp
, "in");
936 assert(downstream_port
);
937 conn
= bt_graph_connect_ports(graph
, upstream_port
, downstream_port
);
940 bt_put(upstream_port
);
941 bt_put(downstream_port
);
943 /* Run the graph until the end */
944 while (graph_status
== BT_GRAPH_STATUS_OK
||
945 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
946 graph_status
= bt_graph_run(graph
);
949 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
951 /* Compare the resulting test events */
952 if (expected_test_events
) {
953 ok(compare_test_events(expected_test_events
),
954 "the produced sequence of test events is the expected one");
963 void test_no_auto_notifs(void)
965 const struct test_event expected_test_events
[] = {
966 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
967 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
968 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
969 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
970 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream2
, .packet
= NULL
, },
971 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
972 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
973 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
974 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
975 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
976 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
977 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
978 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
979 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream2
, .packet
= NULL
, },
980 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
981 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
982 { .type
= TEST_EV_TYPE_END
, },
983 { .type
= TEST_EV_TYPE_SENTINEL
, },
986 do_std_test(TEST_NO_AUTO_NOTIFS
, "no automatic notifications",
987 expected_test_events
);
991 void test_auto_stream_begin_from_packet_begin(void)
993 const struct test_event expected_test_events
[] = {
994 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
995 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
996 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
997 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
998 { .type
= TEST_EV_TYPE_END
, },
999 { .type
= TEST_EV_TYPE_SENTINEL
, },
1002 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
1003 "automatic \"stream begin\" notif. caused by \"packet begin\" notif.",
1004 expected_test_events
);
1008 void test_auto_stream_begin_from_stream_end(void)
1010 const struct test_event expected_test_events
[] = {
1011 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1012 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1013 { .type
= TEST_EV_TYPE_END
, },
1014 { .type
= TEST_EV_TYPE_SENTINEL
, },
1017 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
1018 "automatic \"stream begin\" notif. caused by \"stream end\" notif.",
1019 expected_test_events
);
1023 void test_auto_stream_end_from_end(void)
1025 const struct test_event expected_test_events
[] = {
1026 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1027 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1028 { .type
= TEST_EV_TYPE_END
, },
1029 { .type
= TEST_EV_TYPE_SENTINEL
, },
1032 do_std_test(TEST_AUTO_STREAM_END_FROM_END
,
1033 "automatic \"stream end\" notif. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1034 expected_test_events
);
1038 void test_auto_packet_begin_from_packet_end(void)
1040 const struct test_event expected_test_events
[] = {
1041 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1042 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1043 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1044 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1045 { .type
= TEST_EV_TYPE_END
, },
1046 { .type
= TEST_EV_TYPE_SENTINEL
, },
1049 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
1050 "automatic \"packet begin\" notif. caused by \"packet end\" notif.",
1051 expected_test_events
);
1055 void test_auto_packet_begin_from_event(void)
1057 const struct test_event expected_test_events
[] = {
1058 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1059 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1060 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1061 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1062 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1063 { .type
= TEST_EV_TYPE_END
, },
1064 { .type
= TEST_EV_TYPE_SENTINEL
, },
1067 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
1068 "automatic \"packet begin\" notif. caused by event notif.",
1069 expected_test_events
);
1073 void test_auto_packet_end_from_packet_begin(void)
1075 const struct test_event expected_test_events
[] = {
1076 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1077 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1078 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1079 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1080 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1081 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1082 { .type
= TEST_EV_TYPE_END
, },
1083 { .type
= TEST_EV_TYPE_SENTINEL
, },
1086 do_std_test(TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
1087 "automatic \"packet end\" notif. caused by \"packet begin\" notif.",
1088 expected_test_events
);
1092 void test_auto_packet_end_packet_begin_from_event(void)
1094 const struct test_event expected_test_events
[] = {
1095 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1096 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1097 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1098 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1099 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1100 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1101 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1102 { .type
= TEST_EV_TYPE_END
, },
1103 { .type
= TEST_EV_TYPE_SENTINEL
, },
1106 do_std_test(TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
1107 "automatic \"packet end\" and \"packet begin\" notifs. caused by event notif.",
1108 expected_test_events
);
1112 void test_auto_packet_end_from_stream_end(void)
1114 const struct test_event expected_test_events
[] = {
1115 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1116 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1117 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1118 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1119 { .type
= TEST_EV_TYPE_END
, },
1120 { .type
= TEST_EV_TYPE_SENTINEL
, },
1123 do_std_test(TEST_AUTO_PACKET_END_FROM_STREAM_END
,
1124 "automatic \"packet end\" notif. caused by \"stream end\" notif.",
1125 expected_test_events
);
1129 void test_auto_packet_end_stream_end_from_end(void)
1131 const struct test_event expected_test_events
[] = {
1132 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1133 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1134 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1135 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1136 { .type
= TEST_EV_TYPE_END
, },
1137 { .type
= TEST_EV_TYPE_SENTINEL
, },
1140 do_std_test(TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
1141 "automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1142 expected_test_events
);
1146 void test_multiple_auto_stream_end_from_end(void)
1148 bool expected
= true;
1149 struct test_event expected_event
;
1150 struct test_event expected_event2
;
1151 struct test_event
*event
;
1152 struct test_event
*event2
;
1154 do_std_test(TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
1155 "multiple automatic \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1158 if (test_events
->len
!= 5) {
1163 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1164 expected_event
.stream
= src_stream1
;
1165 expected_event
.packet
= NULL
;
1166 event
= &g_array_index(test_events
, struct test_event
, 0);
1167 if (!compare_single_test_events(event
, &expected_event
)) {
1172 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1173 expected_event
.stream
= src_stream2
;
1174 expected_event
.packet
= NULL
;
1175 event
= &g_array_index(test_events
, struct test_event
, 1);
1176 if (!compare_single_test_events(event
, &expected_event
)) {
1181 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1182 expected_event
.stream
= src_stream1
;
1183 expected_event
.packet
= NULL
;
1184 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1185 expected_event2
.stream
= src_stream2
;
1186 expected_event2
.packet
= NULL
;
1187 event
= &g_array_index(test_events
, struct test_event
, 2);
1188 event2
= &g_array_index(test_events
, struct test_event
, 3);
1189 if (!(compare_single_test_events(event
, &expected_event
) &&
1190 compare_single_test_events(event2
, &expected_event2
)) &&
1191 !(compare_single_test_events(event2
, &expected_event
) &&
1192 compare_single_test_events(event
, &expected_event2
))) {
1197 expected_event
.type
= TEST_EV_TYPE_END
;
1198 expected_event
.stream
= NULL
;
1199 expected_event
.packet
= NULL
;
1200 event
= &g_array_index(test_events
, struct test_event
, 4);
1201 if (!compare_single_test_events(event
, &expected_event
)) {
1208 "the produced sequence of test events is the expected one");
1212 void test_multiple_auto_packet_end_stream_end_from_end(void)
1214 bool expected
= true;
1215 struct test_event expected_event
;
1216 struct test_event expected_event2
;
1217 struct test_event
*event
;
1218 struct test_event
*event2
;
1220 do_std_test(TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
1221 "multiple automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1224 if (test_events
->len
!= 9) {
1229 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1230 expected_event
.stream
= src_stream1
;
1231 expected_event
.packet
= NULL
;
1232 event
= &g_array_index(test_events
, struct test_event
, 0);
1233 if (!compare_single_test_events(event
, &expected_event
)) {
1238 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1239 expected_event
.stream
= src_stream2
;
1240 expected_event
.packet
= NULL
;
1241 event
= &g_array_index(test_events
, struct test_event
, 1);
1242 if (!compare_single_test_events(event
, &expected_event
)) {
1247 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1248 expected_event
.stream
= src_stream1
;
1249 expected_event
.packet
= src_stream1_packet1
;
1250 event
= &g_array_index(test_events
, struct test_event
, 2);
1251 if (!compare_single_test_events(event
, &expected_event
)) {
1256 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1257 expected_event
.stream
= src_stream2
;
1258 expected_event
.packet
= src_stream2_packet1
;
1259 event
= &g_array_index(test_events
, struct test_event
, 3);
1260 if (!compare_single_test_events(event
, &expected_event
)) {
1265 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1266 expected_event
.stream
= src_stream1
;
1267 expected_event
.packet
= src_stream1_packet1
;
1268 expected_event2
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1269 expected_event2
.stream
= src_stream2
;
1270 expected_event2
.packet
= src_stream2_packet1
;
1271 event
= &g_array_index(test_events
, struct test_event
, 4);
1272 event2
= &g_array_index(test_events
, struct test_event
, 6);
1273 if (!(compare_single_test_events(event
, &expected_event
) &&
1274 compare_single_test_events(event2
, &expected_event2
)) &&
1275 !(compare_single_test_events(event2
, &expected_event
) &&
1276 compare_single_test_events(event
, &expected_event2
))) {
1281 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1282 expected_event
.stream
= src_stream1
;
1283 expected_event
.packet
= NULL
;
1284 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1285 expected_event2
.stream
= src_stream2
;
1286 expected_event2
.packet
= NULL
;
1287 event
= &g_array_index(test_events
, struct test_event
, 5);
1288 event2
= &g_array_index(test_events
, struct test_event
, 7);
1289 if (!(compare_single_test_events(event
, &expected_event
) &&
1290 compare_single_test_events(event2
, &expected_event2
)) &&
1291 !(compare_single_test_events(event2
, &expected_event
) &&
1292 compare_single_test_events(event
, &expected_event2
))) {
1297 expected_event
.type
= TEST_EV_TYPE_END
;
1298 expected_event
.stream
= NULL
;
1299 expected_event
.packet
= NULL
;
1300 event
= &g_array_index(test_events
, struct test_event
, 8);
1301 if (!compare_single_test_events(event
, &expected_event
)) {
1308 "the produced sequence of test events is the expected one");
1311 #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
1313 int main(int argc
, char **argv
)
1315 if (getenv(DEBUG_ENV_VAR
) && strcmp(getenv(DEBUG_ENV_VAR
), "1") == 0) {
1319 plan_tests(NR_TESTS
);
1321 test_no_auto_notifs();
1322 test_auto_stream_begin_from_packet_begin();
1323 test_auto_stream_begin_from_stream_end();
1324 test_auto_stream_end_from_end();
1325 test_auto_packet_begin_from_packet_end();
1326 test_auto_packet_begin_from_event();
1327 test_auto_packet_end_from_packet_begin();
1328 test_auto_packet_end_packet_begin_from_event();
1329 test_auto_packet_end_from_stream_end();
1330 test_auto_packet_end_stream_end_from_end();
1331 test_multiple_auto_stream_end_from_end();
1332 test_multiple_auto_packet_end_stream_end_from_end();
1334 return exit_status();