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.h>
49 #include <babeltrace/graph/private-connection.h>
50 #include <babeltrace/graph/private-notification-iterator.h>
51 #include <babeltrace/graph/private-port.h>
52 #include <babeltrace/plugin/plugin.h>
53 #include <babeltrace/ref.h>
62 TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
63 TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
64 TEST_AUTO_STREAM_END_FROM_END
,
65 TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
66 TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
67 TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
68 TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
69 TEST_AUTO_PACKET_END_FROM_STREAM_END
,
70 TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
71 TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
72 TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
75 enum test_event_type
{
76 TEST_EV_TYPE_NOTIF_UNEXPECTED
,
77 TEST_EV_TYPE_NOTIF_EVENT
,
78 TEST_EV_TYPE_NOTIF_INACTIVITY
,
79 TEST_EV_TYPE_NOTIF_STREAM_BEGIN
,
80 TEST_EV_TYPE_NOTIF_PACKET_BEGIN
,
81 TEST_EV_TYPE_NOTIF_PACKET_END
,
82 TEST_EV_TYPE_NOTIF_STREAM_END
,
84 TEST_EV_TYPE_SENTINEL
,
88 enum test_event_type type
;
89 struct bt_ctf_stream
*stream
;
90 struct bt_ctf_packet
*packet
;
93 struct source_muxer_sink
{
94 struct bt_component
*source
;
95 struct bt_component
*sink
;
98 static bool debug
= false;
99 static enum test current_test
;
100 static GArray
*test_events
;
101 static struct bt_clock_class_priority_map
*src_empty_cc_prio_map
;
102 static struct bt_ctf_stream_class
*src_stream_class
;
103 static struct bt_ctf_event_class
*src_event_class
;
104 static struct bt_ctf_stream
*src_stream1
;
105 static struct bt_ctf_stream
*src_stream2
;
106 static struct bt_ctf_packet
*src_stream1_packet1
;
107 static struct bt_ctf_packet
*src_stream1_packet2
;
108 static struct bt_ctf_packet
*src_stream2_packet1
;
109 static struct bt_ctf_packet
*src_stream2_packet2
;
113 SEQ_STREAM1_BEGIN
= -2,
114 SEQ_STREAM2_BEGIN
= -3,
115 SEQ_STREAM1_END
= -4,
116 SEQ_STREAM2_END
= -5,
117 SEQ_STREAM1_PACKET1_BEGIN
= -6,
118 SEQ_STREAM1_PACKET2_BEGIN
= -7,
119 SEQ_STREAM2_PACKET1_BEGIN
= -8,
120 SEQ_STREAM2_PACKET2_BEGIN
= -9,
121 SEQ_STREAM1_PACKET1_END
= -10,
122 SEQ_STREAM1_PACKET2_END
= -11,
123 SEQ_STREAM2_PACKET1_END
= -12,
124 SEQ_STREAM2_PACKET2_END
= -13,
125 SEQ_EVENT_STREAM1_PACKET1
= -14,
126 SEQ_EVENT_STREAM1_PACKET2
= -15,
127 SEQ_EVENT_STREAM2_PACKET1
= -16,
128 SEQ_EVENT_STREAM2_PACKET2
= -17,
129 SEQ_INACTIVITY
= -18,
132 struct src_iter_user_data
{
137 struct sink_user_data
{
138 struct bt_notification_iterator
*notif_iter
;
142 * No automatic notifications generated in this block.
143 * Stream 2 notifications are more indented.
145 static int64_t seq_no_auto_notifs
[] = {
147 SEQ_STREAM1_PACKET1_BEGIN
,
148 SEQ_EVENT_STREAM1_PACKET1
,
149 SEQ_EVENT_STREAM1_PACKET1
,
151 SEQ_EVENT_STREAM1_PACKET1
,
152 SEQ_STREAM2_PACKET2_BEGIN
,
153 SEQ_EVENT_STREAM2_PACKET2
,
154 SEQ_EVENT_STREAM1_PACKET1
,
155 SEQ_STREAM1_PACKET1_END
,
156 SEQ_STREAM2_PACKET2_END
,
157 SEQ_STREAM1_PACKET2_BEGIN
,
158 SEQ_EVENT_STREAM1_PACKET2
,
160 SEQ_STREAM1_PACKET2_END
,
165 /* Automatic "stream begin" from "packet begin" */
166 static int64_t seq_auto_stream_begin_from_packet_begin
[] = {
167 /* Automatic "stream begin" here */
168 SEQ_STREAM1_PACKET1_BEGIN
,
169 SEQ_STREAM1_PACKET1_END
,
174 /* Automatic "stream begin" from "stream end" */
175 static int64_t seq_auto_stream_begin_from_stream_end
[] = {
176 /* Automatic "stream begin" here */
181 /* Automatic "stream end" from END */
182 static int64_t seq_auto_stream_end_from_end
[] = {
184 /* Automatic "packet end" here */
188 /* Automatic "packet begin" from "packet end" */
189 static int64_t seq_auto_packet_begin_from_packet_end
[] = {
191 /* Automatic "packet begin" here */
192 SEQ_STREAM1_PACKET1_END
,
197 /* Automatic "packet begin" from event */
198 static int64_t seq_auto_packet_begin_from_event
[] = {
200 /* Automatic "packet begin" here */
201 SEQ_EVENT_STREAM1_PACKET1
,
202 SEQ_STREAM1_PACKET1_END
,
207 /* Automatic "packet end" from "packet begin" */
208 static int64_t seq_auto_packet_end_from_packet_begin
[] = {
210 SEQ_STREAM1_PACKET1_BEGIN
,
211 /* Automatic "packet end" here */
212 SEQ_STREAM1_PACKET2_BEGIN
,
213 SEQ_STREAM1_PACKET2_END
,
218 /* Automatic "packet end" and "packet begin" from event */
219 static int64_t seq_auto_packet_end_packet_begin_from_event
[] = {
221 SEQ_STREAM1_PACKET1_BEGIN
,
222 /* Automatic "packet end" here */
223 /* Automatic "packet begin" here */
224 SEQ_EVENT_STREAM1_PACKET2
,
225 SEQ_STREAM1_PACKET2_END
,
230 /* Automatic "packet end" from "stream end" */
231 static int64_t seq_auto_packet_end_from_stream_end
[] = {
233 SEQ_STREAM1_PACKET1_BEGIN
,
234 /* Automatic "packet end" here */
239 /* Automatic "packet end" and "stream end" from END */
240 static int64_t seq_auto_packet_end_stream_end_from_end
[] = {
242 SEQ_STREAM1_PACKET1_BEGIN
,
243 /* Automatic "packet end" here */
244 /* Automatic "stream end" here */
248 /* Multiple automatic "stream end" from END */
249 static int64_t seq_multiple_auto_stream_end_from_end
[] = {
252 /* Automatic "stream end" here */
253 /* Automatic "stream end" here */
257 /* Multiple automatic "packet end" and "stream end" from END */
258 static int64_t seq_multiple_auto_packet_end_stream_end_from_end
[] = {
261 SEQ_STREAM1_PACKET1_BEGIN
,
262 SEQ_STREAM2_PACKET1_BEGIN
,
263 /* Automatic "packet end" here */
264 /* Automatic "stream end" here */
265 /* Automatic "packet end" here */
266 /* Automatic "stream end" here */
271 void clear_test_events(void)
273 g_array_set_size(test_events
, 0);
277 void print_test_event(FILE *fp
, const struct test_event
*event
)
279 fprintf(fp
, "{ type = ");
281 switch (event
->type
) {
282 case TEST_EV_TYPE_NOTIF_UNEXPECTED
:
283 fprintf(fp
, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
285 case TEST_EV_TYPE_NOTIF_EVENT
:
286 fprintf(fp
, "TEST_EV_TYPE_NOTIF_EVENT");
288 case TEST_EV_TYPE_NOTIF_INACTIVITY
:
289 fprintf(fp
, "TEST_EV_TYPE_NOTIF_INACTIVITY");
291 case TEST_EV_TYPE_NOTIF_STREAM_BEGIN
:
292 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
294 case TEST_EV_TYPE_NOTIF_STREAM_END
:
295 fprintf(fp
, "TEST_EV_TYPE_NOTIF_STREAM_END");
297 case TEST_EV_TYPE_NOTIF_PACKET_BEGIN
:
298 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
300 case TEST_EV_TYPE_NOTIF_PACKET_END
:
301 fprintf(fp
, "TEST_EV_TYPE_NOTIF_PACKET_END");
303 case TEST_EV_TYPE_END
:
304 fprintf(fp
, "TEST_EV_TYPE_END");
306 case TEST_EV_TYPE_SENTINEL
:
307 fprintf(fp
, "TEST_EV_TYPE_SENTINEL");
310 fprintf(fp
, "(UNKNOWN)");
314 fprintf(fp
, ", stream = %p, packet = %p }", event
->stream
,
319 void append_test_event(struct test_event
*event
)
321 g_array_append_val(test_events
, *event
);
325 bool compare_single_test_events(const struct test_event
*ev_a
,
326 const struct test_event
*ev_b
)
329 fprintf(stderr
, ":: Comparing test events: ");
330 print_test_event(stderr
, ev_a
);
331 fprintf(stderr
, " vs. ");
332 print_test_event(stderr
, ev_b
);
333 fprintf(stderr
, "\n");
336 if (ev_a
->type
!= ev_b
->type
) {
340 switch (ev_a
->type
) {
341 case TEST_EV_TYPE_END
:
342 case TEST_EV_TYPE_SENTINEL
:
345 if (ev_a
->stream
!= ev_b
->stream
) {
349 if (ev_a
->packet
!= ev_b
->packet
) {
359 bool compare_test_events(const struct test_event
*expected_events
)
361 const struct test_event
*expected_event
= expected_events
;
364 assert(expected_events
);
367 const struct test_event
*event
;
369 if (expected_event
->type
== TEST_EV_TYPE_SENTINEL
) {
373 if (i
>= test_events
->len
) {
377 event
= &g_array_index(test_events
, struct test_event
, i
);
379 if (!compare_single_test_events(event
, expected_event
)) {
387 if (i
!= test_events
->len
) {
395 void init_static_data(void)
398 struct bt_ctf_trace
*trace
;
399 struct bt_ctf_field_type
*empty_struct_ft
;
402 test_events
= g_array_new(FALSE
, TRUE
, sizeof(struct test_event
));
406 empty_struct_ft
= bt_ctf_field_type_structure_create();
407 assert(empty_struct_ft
);
408 trace
= bt_ctf_trace_create();
410 ret
= bt_ctf_trace_set_native_byte_order(trace
,
411 BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
);
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
)
704 return BT_COMPONENT_STATUS_OK
;
708 void src_finalize(struct bt_private_component
*private_component
)
713 enum bt_component_status
sink_consume(
714 struct bt_private_component
*priv_component
)
716 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
717 struct bt_notification
*notification
= NULL
;
718 struct sink_user_data
*user_data
=
719 bt_private_component_get_user_data(priv_component
);
720 enum bt_notification_iterator_status it_ret
;
721 struct test_event test_event
= { 0 };
722 bool do_append_test_event
= true;
724 assert(user_data
&& user_data
->notif_iter
);
725 it_ret
= bt_notification_iterator_next(user_data
->notif_iter
);
728 ret
= BT_COMPONENT_STATUS_ERROR
;
729 do_append_test_event
= false;
734 case BT_NOTIFICATION_ITERATOR_STATUS_END
:
735 test_event
.type
= TEST_EV_TYPE_END
;
736 ret
= BT_COMPONENT_STATUS_END
;
737 BT_PUT(user_data
->notif_iter
);
739 case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN
:
745 notification
= bt_notification_iterator_get_notification(
746 user_data
->notif_iter
);
747 assert(notification
);
749 switch (bt_notification_get_type(notification
)) {
750 case BT_NOTIFICATION_TYPE_EVENT
:
752 struct bt_ctf_event
*event
;
754 test_event
.type
= TEST_EV_TYPE_NOTIF_EVENT
;
755 event
= bt_notification_event_get_event(notification
);
757 test_event
.packet
= bt_ctf_event_get_packet(event
);
759 assert(test_event
.packet
);
760 bt_put(test_event
.packet
);
763 case BT_NOTIFICATION_TYPE_INACTIVITY
:
764 test_event
.type
= TEST_EV_TYPE_NOTIF_INACTIVITY
;
766 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
767 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
769 bt_notification_stream_begin_get_stream(notification
);
770 assert(test_event
.stream
);
771 bt_put(test_event
.stream
);
773 case BT_NOTIFICATION_TYPE_STREAM_END
:
774 test_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
776 bt_notification_stream_end_get_stream(notification
);
777 assert(test_event
.stream
);
778 bt_put(test_event
.stream
);
780 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
781 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
783 bt_notification_packet_begin_get_packet(notification
);
784 assert(test_event
.packet
);
785 bt_put(test_event
.packet
);
787 case BT_NOTIFICATION_TYPE_PACKET_END
:
788 test_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
790 bt_notification_packet_end_get_packet(notification
);
791 assert(test_event
.packet
);
792 bt_put(test_event
.packet
);
795 test_event
.type
= TEST_EV_TYPE_NOTIF_UNEXPECTED
;
799 if (test_event
.packet
) {
800 test_event
.stream
= bt_ctf_packet_get_stream(test_event
.packet
);
801 assert(test_event
.stream
);
802 bt_put(test_event
.stream
);
806 if (do_append_test_event
) {
807 append_test_event(&test_event
);
810 bt_put(notification
);
815 void sink_port_connected(struct bt_private_component
*private_component
,
816 struct bt_private_port
*self_private_port
,
817 struct bt_port
*other_port
)
819 struct bt_private_connection
*priv_conn
=
820 bt_private_port_get_private_connection(self_private_port
);
821 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
826 user_data
->notif_iter
=
827 bt_private_connection_create_notification_iterator(priv_conn
);
828 assert(user_data
->notif_iter
);
833 enum bt_component_status
sink_init(
834 struct bt_private_component
*private_component
,
835 struct bt_value
*params
, void *init_method_data
)
837 struct sink_user_data
*user_data
= g_new0(struct sink_user_data
, 1);
841 ret
= bt_private_component_set_user_data(private_component
,
844 return BT_COMPONENT_STATUS_OK
;
848 void sink_finalize(struct bt_private_component
*private_component
)
850 struct sink_user_data
*user_data
= bt_private_component_get_user_data(
854 bt_put(user_data
->notif_iter
);
860 void create_source_sink(struct bt_component
**source
,
861 struct bt_component
**sink
)
863 struct bt_component_class
*src_comp_class
;
864 struct bt_component_class
*sink_comp_class
;
867 /* Create source component */
868 src_comp_class
= bt_component_class_source_create("src", src_iter_next
);
869 assert(src_comp_class
);
870 ret
= bt_component_class_set_init_method(src_comp_class
, src_init
);
872 ret
= bt_component_class_set_finalize_method(src_comp_class
,
875 ret
= bt_component_class_source_set_notification_iterator_init_method(
876 src_comp_class
, src_iter_init
);
878 ret
= bt_component_class_source_set_notification_iterator_finalize_method(
879 src_comp_class
, src_iter_finalize
);
881 *source
= bt_component_create(src_comp_class
, "source", NULL
);
884 /* Create sink component */
885 sink_comp_class
= bt_component_class_sink_create("sink", sink_consume
);
886 assert(sink_comp_class
);
887 ret
= bt_component_class_set_init_method(sink_comp_class
, sink_init
);
889 ret
= bt_component_class_set_finalize_method(sink_comp_class
,
891 ret
= bt_component_class_set_port_connected_method(sink_comp_class
,
892 sink_port_connected
);
894 *sink
= bt_component_create(sink_comp_class
, "sink", NULL
);
896 bt_put(src_comp_class
);
897 bt_put(sink_comp_class
);
901 void do_std_test(enum test test
, const char *name
,
902 const struct test_event
*expected_test_events
)
904 struct bt_component
*src_comp
;
905 struct bt_component
*sink_comp
;
906 struct bt_port
*upstream_port
;
907 struct bt_port
*downstream_port
;
908 struct bt_graph
*graph
;
910 enum bt_graph_status graph_status
= BT_GRAPH_STATUS_OK
;
914 diag("test: %s", name
);
915 create_source_sink(&src_comp
, &sink_comp
);
916 graph
= bt_graph_create();
919 /* Connect source to sink */
920 upstream_port
= bt_component_source_get_default_output_port(src_comp
);
921 assert(upstream_port
);
922 downstream_port
= bt_component_sink_get_default_input_port(sink_comp
);
923 assert(downstream_port
);
924 conn
= bt_graph_connect_ports(graph
, upstream_port
, downstream_port
);
927 bt_put(upstream_port
);
928 bt_put(downstream_port
);
930 /* Run the graph until the end */
931 while (graph_status
== BT_GRAPH_STATUS_OK
||
932 graph_status
== BT_GRAPH_STATUS_AGAIN
) {
933 graph_status
= bt_graph_run(graph
);
936 ok(graph_status
== BT_GRAPH_STATUS_END
, "graph finishes without any error");
938 /* Compare the resulting test events */
939 if (expected_test_events
) {
940 ok(compare_test_events(expected_test_events
),
941 "the produced sequence of test events is the expected one");
950 void test_no_auto_notifs(void)
952 const struct test_event expected_test_events
[] = {
953 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
954 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
955 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
956 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
957 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream2
, .packet
= NULL
, },
958 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
959 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
960 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
961 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
962 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
963 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream2
, .packet
= src_stream2_packet2
, },
964 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
965 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
966 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream2
, .packet
= NULL
, },
967 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
968 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
969 { .type
= TEST_EV_TYPE_END
, },
970 { .type
= TEST_EV_TYPE_SENTINEL
, },
973 do_std_test(TEST_NO_AUTO_NOTIFS
, "no automatic notifications",
974 expected_test_events
);
978 void test_auto_stream_begin_from_packet_begin(void)
980 const struct test_event expected_test_events
[] = {
981 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
982 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
983 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
984 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
985 { .type
= TEST_EV_TYPE_END
, },
986 { .type
= TEST_EV_TYPE_SENTINEL
, },
989 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN
,
990 "automatic \"stream begin\" notif. caused by \"packet begin\" notif.",
991 expected_test_events
);
995 void test_auto_stream_begin_from_stream_end(void)
997 const struct test_event expected_test_events
[] = {
998 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
999 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1000 { .type
= TEST_EV_TYPE_END
, },
1001 { .type
= TEST_EV_TYPE_SENTINEL
, },
1004 do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END
,
1005 "automatic \"stream begin\" notif. caused by \"stream end\" notif.",
1006 expected_test_events
);
1010 void test_auto_stream_end_from_end(void)
1012 const struct test_event expected_test_events
[] = {
1013 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1014 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1015 { .type
= TEST_EV_TYPE_END
, },
1016 { .type
= TEST_EV_TYPE_SENTINEL
, },
1019 do_std_test(TEST_AUTO_STREAM_END_FROM_END
,
1020 "automatic \"stream end\" notif. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1021 expected_test_events
);
1025 void test_auto_packet_begin_from_packet_end(void)
1027 const struct test_event expected_test_events
[] = {
1028 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1029 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1030 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1031 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1032 { .type
= TEST_EV_TYPE_END
, },
1033 { .type
= TEST_EV_TYPE_SENTINEL
, },
1036 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END
,
1037 "automatic \"packet begin\" notif. caused by \"packet end\" notif.",
1038 expected_test_events
);
1042 void test_auto_packet_begin_from_event(void)
1044 const struct test_event expected_test_events
[] = {
1045 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1046 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1047 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1048 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1049 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1050 { .type
= TEST_EV_TYPE_END
, },
1051 { .type
= TEST_EV_TYPE_SENTINEL
, },
1054 do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_EVENT
,
1055 "automatic \"packet begin\" notif. caused by event notif.",
1056 expected_test_events
);
1060 void test_auto_packet_end_from_packet_begin(void)
1062 const struct test_event expected_test_events
[] = {
1063 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1064 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1065 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1066 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1067 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1068 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1069 { .type
= TEST_EV_TYPE_END
, },
1070 { .type
= TEST_EV_TYPE_SENTINEL
, },
1073 do_std_test(TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN
,
1074 "automatic \"packet end\" notif. caused by \"packet begin\" notif.",
1075 expected_test_events
);
1079 void test_auto_packet_end_packet_begin_from_event(void)
1081 const struct test_event expected_test_events
[] = {
1082 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1083 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1084 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1085 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1086 { .type
= TEST_EV_TYPE_NOTIF_EVENT
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1087 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet2
, },
1088 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1089 { .type
= TEST_EV_TYPE_END
, },
1090 { .type
= TEST_EV_TYPE_SENTINEL
, },
1093 do_std_test(TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT
,
1094 "automatic \"packet end\" and \"packet begin\" notifs. caused by event notif.",
1095 expected_test_events
);
1099 void test_auto_packet_end_from_stream_end(void)
1101 const struct test_event expected_test_events
[] = {
1102 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1103 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1104 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1105 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1106 { .type
= TEST_EV_TYPE_END
, },
1107 { .type
= TEST_EV_TYPE_SENTINEL
, },
1110 do_std_test(TEST_AUTO_PACKET_END_FROM_STREAM_END
,
1111 "automatic \"packet end\" notif. caused by \"stream end\" notif.",
1112 expected_test_events
);
1116 void test_auto_packet_end_stream_end_from_end(void)
1118 const struct test_event expected_test_events
[] = {
1119 { .type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
, .stream
= src_stream1
, .packet
= NULL
, },
1120 { .type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1121 { .type
= TEST_EV_TYPE_NOTIF_PACKET_END
, .stream
= src_stream1
, .packet
= src_stream1_packet1
, },
1122 { .type
= TEST_EV_TYPE_NOTIF_STREAM_END
, .stream
= src_stream1
, .packet
= NULL
, },
1123 { .type
= TEST_EV_TYPE_END
, },
1124 { .type
= TEST_EV_TYPE_SENTINEL
, },
1127 do_std_test(TEST_AUTO_PACKET_END_STREAM_END_FROM_END
,
1128 "automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1129 expected_test_events
);
1133 void test_multiple_auto_stream_end_from_end(void)
1135 bool expected
= true;
1136 struct test_event expected_event
;
1137 struct test_event expected_event2
;
1138 struct test_event
*event
;
1139 struct test_event
*event2
;
1141 do_std_test(TEST_MULTIPLE_AUTO_STREAM_END_FROM_END
,
1142 "multiple automatic \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1145 if (test_events
->len
!= 5) {
1150 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1151 expected_event
.stream
= src_stream1
;
1152 expected_event
.packet
= NULL
;
1153 event
= &g_array_index(test_events
, struct test_event
, 0);
1154 if (!compare_single_test_events(event
, &expected_event
)) {
1159 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1160 expected_event
.stream
= src_stream2
;
1161 expected_event
.packet
= NULL
;
1162 event
= &g_array_index(test_events
, struct test_event
, 1);
1163 if (!compare_single_test_events(event
, &expected_event
)) {
1168 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1169 expected_event
.stream
= src_stream1
;
1170 expected_event
.packet
= NULL
;
1171 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1172 expected_event2
.stream
= src_stream2
;
1173 expected_event2
.packet
= NULL
;
1174 event
= &g_array_index(test_events
, struct test_event
, 2);
1175 event2
= &g_array_index(test_events
, struct test_event
, 3);
1176 if (!(compare_single_test_events(event
, &expected_event
) &&
1177 compare_single_test_events(event2
, &expected_event2
)) &&
1178 !(compare_single_test_events(event2
, &expected_event
) &&
1179 compare_single_test_events(event
, &expected_event2
))) {
1184 expected_event
.type
= TEST_EV_TYPE_END
;
1185 expected_event
.stream
= NULL
;
1186 expected_event
.packet
= NULL
;
1187 event
= &g_array_index(test_events
, struct test_event
, 4);
1188 if (!compare_single_test_events(event
, &expected_event
)) {
1195 "the produced sequence of test events is the expected one");
1199 void test_multiple_auto_packet_end_stream_end_from_end(void)
1201 bool expected
= true;
1202 struct test_event expected_event
;
1203 struct test_event expected_event2
;
1204 struct test_event
*event
;
1205 struct test_event
*event2
;
1207 do_std_test(TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END
,
1208 "multiple automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END",
1211 if (test_events
->len
!= 9) {
1216 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1217 expected_event
.stream
= src_stream1
;
1218 expected_event
.packet
= NULL
;
1219 event
= &g_array_index(test_events
, struct test_event
, 0);
1220 if (!compare_single_test_events(event
, &expected_event
)) {
1225 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_BEGIN
;
1226 expected_event
.stream
= src_stream2
;
1227 expected_event
.packet
= NULL
;
1228 event
= &g_array_index(test_events
, struct test_event
, 1);
1229 if (!compare_single_test_events(event
, &expected_event
)) {
1234 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1235 expected_event
.stream
= src_stream1
;
1236 expected_event
.packet
= src_stream1_packet1
;
1237 event
= &g_array_index(test_events
, struct test_event
, 2);
1238 if (!compare_single_test_events(event
, &expected_event
)) {
1243 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_BEGIN
;
1244 expected_event
.stream
= src_stream2
;
1245 expected_event
.packet
= src_stream2_packet1
;
1246 event
= &g_array_index(test_events
, struct test_event
, 3);
1247 if (!compare_single_test_events(event
, &expected_event
)) {
1252 expected_event
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1253 expected_event
.stream
= src_stream1
;
1254 expected_event
.packet
= src_stream1_packet1
;
1255 expected_event2
.type
= TEST_EV_TYPE_NOTIF_PACKET_END
;
1256 expected_event2
.stream
= src_stream2
;
1257 expected_event2
.packet
= src_stream2_packet1
;
1258 event
= &g_array_index(test_events
, struct test_event
, 4);
1259 event2
= &g_array_index(test_events
, struct test_event
, 6);
1260 if (!(compare_single_test_events(event
, &expected_event
) &&
1261 compare_single_test_events(event2
, &expected_event2
)) &&
1262 !(compare_single_test_events(event2
, &expected_event
) &&
1263 compare_single_test_events(event
, &expected_event2
))) {
1268 expected_event
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1269 expected_event
.stream
= src_stream1
;
1270 expected_event
.packet
= NULL
;
1271 expected_event2
.type
= TEST_EV_TYPE_NOTIF_STREAM_END
;
1272 expected_event2
.stream
= src_stream2
;
1273 expected_event2
.packet
= NULL
;
1274 event
= &g_array_index(test_events
, struct test_event
, 5);
1275 event2
= &g_array_index(test_events
, struct test_event
, 7);
1276 if (!(compare_single_test_events(event
, &expected_event
) &&
1277 compare_single_test_events(event2
, &expected_event2
)) &&
1278 !(compare_single_test_events(event2
, &expected_event
) &&
1279 compare_single_test_events(event
, &expected_event2
))) {
1284 expected_event
.type
= TEST_EV_TYPE_END
;
1285 expected_event
.stream
= NULL
;
1286 expected_event
.packet
= NULL
;
1287 event
= &g_array_index(test_events
, struct test_event
, 8);
1288 if (!compare_single_test_events(event
, &expected_event
)) {
1295 "the produced sequence of test events is the expected one");
1298 #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
1300 int main(int argc
, char **argv
)
1302 if (getenv(DEBUG_ENV_VAR
) && strcmp(getenv(DEBUG_ENV_VAR
), "1") == 0) {
1306 plan_tests(NR_TESTS
);
1308 test_no_auto_notifs();
1309 test_auto_stream_begin_from_packet_begin();
1310 test_auto_stream_begin_from_stream_end();
1311 test_auto_stream_end_from_end();
1312 test_auto_packet_begin_from_packet_end();
1313 test_auto_packet_begin_from_event();
1314 test_auto_packet_end_from_packet_begin();
1315 test_auto_packet_end_packet_begin_from_event();
1316 test_auto_packet_end_from_stream_end();
1317 test_auto_packet_end_stream_end_from_end();
1318 test_multiple_auto_stream_end_from_end();
1319 test_multiple_auto_packet_end_stream_end_from_end();
1321 return exit_status();