X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Flib%2Ftest_bt_notification_iterator.c;h=645b8850609cc559720a28144eb9752dd86d84af;hb=56e18c4ce186892c36d7f2cb5078087425e60134;hp=d4bb01da49973e7eb292b002f159313bfc744a68;hpb=90157d89276ed1a569a2d4ffcfeed0b415817c12;p=babeltrace.git diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index d4bb01da..645b8850 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -21,16 +21,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -41,15 +40,16 @@ #include #include #include -#include #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -58,27 +58,16 @@ #include "tap/tap.h" -#define NR_TESTS 24 +#define NR_TESTS 5 enum test { TEST_NO_AUTO_NOTIFS, - TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN, - TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END, - TEST_AUTO_STREAM_END_FROM_END, - TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END, - TEST_AUTO_PACKET_BEGIN_FROM_EVENT, - TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN, - TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT, - TEST_AUTO_PACKET_END_FROM_STREAM_END, - TEST_AUTO_PACKET_END_STREAM_END_FROM_END, - TEST_MULTIPLE_AUTO_STREAM_END_FROM_END, - TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END, + TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR, }; enum test_event_type { TEST_EV_TYPE_NOTIF_UNEXPECTED, TEST_EV_TYPE_NOTIF_EVENT, - TEST_EV_TYPE_NOTIF_INACTIVITY, TEST_EV_TYPE_NOTIF_STREAM_BEGIN, TEST_EV_TYPE_NOTIF_PACKET_BEGIN, TEST_EV_TYPE_NOTIF_PACKET_END, @@ -89,27 +78,23 @@ enum test_event_type { struct test_event { enum test_event_type type; - struct bt_ctf_stream *stream; - struct bt_ctf_packet *packet; -}; - -struct source_muxer_sink { - struct bt_component *source; - struct bt_component *sink; + struct bt_stream *stream; + struct bt_packet *packet; }; static bool debug = false; static enum test current_test; static GArray *test_events; -static struct bt_clock_class_priority_map *src_empty_cc_prio_map; -static struct bt_ctf_stream_class *src_stream_class; -static struct bt_ctf_event_class *src_event_class; -static struct bt_ctf_stream *src_stream1; -static struct bt_ctf_stream *src_stream2; -static struct bt_ctf_packet *src_stream1_packet1; -static struct bt_ctf_packet *src_stream1_packet2; -static struct bt_ctf_packet *src_stream2_packet1; -static struct bt_ctf_packet *src_stream2_packet2; +static struct bt_graph *graph; +static struct bt_private_connection_private_notification_iterator *cur_notif_iter; +static struct bt_stream_class *src_stream_class; +static struct bt_event_class *src_event_class; +static struct bt_stream *src_stream1; +static struct bt_stream *src_stream2; +static struct bt_packet *src_stream1_packet1; +static struct bt_packet *src_stream1_packet2; +static struct bt_packet *src_stream2_packet1; +static struct bt_packet *src_stream2_packet2; enum { SEQ_END = -1, @@ -129,7 +114,6 @@ enum { SEQ_EVENT_STREAM1_PACKET2 = -15, SEQ_EVENT_STREAM2_PACKET1 = -16, SEQ_EVENT_STREAM2_PACKET2 = -17, - SEQ_INACTIVITY = -18, }; struct src_iter_user_data { @@ -165,111 +149,6 @@ static int64_t seq_no_auto_notifs[] = { SEQ_END, }; -/* Automatic "stream begin" from "packet begin" */ -static int64_t seq_auto_stream_begin_from_packet_begin[] = { - /* Automatic "stream begin" here */ - SEQ_STREAM1_PACKET1_BEGIN, - SEQ_STREAM1_PACKET1_END, - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "stream begin" from "stream end" */ -static int64_t seq_auto_stream_begin_from_stream_end[] = { - /* Automatic "stream begin" here */ - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "stream end" from END */ -static int64_t seq_auto_stream_end_from_end[] = { - SEQ_STREAM1_BEGIN, - /* Automatic "packet end" here */ - SEQ_END, -}; - -/* Automatic "packet begin" from "packet end" */ -static int64_t seq_auto_packet_begin_from_packet_end[] = { - SEQ_STREAM1_BEGIN, - /* Automatic "packet begin" here */ - SEQ_STREAM1_PACKET1_END, - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "packet begin" from event */ -static int64_t seq_auto_packet_begin_from_event[] = { - SEQ_STREAM1_BEGIN, - /* Automatic "packet begin" here */ - SEQ_EVENT_STREAM1_PACKET1, - SEQ_STREAM1_PACKET1_END, - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "packet end" from "packet begin" */ -static int64_t seq_auto_packet_end_from_packet_begin[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM1_PACKET1_BEGIN, - /* Automatic "packet end" here */ - SEQ_STREAM1_PACKET2_BEGIN, - SEQ_STREAM1_PACKET2_END, - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "packet end" and "packet begin" from event */ -static int64_t seq_auto_packet_end_packet_begin_from_event[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM1_PACKET1_BEGIN, - /* Automatic "packet end" here */ - /* Automatic "packet begin" here */ - SEQ_EVENT_STREAM1_PACKET2, - SEQ_STREAM1_PACKET2_END, - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "packet end" from "stream end" */ -static int64_t seq_auto_packet_end_from_stream_end[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM1_PACKET1_BEGIN, - /* Automatic "packet end" here */ - SEQ_STREAM1_END, - SEQ_END, -}; - -/* Automatic "packet end" and "stream end" from END */ -static int64_t seq_auto_packet_end_stream_end_from_end[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM1_PACKET1_BEGIN, - /* Automatic "packet end" here */ - /* Automatic "stream end" here */ - SEQ_END, -}; - -/* Multiple automatic "stream end" from END */ -static int64_t seq_multiple_auto_stream_end_from_end[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM2_BEGIN, - /* Automatic "stream end" here */ - /* Automatic "stream end" here */ - SEQ_END, -}; - -/* Multiple automatic "packet end" and "stream end" from END */ -static int64_t seq_multiple_auto_packet_end_stream_end_from_end[] = { - SEQ_STREAM1_BEGIN, - SEQ_STREAM2_BEGIN, - SEQ_STREAM1_PACKET1_BEGIN, - SEQ_STREAM2_PACKET1_BEGIN, - /* Automatic "packet end" here */ - /* Automatic "stream end" here */ - /* Automatic "packet end" here */ - /* Automatic "stream end" here */ - SEQ_END, -}; - static void clear_test_events(void) { @@ -288,9 +167,6 @@ void print_test_event(FILE *fp, const struct test_event *event) case TEST_EV_TYPE_NOTIF_EVENT: fprintf(fp, "TEST_EV_TYPE_NOTIF_EVENT"); break; - case TEST_EV_TYPE_NOTIF_INACTIVITY: - fprintf(fp, "TEST_EV_TYPE_NOTIF_INACTIVITY"); - break; case TEST_EV_TYPE_NOTIF_STREAM_BEGIN: fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN"); break; @@ -364,7 +240,7 @@ bool compare_test_events(const struct test_event *expected_events) const struct test_event *expected_event = expected_events; size_t i = 0; - assert(expected_events); + BT_ASSERT(expected_events); while (true) { const struct test_event *event; @@ -397,58 +273,31 @@ bool compare_test_events(const struct test_event *expected_events) static void init_static_data(void) { - int ret; - struct bt_ctf_trace *trace; - struct bt_ctf_field_type *empty_struct_ft; + struct bt_trace *trace; /* Test events */ test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event)); - assert(test_events); + BT_ASSERT(test_events); /* Metadata */ - empty_struct_ft = bt_ctf_field_type_structure_create(); - assert(empty_struct_ft); - trace = bt_ctf_trace_create(); - assert(trace); - ret = bt_ctf_trace_set_packet_header_type(trace, empty_struct_ft); - assert(ret == 0); - src_empty_cc_prio_map = bt_clock_class_priority_map_create(); - assert(src_empty_cc_prio_map); - src_stream_class = bt_ctf_stream_class_create("my-stream-class"); - assert(src_stream_class); - ret = bt_ctf_stream_class_set_packet_context_type(src_stream_class, - empty_struct_ft); - assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(src_stream_class, - empty_struct_ft); - assert(ret == 0); - ret = bt_ctf_stream_class_set_event_context_type(src_stream_class, - empty_struct_ft); - assert(ret == 0); - src_event_class = bt_ctf_event_class_create("my-event-class"); - ret = bt_ctf_event_class_set_context_type(src_event_class, - empty_struct_ft); - assert(ret == 0); - ret = bt_ctf_event_class_set_context_type(src_event_class, - empty_struct_ft); - assert(ret == 0); - ret = bt_ctf_stream_class_add_event_class(src_stream_class, - src_event_class); - assert(ret == 0); - ret = bt_ctf_trace_add_stream_class(trace, src_stream_class); - assert(ret == 0); - src_stream1 = bt_ctf_stream_create(src_stream_class, "stream-1"); - assert(src_stream1); - src_stream2 = bt_ctf_stream_create(src_stream_class, "stream-2"); - assert(src_stream2); - src_stream1_packet1 = bt_ctf_packet_create(src_stream1); - assert(src_stream1_packet1); - src_stream1_packet2 = bt_ctf_packet_create(src_stream1); - assert(src_stream1_packet2); - src_stream2_packet1 = bt_ctf_packet_create(src_stream2); - assert(src_stream2_packet1); - src_stream2_packet2 = bt_ctf_packet_create(src_stream2); - assert(src_stream2_packet2); + trace = bt_trace_create(); + BT_ASSERT(trace); + src_stream_class = bt_stream_class_create(trace); + BT_ASSERT(src_stream_class); + src_event_class = bt_event_class_create(src_stream_class); + BT_ASSERT(src_event_class); + src_stream1 = bt_stream_create(src_stream_class); + BT_ASSERT(src_stream1); + src_stream2 = bt_stream_create(src_stream_class); + BT_ASSERT(src_stream2); + src_stream1_packet1 = bt_packet_create(src_stream1); + BT_ASSERT(src_stream1_packet1); + src_stream1_packet2 = bt_packet_create(src_stream1); + BT_ASSERT(src_stream1_packet2); + src_stream2_packet1 = bt_packet_create(src_stream2); + BT_ASSERT(src_stream2_packet1); + src_stream2_packet2 = bt_packet_create(src_stream2); + BT_ASSERT(src_stream2_packet2); if (debug) { fprintf(stderr, ":: stream 1: %p\n", src_stream1); @@ -460,7 +309,6 @@ void init_static_data(void) } bt_put(trace); - bt_put(empty_struct_ft); } static @@ -470,7 +318,6 @@ void fini_static_data(void) g_array_free(test_events, TRUE); /* Metadata */ - bt_put(src_empty_cc_prio_map); bt_put(src_stream_class); bt_put(src_event_class); bt_put(src_stream1); @@ -503,48 +350,16 @@ enum bt_notification_iterator_status src_iter_init( g_new0(struct src_iter_user_data, 1); int ret; - assert(user_data); - ret = bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter, - user_data); - assert(ret == 0); + BT_ASSERT(user_data); + ret = bt_private_connection_private_notification_iterator_set_user_data( + priv_notif_iter, user_data); + BT_ASSERT(ret == 0); switch (current_test) { case TEST_NO_AUTO_NOTIFS: + case TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR: user_data->seq = seq_no_auto_notifs; break; - case TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN: - user_data->seq = seq_auto_stream_begin_from_packet_begin; - break; - case TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END: - user_data->seq = seq_auto_stream_begin_from_stream_end; - break; - case TEST_AUTO_STREAM_END_FROM_END: - user_data->seq = seq_auto_stream_end_from_end; - break; - case TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END: - user_data->seq = seq_auto_packet_begin_from_packet_end; - break; - case TEST_AUTO_PACKET_BEGIN_FROM_EVENT: - user_data->seq = seq_auto_packet_begin_from_event; - break; - case TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN: - user_data->seq = seq_auto_packet_end_from_packet_begin; - break; - case TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT: - user_data->seq = seq_auto_packet_end_packet_begin_from_event; - break; - case TEST_AUTO_PACKET_END_FROM_STREAM_END: - user_data->seq = seq_auto_packet_end_from_stream_end; - break; - case TEST_AUTO_PACKET_END_STREAM_END_FROM_END: - user_data->seq = seq_auto_packet_end_stream_end_from_end; - break; - case TEST_MULTIPLE_AUTO_STREAM_END_FROM_END: - user_data->seq = seq_multiple_auto_stream_end_from_end; - break; - case TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END: - user_data->seq = seq_multiple_auto_packet_end_stream_end_from_end; - break; default: abort(); } @@ -553,99 +368,59 @@ enum bt_notification_iterator_status src_iter_init( } static -struct bt_ctf_event *src_create_event(struct bt_ctf_packet *packet) +void src_iter_next_seq_one(struct src_iter_user_data *user_data, + struct bt_notification **notif) { - struct bt_ctf_event *event = bt_ctf_event_create(src_event_class); - int ret; - - assert(event); - ret = bt_ctf_event_set_packet(event, packet); - assert(ret == 0); - return event; -} + struct bt_packet *event_packet = NULL; -static -struct bt_notification_iterator_next_method_return src_iter_next_seq( - struct src_iter_user_data *user_data) -{ - struct bt_notification_iterator_next_method_return next_return = { - .status = BT_NOTIFICATION_ITERATOR_STATUS_OK, - }; - int64_t cur_ts_ns; - struct bt_ctf_packet *event_packet = NULL; - - assert(user_data->seq); - cur_ts_ns = user_data->seq[user_data->at]; - - switch (cur_ts_ns) { - case SEQ_END: - next_return.status = - BT_NOTIFICATION_ITERATOR_STATUS_END; - break; - case SEQ_INACTIVITY: - next_return.notification = - bt_notification_inactivity_create(src_empty_cc_prio_map); - assert(next_return.notification); - break; + switch (user_data->seq[user_data->at]) { case SEQ_STREAM1_BEGIN: - next_return.notification = - bt_notification_stream_begin_create(src_stream1); - assert(next_return.notification); + *notif = bt_notification_stream_begin_create(cur_notif_iter, + src_stream1); break; case SEQ_STREAM2_BEGIN: - next_return.notification = - bt_notification_stream_begin_create(src_stream2); - assert(next_return.notification); + *notif = bt_notification_stream_begin_create(cur_notif_iter, + src_stream2); break; case SEQ_STREAM1_END: - next_return.notification = - bt_notification_stream_end_create(src_stream1); - assert(next_return.notification); + *notif = bt_notification_stream_end_create(cur_notif_iter, + src_stream1); break; case SEQ_STREAM2_END: - next_return.notification = - bt_notification_stream_end_create(src_stream2); - assert(next_return.notification); + *notif = bt_notification_stream_end_create(cur_notif_iter, + src_stream2); break; case SEQ_STREAM1_PACKET1_BEGIN: - next_return.notification = - bt_notification_packet_begin_create(src_stream1_packet1); - assert(next_return.notification); + *notif = bt_notification_packet_begin_create(cur_notif_iter, + src_stream1_packet1); break; case SEQ_STREAM1_PACKET2_BEGIN: - next_return.notification = - bt_notification_packet_begin_create(src_stream1_packet2); - assert(next_return.notification); + *notif = bt_notification_packet_begin_create(cur_notif_iter, + src_stream1_packet2); break; case SEQ_STREAM2_PACKET1_BEGIN: - next_return.notification = - bt_notification_packet_begin_create(src_stream2_packet1); - assert(next_return.notification); + *notif = bt_notification_packet_begin_create(cur_notif_iter, + src_stream2_packet1); break; case SEQ_STREAM2_PACKET2_BEGIN: - next_return.notification = - bt_notification_packet_begin_create(src_stream2_packet2); - assert(next_return.notification); + *notif = bt_notification_packet_begin_create(cur_notif_iter, + src_stream2_packet2); break; case SEQ_STREAM1_PACKET1_END: - next_return.notification = - bt_notification_packet_end_create(src_stream1_packet1); - assert(next_return.notification); + *notif = bt_notification_packet_end_create(cur_notif_iter, + src_stream1_packet1); break; case SEQ_STREAM1_PACKET2_END: - next_return.notification = - bt_notification_packet_end_create(src_stream1_packet2); - assert(next_return.notification); + *notif = bt_notification_packet_end_create(cur_notif_iter, + src_stream1_packet2); break; case SEQ_STREAM2_PACKET1_END: - next_return.notification = - bt_notification_packet_end_create(src_stream2_packet1); - assert(next_return.notification); + *notif = bt_notification_packet_end_create(cur_notif_iter, + src_stream2_packet1); break; case SEQ_STREAM2_PACKET2_END: - next_return.notification = - bt_notification_packet_end_create(src_stream2_packet2); - assert(next_return.notification); + *notif = bt_notification_packet_end_create(cur_notif_iter, + src_stream2_packet2); break; case SEQ_EVENT_STREAM1_PACKET1: event_packet = src_stream1_packet1; @@ -664,36 +439,55 @@ struct bt_notification_iterator_next_method_return src_iter_next_seq( } if (event_packet) { - struct bt_ctf_event *event = src_create_event(event_packet); + *notif = bt_notification_event_create(cur_notif_iter, + src_event_class, event_packet); + } - assert(event); - next_return.notification = bt_notification_event_create(event, - src_empty_cc_prio_map); - bt_put(event); - assert(next_return.notification); + BT_ASSERT(*notif); + user_data->at++; +} + +static +enum bt_notification_iterator_status src_iter_next_seq( + struct src_iter_user_data *user_data, + bt_notification_array notifs, uint64_t capacity, + uint64_t *count) +{ + enum bt_notification_iterator_status status = + BT_NOTIFICATION_ITERATOR_STATUS_OK; + uint64_t i = 0; + + BT_ASSERT(user_data->seq); + + if (user_data->seq[user_data->at] == SEQ_END) { + status = BT_NOTIFICATION_ITERATOR_STATUS_END; + goto end; } - if (next_return.status != BT_NOTIFICATION_ITERATOR_STATUS_END) { - user_data->at++; + while (i < capacity && user_data->seq[user_data->at] != SEQ_END) { + src_iter_next_seq_one(user_data, ¬ifs[i]); + i++; } - return next_return; + BT_ASSERT(i > 0 && i <= capacity); + *count = i; + +end: + return status; } static -struct bt_notification_iterator_next_method_return src_iter_next( - struct bt_private_connection_private_notification_iterator *priv_iterator) +enum bt_notification_iterator_status src_iter_next( + struct bt_private_connection_private_notification_iterator *priv_iterator, + bt_notification_array notifs, uint64_t capacity, + uint64_t *count) { - struct bt_notification_iterator_next_method_return next_return = { - .status = BT_NOTIFICATION_ITERATOR_STATUS_OK, - .notification = NULL, - }; struct src_iter_user_data *user_data = bt_private_connection_private_notification_iterator_get_user_data(priv_iterator); - assert(user_data); - next_return = src_iter_next_seq(user_data); - return next_return; + BT_ASSERT(user_data); + cur_notif_iter = priv_iterator; + return src_iter_next_seq(user_data, notifs, capacity, count); } static @@ -705,7 +499,7 @@ enum bt_component_status src_init( ret = bt_private_component_source_add_output_private_port( private_component, "out", NULL, NULL); - assert(ret == 0); + BT_ASSERT(ret == 0); return BT_COMPONENT_STATUS_OK; } @@ -715,86 +509,45 @@ void src_finalize(struct bt_private_component *private_component) } static -enum bt_component_status sink_consume( - struct bt_private_component *priv_component) +void append_test_events_from_notification(struct bt_notification *notification) { - enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_notification *notification = NULL; - struct sink_user_data *user_data = - bt_private_component_get_user_data(priv_component); - enum bt_notification_iterator_status it_ret; struct test_event test_event = { 0 }; - bool do_append_test_event = true; - - assert(user_data && user_data->notif_iter); - it_ret = bt_notification_iterator_next(user_data->notif_iter); - - if (it_ret < 0) { - ret = BT_COMPONENT_STATUS_ERROR; - do_append_test_event = false; - goto end; - } - - switch (it_ret) { - case BT_NOTIFICATION_ITERATOR_STATUS_END: - test_event.type = TEST_EV_TYPE_END; - ret = BT_COMPONENT_STATUS_END; - BT_PUT(user_data->notif_iter); - goto end; - case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: - abort(); - default: - break; - } - - notification = bt_notification_iterator_get_notification( - user_data->notif_iter); - assert(notification); switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_EVENT: { - struct bt_ctf_event *event; + struct bt_event *event; test_event.type = TEST_EV_TYPE_NOTIF_EVENT; - event = bt_notification_event_get_event(notification); - assert(event); - test_event.packet = bt_ctf_event_get_packet(event); - bt_put(event); - assert(test_event.packet); - bt_put(test_event.packet); + event = bt_notification_event_borrow_event(notification); + BT_ASSERT(event); + test_event.packet = bt_event_borrow_packet(event); + BT_ASSERT(test_event.packet); break; } - case BT_NOTIFICATION_TYPE_INACTIVITY: - test_event.type = TEST_EV_TYPE_NOTIF_INACTIVITY; - break; case BT_NOTIFICATION_TYPE_STREAM_BEGIN: test_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; test_event.stream = - bt_notification_stream_begin_get_stream(notification); - assert(test_event.stream); - bt_put(test_event.stream); + bt_notification_stream_begin_borrow_stream(notification); + BT_ASSERT(test_event.stream); break; case BT_NOTIFICATION_TYPE_STREAM_END: test_event.type = TEST_EV_TYPE_NOTIF_STREAM_END; test_event.stream = - bt_notification_stream_end_get_stream(notification); - assert(test_event.stream); - bt_put(test_event.stream); + bt_notification_stream_end_borrow_stream(notification); + BT_ASSERT(test_event.stream); break; case BT_NOTIFICATION_TYPE_PACKET_BEGIN: test_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN; test_event.packet = - bt_notification_packet_begin_get_packet(notification); - assert(test_event.packet); - bt_put(test_event.packet); + bt_notification_packet_begin_borrow_packet(notification); + BT_ASSERT(test_event.packet); break; case BT_NOTIFICATION_TYPE_PACKET_END: test_event.type = TEST_EV_TYPE_NOTIF_PACKET_END; test_event.packet = - bt_notification_packet_end_get_packet(notification); - assert(test_event.packet); - bt_put(test_event.packet); + bt_notification_packet_end_borrow_packet(notification); + BT_ASSERT(test_event.packet); break; default: test_event.type = TEST_EV_TYPE_NOTIF_UNEXPECTED; @@ -802,22 +555,96 @@ enum bt_component_status sink_consume( } if (test_event.packet) { - test_event.stream = bt_ctf_packet_get_stream(test_event.packet); - assert(test_event.stream); - bt_put(test_event.stream); + test_event.stream = bt_packet_borrow_stream(test_event.packet); + BT_ASSERT(test_event.stream); } -end: - if (do_append_test_event) { + append_test_event(&test_event); +} + +static +enum bt_notification_iterator_status common_consume( + struct bt_notification_iterator *notif_iter, + bool is_output_port_notif_iter) +{ + enum bt_notification_iterator_status ret; + bt_notification_array notifications = NULL; + uint64_t count = 0; + struct test_event test_event = { 0 }; + uint64_t i; + + BT_ASSERT(notif_iter); + + if (is_output_port_notif_iter) { + ret = bt_output_port_notification_iterator_next(notif_iter, + ¬ifications, &count); + } else { + ret = bt_private_connection_notification_iterator_next( + notif_iter, ¬ifications, &count); + } + + if (ret < 0) { + goto end; + } + + switch (ret) { + case BT_NOTIFICATION_ITERATOR_STATUS_END: + test_event.type = TEST_EV_TYPE_END; append_test_event(&test_event); + goto end; + case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: + abort(); + default: + break; + } + + BT_ASSERT(notifications); + BT_ASSERT(count > 0); + + for (i = 0; i < count; i++) { + append_test_events_from_notification(notifications[i]); + bt_put(notifications[i]); + } + +end: + return ret; +} + +static +enum bt_component_status sink_consume( + struct bt_private_component *priv_component) +{ + enum bt_component_status ret = BT_COMPONENT_STATUS_OK; + struct sink_user_data *user_data = + bt_private_component_get_user_data(priv_component); + enum bt_notification_iterator_status it_ret; + + BT_ASSERT(user_data && user_data->notif_iter); + it_ret = common_consume(user_data->notif_iter, false); + + if (it_ret < 0) { + ret = BT_COMPONENT_STATUS_ERROR; + goto end; + } + + switch (it_ret) { + case BT_NOTIFICATION_ITERATOR_STATUS_END: + ret = BT_COMPONENT_STATUS_END; + BT_PUT(user_data->notif_iter); + goto end; + case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: + abort(); + default: + break; } - bt_put(notification); +end: return ret; } static -void sink_port_connected(struct bt_private_component *private_component, +enum bt_component_status sink_port_connected( + struct bt_private_component *private_component, struct bt_private_port *self_private_port, struct bt_port *other_port) { @@ -827,12 +654,13 @@ void sink_port_connected(struct bt_private_component *private_component, private_component); enum bt_connection_status conn_status; - assert(user_data); - assert(priv_conn); + BT_ASSERT(user_data); + BT_ASSERT(priv_conn); conn_status = bt_private_connection_create_notification_iterator( - priv_conn, NULL, &user_data->notif_iter); - assert(conn_status == 0); + priv_conn, &user_data->notif_iter); + BT_ASSERT(conn_status == 0); bt_put(priv_conn); + return BT_COMPONENT_STATUS_OK; } static @@ -843,13 +671,13 @@ enum bt_component_status sink_init( struct sink_user_data *user_data = g_new0(struct sink_user_data, 1); int ret; - assert(user_data); + BT_ASSERT(user_data); ret = bt_private_component_set_user_data(private_component, user_data); - assert(ret == 0); + BT_ASSERT(ret == 0); ret = bt_private_component_sink_add_input_private_port( private_component, "in", NULL, NULL); - assert(ret == 0); + BT_ASSERT(ret == 0); return BT_COMPONENT_STATUS_OK; } @@ -874,39 +702,46 @@ void create_source_sink(struct bt_graph *graph, struct bt_component **source, int ret; /* Create source component */ - src_comp_class = bt_component_class_source_create("src", src_iter_next); - assert(src_comp_class); - ret = bt_component_class_set_init_method(src_comp_class, src_init); - assert(ret == 0); - ret = bt_component_class_set_finalize_method(src_comp_class, - src_finalize); - assert(ret == 0); - ret = bt_component_class_source_set_notification_iterator_init_method( - src_comp_class, src_iter_init); - assert(ret == 0); - ret = bt_component_class_source_set_notification_iterator_finalize_method( - src_comp_class, src_iter_finalize); - assert(ret == 0); - ret = bt_graph_add_component(graph, src_comp_class, "source", NULL, - source); - assert(ret == 0); + if (source) { + src_comp_class = bt_component_class_source_create("src", + src_iter_next); + BT_ASSERT(src_comp_class); + ret = bt_component_class_set_init_method(src_comp_class, + src_init); + BT_ASSERT(ret == 0); + ret = bt_component_class_set_finalize_method(src_comp_class, + src_finalize); + BT_ASSERT(ret == 0); + ret = bt_component_class_source_set_notification_iterator_init_method( + src_comp_class, src_iter_init); + BT_ASSERT(ret == 0); + ret = bt_component_class_source_set_notification_iterator_finalize_method( + src_comp_class, src_iter_finalize); + BT_ASSERT(ret == 0); + ret = bt_graph_add_component(graph, src_comp_class, "source", + NULL, source); + BT_ASSERT(ret == 0); + bt_put(src_comp_class); + } /* Create sink component */ - sink_comp_class = bt_component_class_sink_create("sink", sink_consume); - assert(sink_comp_class); - ret = bt_component_class_set_init_method(sink_comp_class, sink_init); - assert(ret == 0); - ret = bt_component_class_set_finalize_method(sink_comp_class, - sink_finalize); - ret = bt_component_class_set_port_connected_method(sink_comp_class, - sink_port_connected); - assert(ret == 0); - ret = bt_graph_add_component(graph, sink_comp_class, "sink", NULL, - sink); - assert(ret == 0); - - bt_put(src_comp_class); - bt_put(sink_comp_class); + if (sink) { + sink_comp_class = bt_component_class_sink_create("sink", + sink_consume); + BT_ASSERT(sink_comp_class); + ret = bt_component_class_set_init_method(sink_comp_class, + sink_init); + BT_ASSERT(ret == 0); + ret = bt_component_class_set_finalize_method(sink_comp_class, + sink_finalize); + ret = bt_component_class_set_port_connected_method( + sink_comp_class, sink_port_connected); + BT_ASSERT(ret == 0); + ret = bt_graph_add_component(graph, sink_comp_class, "sink", + NULL, sink); + BT_ASSERT(ret == 0); + bt_put(sink_comp_class); + } } static @@ -917,21 +752,21 @@ void do_std_test(enum test test, const char *name, struct bt_component *sink_comp; struct bt_port *upstream_port; struct bt_port *downstream_port; - struct bt_graph *graph; enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK; clear_test_events(); current_test = test; diag("test: %s", name); + BT_ASSERT(!graph); graph = bt_graph_create(); - assert(graph); + BT_ASSERT(graph); create_source_sink(graph, &src_comp, &sink_comp); /* Connect source to sink */ upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out"); - assert(upstream_port); + BT_ASSERT(upstream_port); downstream_port = bt_component_sink_get_input_port_by_name(sink_comp, "in"); - assert(downstream_port); + BT_ASSERT(downstream_port); graph_status = bt_graph_connect_ports(graph, upstream_port, downstream_port, NULL); bt_put(upstream_port); @@ -953,7 +788,7 @@ void do_std_test(enum test test, const char *name, bt_put(src_comp); bt_put(sink_comp); - bt_put(graph); + BT_PUT(graph); } static @@ -985,324 +820,64 @@ void test_no_auto_notifs(void) } static -void test_auto_stream_begin_from_packet_begin(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_PACKET_BEGIN, - "automatic \"stream begin\" notif. caused by \"packet begin\" notif.", - expected_test_events); -} - -static -void test_auto_stream_begin_from_stream_end(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_STREAM_BEGIN_FROM_STREAM_END, - "automatic \"stream begin\" notif. caused by \"stream end\" notif.", - expected_test_events); -} - -static -void test_auto_stream_end_from_end(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_STREAM_END_FROM_END, - "automatic \"stream end\" notif. caused by BT_NOTIFICATION_ITERATOR_STATUS_END", - expected_test_events); -} - -static -void test_auto_packet_begin_from_packet_end(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_PACKET_END, - "automatic \"packet begin\" notif. caused by \"packet end\" notif.", - expected_test_events); -} - -static -void test_auto_packet_begin_from_event(void) +void test_output_port_notification_iterator(void) { const struct test_event expected_test_events[] = { { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_PACKET_BEGIN_FROM_EVENT, - "automatic \"packet begin\" notif. caused by event notif.", - expected_test_events); -} - -static -void test_auto_packet_end_from_packet_begin(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_PACKET_END_FROM_PACKET_BEGIN, - "automatic \"packet end\" notif. caused by \"packet begin\" notif.", - expected_test_events); -} - -static -void test_auto_packet_end_packet_begin_from_event(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, }, { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, }, { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, { .type = TEST_EV_TYPE_END, }, { .type = TEST_EV_TYPE_SENTINEL, }, }; + struct bt_component *src_comp; + struct bt_notification_iterator *notif_iter; + enum bt_notification_iterator_status iter_status = + BT_NOTIFICATION_ITERATOR_STATUS_OK; + struct bt_port *upstream_port; - do_std_test(TEST_AUTO_PACKET_END_PACKET_BEGIN_FROM_EVENT, - "automatic \"packet end\" and \"packet begin\" notifs. caused by event notif.", - expected_test_events); -} - -static -void test_auto_packet_end_from_stream_end(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_PACKET_END_FROM_STREAM_END, - "automatic \"packet end\" notif. caused by \"stream end\" notif.", - expected_test_events); -} - -static -void test_auto_packet_end_stream_end_from_end(void) -{ - const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_END, }, - { .type = TEST_EV_TYPE_SENTINEL, }, - }; - - do_std_test(TEST_AUTO_PACKET_END_STREAM_END_FROM_END, - "automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END", - expected_test_events); -} + clear_test_events(); + current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR; + diag("test: output port notification iterator"); + BT_ASSERT(!graph); + graph = bt_graph_create(); + BT_ASSERT(graph); + create_source_sink(graph, &src_comp, NULL); -static -void test_multiple_auto_stream_end_from_end(void) -{ - bool expected = true; - struct test_event expected_event; - struct test_event expected_event2; - struct test_event *event; - struct test_event *event2; - - do_std_test(TEST_MULTIPLE_AUTO_STREAM_END_FROM_END, - "multiple automatic \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END", + /* Create notification iterator on source's output port */ + upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out"); + notif_iter = bt_output_port_notification_iterator_create(upstream_port, NULL); + ok(notif_iter, "bt_output_port_notification_iterator_create() succeeds"); + bt_put(upstream_port); - if (test_events->len != 5) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; - expected_event.stream = src_stream1; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 0); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; - expected_event.stream = src_stream2; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 1); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_END; - expected_event.stream = src_stream1; - expected_event.packet = NULL; - expected_event2.type = TEST_EV_TYPE_NOTIF_STREAM_END; - expected_event2.stream = src_stream2; - expected_event2.packet = NULL; - event = &g_array_index(test_events, struct test_event, 2); - event2 = &g_array_index(test_events, struct test_event, 3); - if (!(compare_single_test_events(event, &expected_event) && - compare_single_test_events(event2, &expected_event2)) && - !(compare_single_test_events(event2, &expected_event) && - compare_single_test_events(event, &expected_event2))) { - expected = false; - goto end; + /* Consume the notification iterator */ + while (iter_status == BT_NOTIFICATION_ITERATOR_STATUS_OK) { + iter_status = common_consume(notif_iter, true); } - expected_event.type = TEST_EV_TYPE_END; - expected_event.stream = NULL; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 4); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } + ok(iter_status == BT_NOTIFICATION_ITERATOR_STATUS_END, + "output port notification iterator finishes without any error"); -end: - ok(expected, + /* Compare the resulting test events */ + ok(compare_test_events(expected_test_events), "the produced sequence of test events is the expected one"); -} - -static -void test_multiple_auto_packet_end_stream_end_from_end(void) -{ - bool expected = true; - struct test_event expected_event; - struct test_event expected_event2; - struct test_event *event; - struct test_event *event2; - - do_std_test(TEST_MULTIPLE_AUTO_PACKET_END_STREAM_END_FROM_END, - "multiple automatic \"packet end\" and \"stream end\" notifs. caused by BT_NOTIFICATION_ITERATOR_STATUS_END", - NULL); - if (test_events->len != 9) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; - expected_event.stream = src_stream1; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 0); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN; - expected_event.stream = src_stream2; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 1); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN; - expected_event.stream = src_stream1; - expected_event.packet = src_stream1_packet1; - event = &g_array_index(test_events, struct test_event, 2); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN; - expected_event.stream = src_stream2; - expected_event.packet = src_stream2_packet1; - event = &g_array_index(test_events, struct test_event, 3); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_PACKET_END; - expected_event.stream = src_stream1; - expected_event.packet = src_stream1_packet1; - expected_event2.type = TEST_EV_TYPE_NOTIF_PACKET_END; - expected_event2.stream = src_stream2; - expected_event2.packet = src_stream2_packet1; - event = &g_array_index(test_events, struct test_event, 4); - event2 = &g_array_index(test_events, struct test_event, 6); - if (!(compare_single_test_events(event, &expected_event) && - compare_single_test_events(event2, &expected_event2)) && - !(compare_single_test_events(event2, &expected_event) && - compare_single_test_events(event, &expected_event2))) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_NOTIF_STREAM_END; - expected_event.stream = src_stream1; - expected_event.packet = NULL; - expected_event2.type = TEST_EV_TYPE_NOTIF_STREAM_END; - expected_event2.stream = src_stream2; - expected_event2.packet = NULL; - event = &g_array_index(test_events, struct test_event, 5); - event2 = &g_array_index(test_events, struct test_event, 7); - if (!(compare_single_test_events(event, &expected_event) && - compare_single_test_events(event2, &expected_event2)) && - !(compare_single_test_events(event2, &expected_event) && - compare_single_test_events(event, &expected_event2))) { - expected = false; - goto end; - } - - expected_event.type = TEST_EV_TYPE_END; - expected_event.stream = NULL; - expected_event.packet = NULL; - event = &g_array_index(test_events, struct test_event, 8); - if (!compare_single_test_events(event, &expected_event)) { - expected = false; - goto end; - } - -end: - ok(expected, - "the produced sequence of test events is the expected one"); + bt_put(src_comp); + BT_PUT(graph); + bt_put(notif_iter); } #define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG" @@ -1316,17 +891,7 @@ int main(int argc, char **argv) plan_tests(NR_TESTS); init_static_data(); test_no_auto_notifs(); - test_auto_stream_begin_from_packet_begin(); - test_auto_stream_begin_from_stream_end(); - test_auto_stream_end_from_end(); - test_auto_packet_begin_from_packet_end(); - test_auto_packet_begin_from_event(); - test_auto_packet_end_from_packet_begin(); - test_auto_packet_end_packet_begin_from_event(); - test_auto_packet_end_from_stream_end(); - test_auto_packet_end_stream_end_from_end(); - test_multiple_auto_stream_end_from_end(); - test_multiple_auto_packet_end_stream_end_from_end(); + test_output_port_notification_iterator(); fini_static_data(); return exit_status(); }