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/connection.h>
42 #include <babeltrace/graph/graph.h>
43 #include <babeltrace/graph/notification-event.h>
44 #include <babeltrace/graph/notification-inactivity.h>
45 #include <babeltrace/graph/notification-iterator.h>
46 #include <babeltrace/graph/notification-packet.h>
47 #include <babeltrace/graph/notification-stream.h>
48 #include <babeltrace/graph/port.h>
49 #include <babeltrace/graph/private-component-source.h>
50 #include <babeltrace/graph/private-component-sink.h>
51 #include <babeltrace/graph/private-component.h>
52 #include <babeltrace/graph/private-connection.h>
53 #include <babeltrace/graph/private-notification-iterator.h>
54 #include <babeltrace/graph/private-port.h>
55 #include <babeltrace/plugin/plugin.h>
56 #include <babeltrace/ref.h>
65 TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
66 TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
67 TEST_AUTO_STREAM_END_FROM_END
,
68 TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
69 TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
70 TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
71 TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
72 TEST_AUTO_PACKET_END_FROM_STREAM_END
,
73 TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
74 TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
75 TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
78 enum test_event_type
{
79 TEST_EV_TYPE_NOTIF_UNEXPECTED
,
80 TEST_EV_TYPE_NOTIF_EVENT
,
81 TEST_EV_TYPE_NOTIF_INACTIVITY
,
82 TEST_EV_TYPE_NOTIF_STREAM_BEGIN
,
83 TEST_EV_TYPE_NOTIF_PACKET_BEGIN
,
84 TEST_EV_TYPE_NOTIF_PACKET_END
,
85 TEST_EV_TYPE_NOTIF_STREAM_END
,
87 TEST_EV_TYPE_SENTINEL
,
91 enum test_event_type type
;
92 struct bt_ctf_stream
*stream
;
93 struct bt_ctf_packet
*packet
;
96 struct source_muxer_sink
{
97 struct bt_component
*source
;
98 struct bt_component
*sink
;
101 static bool debug
= false;
102 static enum test current_test
;
103 static GArray
*test_events
;
104 static struct bt_clock_class_priority_map
*src_empty_cc_prio_map
;
105 static struct bt_ctf_stream_class
*src_stream_class
;
106 static struct bt_ctf_event_class
*src_event_class
;
107 static struct bt_ctf_stream
*src_stream1
;
108 static struct bt_ctf_stream
*src_stream2
;
109 static struct bt_ctf_packet
*src_stream1_packet1
;
110 static struct bt_ctf_packet
*src_stream1_packet2
;
111 static struct bt_ctf_packet
*src_stream2_packet1
;
112 static struct bt_ctf_packet
*src_stream2_packet2
;
116 SEQ_STREAM1_BEGIN
= -2,
117 SEQ_STREAM2_BEGIN
= -3,
118 SEQ_STREAM1_END
= -4,
119 SEQ_STREAM2_END
= -5,
120 SEQ_STREAM1_PACKET1_BEGIN
= -6,
121 SEQ_STREAM1_PACKET2_BEGIN
= -7,
122 SEQ_STREAM2_PACKET1_BEGIN
= -8,
123 SEQ_STREAM2_PACKET2_BEGIN
= -9,
124 SEQ_STREAM1_PACKET1_END
= -10,
125 SEQ_STREAM1_PACKET2_END
= -11,
126 SEQ_STREAM2_PACKET1_END
= -12,
127 SEQ_STREAM2_PACKET2_END
= -13,
128 SEQ_EVENT_STREAM1_PACKET1
= -14,
129 SEQ_EVENT_STREAM1_PACKET2
= -15,
130 SEQ_EVENT_STREAM2_PACKET1
= -16,
131 SEQ_EVENT_STREAM2_PACKET2
= -17,
132 SEQ_INACTIVITY
= -18,
135 struct src_iter_user_data
{
140 struct sink_user_data
{
141 struct bt_notification_iterator
*notif_iter
;
145 * No automatic notifications generated in this block.
146 * Stream 2 notifications are more indented.
148 static int64_t seq_no_auto_notifs
[] = {
150 SEQ_STREAM1_PACKET1_BEGIN
,
151 SEQ_EVENT_STREAM1_PACKET1
,
152 SEQ_EVENT_STREAM1_PACKET1
,
154 SEQ_EVENT_STREAM1_PACKET1
,
155 SEQ_STREAM2_PACKET2_BEGIN
,
156 SEQ_EVENT_STREAM2_PACKET2
,
157 SEQ_EVENT_STREAM1_PACKET1
,
158 SEQ_STREAM1_PACKET1_END
,
159 SEQ_STREAM2_PACKET2_END
,
160 SEQ_STREAM1_PACKET2_BEGIN
,
161 SEQ_EVENT_STREAM1_PACKET2
,
163 SEQ_STREAM1_PACKET2_END
,
168 /* Automatic "stream begin" from "packet begin" */
169 static int64_t seq_auto_stream_begin_from_packet_begin
[] = {
170 /* Automatic "stream begin" here */
171 SEQ_STREAM1_PACKET1_BEGIN
,
172 SEQ_STREAM1_PACKET1_END
,
177 /* Automatic "stream begin" from "stream end" */
178 static int64_t seq_auto_stream_begin_from_stream_end
[] = {
179 /* Automatic "stream begin" here */
184 /* Automatic "stream end" from END */
185 static int64_t seq_auto_stream_end_from_end
[] = {
187 /* Automatic "packet end" here */
191 /* Automatic "packet begin" from "packet end" */
192 static int64_t seq_auto_packet_begin_from_packet_end
[] = {
194 /* Automatic "packet begin" here */
195 SEQ_STREAM1_PACKET1_END
,
200 /* Automatic "packet begin" from event */
201 static int64_t seq_auto_packet_begin_from_event
[] = {
203 /* Automatic "packet begin" here */
204 SEQ_EVENT_STREAM1_PACKET1
,
205 SEQ_STREAM1_PACKET1_END
,
210 /* Automatic "packet end" from "packet begin" */
211 static int64_t seq_auto_packet_end_from_packet_begin
[] = {
213 SEQ_STREAM1_PACKET1_BEGIN
,
214 /* Automatic "packet end" here */
215 SEQ_STREAM1_PACKET2_BEGIN
,
216 SEQ_STREAM1_PACKET2_END
,
221 /* Automatic "packet end" and "packet begin" from event */
222 static int64_t seq_auto_packet_end_packet_begin_from_event
[] = {
224 SEQ_STREAM1_PACKET1_BEGIN
,
225 /* Automatic "packet end" here */
226 /* Automatic "packet begin" here */
227 SEQ_EVENT_STREAM1_PACKET2
,
228 SEQ_STREAM1_PACKET2_END
,
233 /* Automatic "packet end" from "stream end" */
234 static int64_t seq_auto_packet_end_from_stream_end
[] = {
236 SEQ_STREAM1_PACKET1_BEGIN
,
237 /* Automatic "packet end" here */
242 /* Automatic "packet end" and "stream end" from END */
243 static int64_t seq_auto_packet_end_stream_end_from_end
[] = {
245 SEQ_STREAM1_PACKET1_BEGIN
,
246 /* Automatic "packet end" here */
247 /* Automatic "stream end" here */
251 /* Multiple automatic "stream end" from END */
252 static int64_t seq_multiple_auto_stream_end_from_end
[] = {
255 /* Automatic "stream end" here */
256 /* Automatic "stream end" here */
260 /* Multiple automatic "packet end" and "stream end" from END */
261 static int64_t seq_multiple_auto_packet_end_stream_end_from_end
[] = {
264 SEQ_STREAM1_PACKET1_BEGIN
,
265 SEQ_STREAM2_PACKET1_BEGIN
,
266 /* Automatic "packet end" here */
267 /* Automatic "stream end" here */
268 /* Automatic "packet end" here */
269 /* Automatic "stream end" here */
274 void clear_test_events(void)
276 g_array_set_size(test_events
, 0);
280 void print_test_event(FILE *fp
, const struct test_event
*event
)
282 fprintf(fp
, "{ type = ");
284 switch (event
->type
) {
285 case TEST_EV_TYPE_NOTIF_UNEXPECTED
:
286 fprintf(fp
, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
288 case TEST_EV_TYPE_NOTIF_EVENT
:
289 fprintf(fp
, "TEST_EV_TYPE_NOTIF_EVENT");
291 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
292 fprintf(fp
, "TEST_EV_TYPE_NOTIF_INACTIVITY");
294 case TEST_EV_TYPE_NOTIF_STREAM_BEGIN
:
295 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
297 case TEST_EV_TYPE_NOTIF_STREAM_END
:
298 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_END");
300 case TEST_EV_TYPE_NOTIF_PACKET_BEGIN
:
301 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
303 case TEST_EV_TYPE_NOTIF_PACKET_END
:
304 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_END");
306 case TEST_EV_TYPE_END
:
307 fprintf(fp
, "TEST_EV_TYPE_END");
309 case TEST_EV_TYPE_SENTINEL
:
310 fprintf(fp
, "TEST_EV_TYPE_SENTINEL");
313 fprintf(fp
, "(UNKNOWN)");
317 fprintf(fp
, ", stream = %p, packet = %p }", event
->stream
,
322 void append_test_event(struct test_event
*event
)
324 g_array_append_val(test_events
, *event
);
328 bool compare_single_test_events(const struct test_event
*ev_a
,
329 const struct test_event
*ev_b
)
332 fprintf(stderr
, ":: Comparing test events: ");
333 print_test_event(stderr
, ev_a
);
334 fprintf(stderr
, " vs. ");
335 print_test_event(stderr
, ev_b
);
336 fprintf(stderr
, "\n");
339 if (ev_a
->type
!= ev_b
->type
) {
343 switch (ev_a
->type
) {
344 case TEST_EV_TYPE_END
:
345 case TEST_EV_TYPE_SENTINEL
:
348 if (ev_a
->stream
!= ev_b
->stream
) {
352 if (ev_a
->packet
!= ev_b
->packet
) {
362 bool compare_test_events(const struct test_event
*expected_events
)
364 const struct test_event
*expected_event
= expected_events
;
367 assert(expected_events
);
370 const struct test_event
*event
;
372 if (expected_event
->type
== TEST_EV_TYPE_SENTINEL
) {
376 if (i
>= test_events
->len
) {
380 event
= &g_array_index(test_events
, struct test_event
, i
);
382 if (!compare_single_test_events(event
, expected_event
)) {
390 if (i
!= test_events
->len
) {
398 void init_static_data(void)
401 struct bt_ctf_trace
*trace
;
402 struct bt_ctf_field_type
*empty_struct_ft
;
405 test_events
= g_array_new(FALSE
, TRUE
, sizeof(struct test_event
));
409 empty_struct_ft
= bt_ctf_field_type_structure_create();
410 assert(empty_struct_ft
);
411 trace
= bt_ctf_trace_create();
413 ret
= bt_ctf_trace_set_packet_header_type(trace
, empty_struct_ft
);
415 src_empty_cc_prio_map
= bt_clock_class_priority_map_create();
416 assert(src_empty_cc_prio_map
);
417 src_stream_class
= bt_ctf_stream_class_create("my-stream-class");
418 assert(src_stream_class
);
419 ret
= bt_ctf_stream_class_set_packet_context_type(src_stream_class
,
422 ret
= bt_ctf_stream_class_set_event_header_type(src_stream_class
,
425 ret
= bt_ctf_stream_class_set_event_context_type(src_stream_class
,
428 src_event_class
= bt_ctf_event_class_create("my-event-class");
429 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
432 ret
= bt_ctf_event_class_set_context_type(src_event_class
,
435 ret
= bt_ctf_stream_class_add_event_class(src_stream_class
,
438 ret
= bt_ctf_trace_add_stream_class(trace
, src_stream_class
);
440 src_stream1
= bt_ctf_stream_create(src_stream_class
, "stream-1");
442 src_stream2
= bt_ctf_stream_create(src_stream_class
, "stream-2");
444 src_stream1_packet1
= bt_ctf_packet_create(src_stream1
);
445 assert(src_stream1_packet1
);
446 src_stream1_packet2
= bt_ctf_packet_create(src_stream1
);
447 assert(src_stream1_packet2
);
448 src_stream2_packet1
= bt_ctf_packet_create(src_stream2
);
449 assert(src_stream2_packet1
);
450 src_stream2_packet2
= bt_ctf_packet_create(src_stream2
);
451 assert(src_stream2_packet2
);
454 fprintf(stderr
, ":: stream 1: %p\n", src_stream1
);
455 fprintf(stderr
, ":: stream 2: %p\n", src_stream2
);
456 fprintf(stderr
, ":: stream 1, packet 1: %p\n", src_stream1_packet1
);
457 fprintf(stderr
, ":: stream 1, packet 2: %p\n", src_stream1_packet2
);
458 fprintf(stderr
, ":: stream 2, packet 1: %p\n", src_stream2_packet1
);
459 fprintf(stderr
, ":: stream 2, packet 2: %p\n", src_stream2_packet2
);
463 bt_put(empty_struct_ft
);
467 void fini_static_data(void)
470 g_array_free(test_events
, TRUE
);
473 bt_put(src_empty_cc_prio_map
);
474 bt_put(src_stream_class
);
475 bt_put(src_event_class
);
478 bt_put(src_stream1_packet1
);
479 bt_put(src_stream1_packet2
);
480 bt_put(src_stream2_packet1
);
481 bt_put(src_stream2_packet2
);
485 void src_iter_finalize(
486 struct bt_private_notification_iterator
*private_notification_iterator
)
488 struct src_iter_user_data
*user_data
=
489 bt_private_notification_iterator_get_user_data(
490 private_notification_iterator
);
498 enum bt_notification_iterator_status
src_iter_init(
499 struct bt_private_notification_iterator
*priv_notif_iter
,
500 struct bt_private_port
*private_port
)
502 struct src_iter_user_data
*user_data
=
503 g_new0(struct src_iter_user_data
, 1);
507 ret
= bt_private_notification_iterator_set_user_data(priv_notif_iter
,
511 switch (current_test
) {
512 case TEST_NO_AUTO_NOTIFS
:
513 user_data
->seq
= seq_no_auto_notifs
;
515 case TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
:
516 user_data
->seq
= seq_auto_stream_begin_from_packet_begin
;
518 case TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
:
519 user_data
->seq
= seq_auto_stream_begin_from_stream_end
;
521 case TEST_AUTO_STREAM_END_FROM_END
:
522 user_data
->seq
= seq_auto_stream_end_from_end
;
524 case TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
:
525 user_data
->seq
= seq_auto_packet_begin_from_packet_end
;
527 case TEST_AUTO_PACKET_BEGIN_FROM_EVENT
:
528 user_data
->seq
= seq_auto_packet_begin_from_event
;
530 case TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
:
531 user_data
->seq
= seq_auto_packet_end_from_packet_begin
;
533 case TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
:
534 user_data
->seq
= seq_auto_packet_end_packet_begin_from_event
;
536 case TEST_AUTO_PACKET_END_FROM_STREAM_END
:
537 user_data
->seq
= seq_auto_packet_end_from_stream_end
;
539 case TEST_AUTO_PACKET_END_STREAM_END_FROM_END
:
540 user_data
->seq
= seq_auto_packet_end_stream_end_from_end
;
542 case TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
:
543 user_data
->seq
= seq_multiple_auto_stream_end_from_end
;
545 case TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
:
546 user_data
->seq
= seq_multiple_auto_packet_end_stream_end_from_end
;
552 return BT_NOTIFICATION_ITERATOR_STATUS_OK
;
556 struct bt_ctf_event
*src_create_event(struct bt_ctf_packet
*packet
)
558 struct bt_ctf_event
*event
= bt_ctf_event_create(src_event_class
);
562 ret
= bt_ctf_event_set_packet(event
, packet
);
568 struct bt_notification_iterator_next_return
src_iter_next_seq(
569 struct src_iter_user_data
*user_data
)
571 struct bt_notification_iterator_next_return next_return
= {
572 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
575 struct bt_ctf_packet
*event_packet
= NULL
;
577 assert(user_data
->seq
);
578 cur_ts_ns
= user_data
->seq
[user_data
->at
];
583 BT_NOTIFICATION_ITERATOR_STATUS_END
;
586 next_return
.notification
=
587 bt_notification_inactivity_create(src_empty_cc_prio_map
);
588 assert(next_return
.notification
);
590 case SEQ_STREAM1_BEGIN
:
591 next_return
.notification
=
592 bt_notification_stream_begin_create(src_stream1
);
593 assert(next_return
.notification
);
595 case SEQ_STREAM2_BEGIN
:
596 next_return
.notification
=
597 bt_notification_stream_begin_create(src_stream2
);
598 assert(next_return
.notification
);
600 case SEQ_STREAM1_END
:
601 next_return
.notification
=
602 bt_notification_stream_end_create(src_stream1
);
603 assert(next_return
.notification
);
605 case SEQ_STREAM2_END
:
606 next_return
.notification
=
607 bt_notification_stream_end_create(src_stream2
);
608 assert(next_return
.notification
);
610 case SEQ_STREAM1_PACKET1_BEGIN
:
611 next_return
.notification
=
612 bt_notification_packet_begin_create(src_stream1_packet1
);
613 assert(next_return
.notification
);
615 case SEQ_STREAM1_PACKET2_BEGIN
:
616 next_return
.notification
=
617 bt_notification_packet_begin_create(src_stream1_packet2
);
618 assert(next_return
.notification
);
620 case SEQ_STREAM2_PACKET1_BEGIN
:
621 next_return
.notification
=
622 bt_notification_packet_begin_create(src_stream2_packet1
);
623 assert(next_return
.notification
);
625 case SEQ_STREAM2_PACKET2_BEGIN
:
626 next_return
.notification
=
627 bt_notification_packet_begin_create(src_stream2_packet2
);
628 assert(next_return
.notification
);
630 case SEQ_STREAM1_PACKET1_END
:
631 next_return
.notification
=
632 bt_notification_packet_end_create(src_stream1_packet1
);
633 assert(next_return
.notification
);
635 case SEQ_STREAM1_PACKET2_END
:
636 next_return
.notification
=
637 bt_notification_packet_end_create(src_stream1_packet2
);
638 assert(next_return
.notification
);
640 case SEQ_STREAM2_PACKET1_END
:
641 next_return
.notification
=
642 bt_notification_packet_end_create(src_stream2_packet1
);
643 assert(next_return
.notification
);
645 case SEQ_STREAM2_PACKET2_END
:
646 next_return
.notification
=
647 bt_notification_packet_end_create(src_stream2_packet2
);
648 assert(next_return
.notification
);
650 case SEQ_EVENT_STREAM1_PACKET1
:
651 event_packet
= src_stream1_packet1
;
653 case SEQ_EVENT_STREAM1_PACKET2
:
654 event_packet
= src_stream1_packet2
;
656 case SEQ_EVENT_STREAM2_PACKET1
:
657 event_packet
= src_stream2_packet1
;
659 case SEQ_EVENT_STREAM2_PACKET2
:
660 event_packet
= src_stream2_packet2
;
667 struct bt_ctf_event
*event
= src_create_event(event_packet
);
670 next_return
.notification
= bt_notification_event_create(event
,
671 src_empty_cc_prio_map
);
673 assert(next_return
.notification
);
676 if (next_return
.status
!= BT_NOTIFICATION_ITERATOR_STATUS_END
) {
684 struct bt_notification_iterator_next_return
src_iter_next(
685 struct bt_private_notification_iterator
*priv_iterator
)
687 struct bt_notification_iterator_next_return next_return
= {
688 .status
= BT_NOTIFICATION_ITERATOR_STATUS_OK
,
689 .notification
= NULL
,
691 struct src_iter_user_data
*user_data
=
692 bt_private_notification_iterator_get_user_data(priv_iterator
);
695 next_return
= src_iter_next_seq(user_data
);
700 enum bt_component_status
src_init(
701 struct bt_private_component
*private_component
,
702 struct bt_value
*params
, void *init_method_data
)
706 ret
= bt_private_component_source_add_output_private_port(
707 private_component
, "out", NULL
, NULL
);
709 return BT_COMPONENT_STATUS_OK
;
713 void src_finalize(struct bt_private_component
*private_component
)
718 enum bt_component_status
sink_consume(
719 struct bt_private_component
*priv_component
)
721 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
722 struct bt_notification
*notification
= NULL
;
723 struct sink_user_data
*user_data
=
724 bt_private_component_get_user_data(priv_component
);
725 enum bt_notification_iterator_status it_ret
;
726 struct test_event test_event
= { 0 };
727 bool do_append_test_event
= true;
729 assert(user_data
&& user_data
->notif_iter
);
730 it_ret
= bt_notification_iterator_next(user_data
->notif_iter
);
733 ret
= BT_COMPONENT_STATUS_ERROR
;
734 do_append_test_event
= false;
739 case BT_NOTIFICATION_ITERATOR_STATUS_END
:
740 test_event
.type
= TEST_EV_TYPE_END
;
741 ret
= BT_COMPONENT_STATUS_END
;
742 BT_PUT(user_data
->notif_iter
);
744 case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
:
750 notification
= bt_notification_iterator_get_notification(
751 user_data
->notif_iter
);
752 assert(notification
);
754 switch (bt_notification_get_type(notification
)) {
755 case BT_NOTIFICATION_TYPE_EVENT
:
757 struct bt_ctf_event
*event
;
759 test_event
.type
= TEST_EV_TYPE_NOTIF_EVENT
;
760 event
= bt_notification_event_get_event(notification
);
762 test_event
.packet
= bt_ctf_event_get_packet(event
);
764 assert(test_event
.packet
);
765 bt_put(test_event
.packet
);
768 case BT_NOTIFICATION_TYPE_INACTIVITY
:
769 test_event
.type
= TEST_EV_TYPE_NOTIF_INACTIVITY
;
771 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
772 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
774 bt_notification_stream_begin_get_stream(notification
);
775 assert(test_event
.stream
);
776 bt_put(test_event
.stream
);
778 case BT_NOTIFICATION_TYPE_STREAM_END
:
779 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
781 bt_notification_stream_end_get_stream(notification
);
782 assert(test_event
.stream
);
783 bt_put(test_event
.stream
);
785 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
786 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
788 bt_notification_packet_begin_get_packet(notification
);
789 assert(test_event
.packet
);
790 bt_put(test_event
.packet
);
792 case BT_NOTIFICATION_TYPE_PACKET_END
:
793 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
795 bt_notification_packet_end_get_packet(notification
);
796 assert(test_event
.packet
);
797 bt_put(test_event
.packet
);
800 test_event
.type
= TEST_EV_TYPE_NOTIF_UNEXPECTED
;
804 if (test_event
.packet
) {
805 test_event
.stream
= bt_ctf_packet_get_stream(test_event
.packet
);
806 assert(test_event
.stream
);
807 bt_put(test_event
.stream
);
811 if (do_append_test_event
) {
812 append_test_event(&test_event
);
815 bt_put(notification
);
820 void sink_port_connected(struct bt_private_component
*private_component
,
821 struct bt_private_port
*self_private_port
,
822 struct bt_port
*other_port
)
824 struct bt_private_connection
*priv_conn
=
825 bt_private_port_get_private_connection(self_private_port
);
826 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
828 enum bt_connection_status conn_status
;
832 conn_status
= bt_private_connection_create_notification_iterator(
833 priv_conn
, NULL
, &user_data
->notif_iter
);
834 assert(conn_status
== 0);
839 enum bt_component_status
sink_init(
840 struct bt_private_component
*private_component
,
841 struct bt_value
*params
, void *init_method_data
)
843 struct sink_user_data
*user_data
= g_new0(struct sink_user_data
, 1);
847 ret
= bt_private_component_set_user_data(private_component
,
850 ret
= bt_private_component_sink_add_input_private_port(
851 private_component
, "in", NULL
, NULL
);
853 return BT_COMPONENT_STATUS_OK
;
857 void sink_finalize(struct bt_private_component
*private_component
)
859 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
863 bt_put(user_data
->notif_iter
);
869 void create_source_sink(struct bt_component
**source
,
870 struct bt_component
**sink
)
872 struct bt_component_class
*src_comp_class
;
873 struct bt_component_class
*sink_comp_class
;
876 /* Create source component */
877 src_comp_class
= bt_component_class_source_create("src", src_iter_next
);
878 assert(src_comp_class
);
879 ret
= bt_component_class_set_init_method(src_comp_class
, src_init
);
881 ret
= bt_component_class_set_finalize_method(src_comp_class
,
884 ret
= bt_component_class_source_set_notification_iterator_init_method(
885 src_comp_class
, src_iter_init
);
887 ret
= bt_component_class_source_set_notification_iterator_finalize_method(
888 src_comp_class
, src_iter_finalize
);
890 *source
= bt_component_create(src_comp_class
, "source", NULL
);
893 /* Create sink component */
894 sink_comp_class
= bt_component_class_sink_create("sink", sink_consume
);
895 assert(sink_comp_class
);
896 ret
= bt_component_class_set_init_method(sink_comp_class
, sink_init
);
898 ret
= bt_component_class_set_finalize_method(sink_comp_class
,
900 ret
= bt_component_class_set_port_connected_method(sink_comp_class
,
901 sink_port_connected
);
903 *sink
= bt_component_create(sink_comp_class
, "sink", NULL
);
905 bt_put(src_comp_class
);
906 bt_put(sink_comp_class
);
910 void do_std_test(enum test test
, const char *name
,
911 const struct test_event
*expected_test_events
)
913 struct bt_component
*src_comp
;
914 struct bt_component
*sink_comp
;
915 struct bt_port
*upstream_port
;
916 struct bt_port
*downstream_port
;
917 struct bt_graph
*graph
;
918 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
922 diag("test: %s", name
);
923 create_source_sink(&src_comp
, &sink_comp
);
924 graph
= bt_graph_create();
927 /* Connect source to sink */
928 upstream_port
= bt_component_source_get_output_port_by_name(src_comp
, "out");
929 assert(upstream_port
);
930 downstream_port
= bt_component_sink_get_input_port_by_name(sink_comp
, "in");
931 assert(downstream_port
);
932 graph_status
= bt_graph_connect_ports(graph
, upstream_port
,
933 downstream_port
, NULL
);
934 bt_put(upstream_port
);
935 bt_put(downstream_port
);
937 /* Run the graph until the end */
938 while (graph_status
== BT_GRAPH_STATUS_OK
||
939 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
940 graph_status
= bt_graph_run(graph
);
943 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
945 /* Compare the resulting test events */
946 if (expected_test_events
) {
947 ok(compare_test_events(expected_test_events
),
948 "the produced sequence of test events is the expected one");
957 void test_no_auto_notifs(void)
959 const struct test_event expected_test_events
[] = {
960 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
961 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .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_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
964 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream2
, .packet
= NULL
, },
965 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
966 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
967 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
968 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
969 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
970 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
971 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
972 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
973 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream2
, .packet
= NULL
, },
974 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
975 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
976 { .type
= TEST_EV_TYPE_END
, },
977 { .type
= TEST_EV_TYPE_SENTINEL
, },
980 do_std_test(TEST_NO_AUTO_NOTIFS
, "no automatic notifications",
981 expected_test_events
);
985 void test_auto_stream_begin_from_packet_begin(void)
987 const struct test_event expected_test_events
[] = {
988 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
989 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
990 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
991 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
992 { .type
= TEST_EV_TYPE_END
, },
993 { .type
= TEST_EV_TYPE_SENTINEL
, },
996 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
997 "automatic \"stream begin\" notif. caused by \"packet begin\" notif.",
998 expected_test_events
);
1002 void test_auto_stream_begin_from_stream_end(void)
1004 const struct test_event expected_test_events
[] = {
1005 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1006 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1007 { .type
= TEST_EV_TYPE_END
, },
1008 { .type
= TEST_EV_TYPE_SENTINEL
, },
1011 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
1012 "automatic \"stream begin\" notif. caused by \"stream end\" notif.",
1013 expected_test_events
);
1017 void test_auto_stream_end_from_end(void)
1019 const struct test_event expected_test_events
[] = {
1020 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1021 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1022 { .type
= TEST_EV_TYPE_END
, },
1023 { .type
= TEST_EV_TYPE_SENTINEL
, },
1026 do_std_test(TEST_AUTO_STREAM_END_FROM_END
,
1027 "automatic \"stream end\" notif. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1028 expected_test_events
);
1032 void test_auto_packet_begin_from_packet_end(void)
1034 const struct test_event expected_test_events
[] = {
1035 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1036 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1037 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1038 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1039 { .type
= TEST_EV_TYPE_END
, },
1040 { .type
= TEST_EV_TYPE_SENTINEL
, },
1043 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
1044 "automatic \"packet begin\" notif. caused by \"packet end\" notif.",
1045 expected_test_events
);
1049 void test_auto_packet_begin_from_event(void)
1051 const struct test_event expected_test_events
[] = {
1052 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1053 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1054 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1055 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1056 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1057 { .type
= TEST_EV_TYPE_END
, },
1058 { .type
= TEST_EV_TYPE_SENTINEL
, },
1061 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
1062 "automatic \"packet begin\" notif. caused by event notif.",
1063 expected_test_events
);
1067 void test_auto_packet_end_from_packet_begin(void)
1069 const struct test_event expected_test_events
[] = {
1070 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1071 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1072 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1073 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1074 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1075 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1076 { .type
= TEST_EV_TYPE_END
, },
1077 { .type
= TEST_EV_TYPE_SENTINEL
, },
1080 do_std_test(TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
1081 "automatic \"packet end\" notif. caused by \"packet begin\" notif.",
1082 expected_test_events
);
1086 void test_auto_packet_end_packet_begin_from_event(void)
1088 const struct test_event expected_test_events
[] = {
1089 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1090 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1091 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1092 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1093 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1094 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1095 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1096 { .type
= TEST_EV_TYPE_END
, },
1097 { .type
= TEST_EV_TYPE_SENTINEL
, },
1100 do_std_test(TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
1101 "automatic \"packet end\" and \"packet begin\" notifs. caused by event notif.",
1102 expected_test_events
);
1106 void test_auto_packet_end_from_stream_end(void)
1108 const struct test_event expected_test_events
[] = {
1109 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1110 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1111 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1112 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1113 { .type
= TEST_EV_TYPE_END
, },
1114 { .type
= TEST_EV_TYPE_SENTINEL
, },
1117 do_std_test(TEST_AUTO_PACKET_END_FROM_STREAM_END
,
1118 "automatic \"packet end\" notif. caused by \"stream end\" notif.",
1119 expected_test_events
);
1123 void test_auto_packet_end_stream_end_from_end(void)
1125 const struct test_event expected_test_events
[] = {
1126 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1127 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1128 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1129 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1130 { .type
= TEST_EV_TYPE_END
, },
1131 { .type
= TEST_EV_TYPE_SENTINEL
, },
1134 do_std_test(TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
1135 "automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1136 expected_test_events
);
1140 void test_multiple_auto_stream_end_from_end(void)
1142 bool expected
= true;
1143 struct test_event expected_event
;
1144 struct test_event expected_event2
;
1145 struct test_event
*event
;
1146 struct test_event
*event2
;
1148 do_std_test(TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
1149 "multiple automatic \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1152 if (test_events
->len
!= 5) {
1157 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1158 expected_event
.stream
= src_stream1
;
1159 expected_event
.packet
= NULL
;
1160 event
= &g_array_index(test_events
, struct test_event
, 0);
1161 if (!compare_single_test_events(event
, &expected_event
)) {
1166 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1167 expected_event
.stream
= src_stream2
;
1168 expected_event
.packet
= NULL
;
1169 event
= &g_array_index(test_events
, struct test_event
, 1);
1170 if (!compare_single_test_events(event
, &expected_event
)) {
1175 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1176 expected_event
.stream
= src_stream1
;
1177 expected_event
.packet
= NULL
;
1178 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1179 expected_event2
.stream
= src_stream2
;
1180 expected_event2
.packet
= NULL
;
1181 event
= &g_array_index(test_events
, struct test_event
, 2);
1182 event2
= &g_array_index(test_events
, struct test_event
, 3);
1183 if (!(compare_single_test_events(event
, &expected_event
) &&
1184 compare_single_test_events(event2
, &expected_event2
)) &&
1185 !(compare_single_test_events(event2
, &expected_event
) &&
1186 compare_single_test_events(event
, &expected_event2
))) {
1191 expected_event
.type
= TEST_EV_TYPE_END
;
1192 expected_event
.stream
= NULL
;
1193 expected_event
.packet
= NULL
;
1194 event
= &g_array_index(test_events
, struct test_event
, 4);
1195 if (!compare_single_test_events(event
, &expected_event
)) {
1202 "the produced sequence of test events is the expected one");
1206 void test_multiple_auto_packet_end_stream_end_from_end(void)
1208 bool expected
= true;
1209 struct test_event expected_event
;
1210 struct test_event expected_event2
;
1211 struct test_event
*event
;
1212 struct test_event
*event2
;
1214 do_std_test(TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
1215 "multiple automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1218 if (test_events
->len
!= 9) {
1223 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1224 expected_event
.stream
= src_stream1
;
1225 expected_event
.packet
= NULL
;
1226 event
= &g_array_index(test_events
, struct test_event
, 0);
1227 if (!compare_single_test_events(event
, &expected_event
)) {
1232 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1233 expected_event
.stream
= src_stream2
;
1234 expected_event
.packet
= NULL
;
1235 event
= &g_array_index(test_events
, struct test_event
, 1);
1236 if (!compare_single_test_events(event
, &expected_event
)) {
1241 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1242 expected_event
.stream
= src_stream1
;
1243 expected_event
.packet
= src_stream1_packet1
;
1244 event
= &g_array_index(test_events
, struct test_event
, 2);
1245 if (!compare_single_test_events(event
, &expected_event
)) {
1250 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1251 expected_event
.stream
= src_stream2
;
1252 expected_event
.packet
= src_stream2_packet1
;
1253 event
= &g_array_index(test_events
, struct test_event
, 3);
1254 if (!compare_single_test_events(event
, &expected_event
)) {
1259 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1260 expected_event
.stream
= src_stream1
;
1261 expected_event
.packet
= src_stream1_packet1
;
1262 expected_event2
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1263 expected_event2
.stream
= src_stream2
;
1264 expected_event2
.packet
= src_stream2_packet1
;
1265 event
= &g_array_index(test_events
, struct test_event
, 4);
1266 event2
= &g_array_index(test_events
, struct test_event
, 6);
1267 if (!(compare_single_test_events(event
, &expected_event
) &&
1268 compare_single_test_events(event2
, &expected_event2
)) &&
1269 !(compare_single_test_events(event2
, &expected_event
) &&
1270 compare_single_test_events(event
, &expected_event2
))) {
1275 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1276 expected_event
.stream
= src_stream1
;
1277 expected_event
.packet
= NULL
;
1278 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1279 expected_event2
.stream
= src_stream2
;
1280 expected_event2
.packet
= NULL
;
1281 event
= &g_array_index(test_events
, struct test_event
, 5);
1282 event2
= &g_array_index(test_events
, struct test_event
, 7);
1283 if (!(compare_single_test_events(event
, &expected_event
) &&
1284 compare_single_test_events(event2
, &expected_event2
)) &&
1285 !(compare_single_test_events(event2
, &expected_event
) &&
1286 compare_single_test_events(event
, &expected_event2
))) {
1291 expected_event
.type
= TEST_EV_TYPE_END
;
1292 expected_event
.stream
= NULL
;
1293 expected_event
.packet
= NULL
;
1294 event
= &g_array_index(test_events
, struct test_event
, 8);
1295 if (!compare_single_test_events(event
, &expected_event
)) {
1302 "the produced sequence of test events is the expected one");
1305 #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
1307 int main(int argc
, char **argv
)
1309 if (getenv(DEBUG_ENV_VAR
) && strcmp(getenv(DEBUG_ENV_VAR
), "1") == 0) {
1313 plan_tests(NR_TESTS
);
1315 test_no_auto_notifs();
1316 test_auto_stream_begin_from_packet_begin();
1317 test_auto_stream_begin_from_stream_end();
1318 test_auto_stream_end_from_end();
1319 test_auto_packet_begin_from_packet_end();
1320 test_auto_packet_begin_from_event();
1321 test_auto_packet_end_from_packet_begin();
1322 test_auto_packet_end_packet_begin_from_event();
1323 test_auto_packet_end_from_stream_end();
1324 test_auto_packet_end_stream_end_from_end();
1325 test_multiple_auto_stream_end_from_end();
1326 test_multiple_auto_packet_end_stream_end_from_end();
1328 return exit_status();