lib: add internal object pool API and use it; adapt plugins/tests
[babeltrace.git] / tests / lib / test_bt_notification_iterator.c
index 90f4dff35f5bc3aefc2e765629e2c16ca9ff4558..8f889fcda1dad29677dc0a66517b1e1df61d0752 100644 (file)
 
 #include "tap/tap.h"
 
-#define NR_TESTS       31
+#define NR_TESTS       6
 
 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,
 };
 
@@ -162,111 +151,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)
 {
@@ -407,26 +291,26 @@ void init_static_data(void)
        assert(empty_struct_ft);
        trace = bt_trace_create();
        assert(trace);
-       ret = bt_trace_set_packet_header_type(trace, empty_struct_ft);
+       ret = bt_trace_set_packet_header_field_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_stream_class_create("my-stream-class");
        assert(src_stream_class);
-       ret = bt_stream_class_set_packet_context_type(src_stream_class,
+       ret = bt_stream_class_set_packet_context_field_type(src_stream_class,
                empty_struct_ft);
        assert(ret == 0);
-       ret = bt_stream_class_set_event_header_type(src_stream_class,
+       ret = bt_stream_class_set_event_header_field_type(src_stream_class,
                empty_struct_ft);
        assert(ret == 0);
-       ret = bt_stream_class_set_event_context_type(src_stream_class,
+       ret = bt_stream_class_set_event_context_field_type(src_stream_class,
                empty_struct_ft);
        assert(ret == 0);
        src_event_class = bt_event_class_create("my-event-class");
-       ret = bt_event_class_set_context_type(src_event_class,
+       ret = bt_event_class_set_context_field_type(src_event_class,
                empty_struct_ft);
        assert(ret == 0);
-       ret = bt_event_class_set_context_type(src_event_class,
+       ret = bt_event_class_set_payload_field_type(src_event_class,
                empty_struct_ft);
        assert(ret == 0);
        ret = bt_stream_class_add_event_class(src_stream_class,
@@ -434,9 +318,9 @@ void init_static_data(void)
        assert(ret == 0);
        ret = bt_trace_add_stream_class(trace, src_stream_class);
        assert(ret == 0);
-       src_stream1 = bt_stream_create(src_stream_class, "stream-1");
+       src_stream1 = bt_stream_create(src_stream_class, "stream-1", 0);
        assert(src_stream1);
-       src_stream2 = bt_stream_create(src_stream_class, "stream-2");
+       src_stream2 = bt_stream_create(src_stream_class, "stream-2", 1);
        assert(src_stream2);
        src_stream1_packet1 = bt_packet_create(src_stream1);
        assert(src_stream1_packet1);
@@ -510,39 +394,6 @@ enum bt_notification_iterator_status src_iter_init(
        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();
        }
@@ -550,18 +401,6 @@ enum bt_notification_iterator_status src_iter_init(
        return BT_NOTIFICATION_ITERATOR_STATUS_OK;
 }
 
-static
-struct bt_event *src_create_event(struct bt_packet *packet)
-{
-       struct bt_event *event = bt_event_create(src_event_class);
-       int ret;
-
-       assert(event);
-       ret = bt_event_set_packet(event, packet);
-       assert(ret == 0);
-       return event;
-}
-
 static
 struct bt_notification_iterator_next_method_return src_iter_next_seq(
                struct src_iter_user_data *user_data)
@@ -662,12 +501,10 @@ struct bt_notification_iterator_next_method_return src_iter_next_seq(
        }
 
        if (event_packet) {
-               struct bt_event *event = src_create_event(event_packet);
-
-               assert(event);
-               next_return.notification = bt_notification_event_create(event,
+               next_return.notification =
+                       bt_notification_event_create(src_event_class,
+                       event_packet,
                        src_empty_cc_prio_map);
-               bt_put(event);
                assert(next_return.notification);
        }
 
@@ -748,12 +585,10 @@ enum bt_notification_iterator_status common_consume(
                struct bt_event *event;
 
                test_event.type = TEST_EV_TYPE_NOTIF_EVENT;
-               event = bt_notification_event_get_event(notification);
+               event = bt_notification_event_borrow_event(notification);
                assert(event);
-               test_event.packet = bt_event_get_packet(event);
-               bt_put(event);
+               test_event.packet = bt_event_borrow_packet(event);
                assert(test_event.packet);
-               bt_put(test_event.packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_INACTIVITY:
@@ -762,30 +597,26 @@ enum bt_notification_iterator_status common_consume(
        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);
+                       bt_notification_stream_begin_borrow_stream(notification);
                assert(test_event.stream);
-               bt_put(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);
+                       bt_notification_stream_end_borrow_stream(notification);
                assert(test_event.stream);
-               bt_put(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);
+                       bt_notification_packet_begin_borrow_packet(notification);
                assert(test_event.packet);
-               bt_put(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);
+                       bt_notification_packet_end_borrow_packet(notification);
                assert(test_event.packet);
-               bt_put(test_event.packet);
                break;
        default:
                test_event.type = TEST_EV_TYPE_NOTIF_UNEXPECTED;
@@ -793,9 +624,8 @@ enum bt_notification_iterator_status common_consume(
        }
 
        if (test_event.packet) {
-               test_event.stream = bt_packet_get_stream(test_event.packet);
+               test_event.stream = bt_packet_borrow_stream(test_event.packet);
                assert(test_event.stream);
-               bt_put(test_event.stream);
        }
 
 end:
@@ -853,7 +683,7 @@ void sink_port_connected(struct bt_private_component *private_component,
        assert(user_data);
        assert(priv_conn);
        conn_status = bt_private_connection_create_notification_iterator(
-               priv_conn, NULL, &user_data->notif_iter);
+               priv_conn, &user_data->notif_iter);
        assert(conn_status == 0);
        bt_put(priv_conn);
 }
@@ -1014,327 +844,6 @@ void test_no_auto_notifs(void)
                expected_test_events);
 }
 
-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)
-{
-       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_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_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_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_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);
-}
-
-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",
-               NULL);
-
-       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;
-       }
-
-       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;
-       }
-
-end:
-       ok(expected,
-               "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");
-}
-
 static
 void test_output_port_notification_iterator(void)
 {
@@ -1375,62 +884,7 @@ void test_output_port_notification_iterator(void)
        /* 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, NULL);
-       ok(notif_iter, "bt_output_port_notification_iterator_create() succeeds");
-       bt_put(upstream_port);
-
-       /* Consume the notification iterator */
-       while (iter_status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-               iter_status = common_consume(notif_iter);
-       }
-
-       ok(iter_status == BT_NOTIFICATION_ITERATOR_STATUS_END,
-               "output port notification iterator finishes without any error");
-
-       /* Compare the resulting test events */
-       ok(compare_test_events(expected_test_events),
-               "the produced sequence of test events is the expected one");
-
-       bt_put(src_comp);
-       bt_put(graph);
-       bt_put(notif_iter);
-}
-
-static
-void test_output_port_notification_iterator_subscribe_events(void)
-{
-       const struct test_event expected_test_events[] = {
-               { .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_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .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_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_END, },
-               { .type = TEST_EV_TYPE_SENTINEL, },
-       };
-       const enum bt_notification_type notification_types[] = {
-               BT_NOTIFICATION_TYPE_EVENT,
-               BT_NOTIFICATION_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;
-       struct bt_graph *graph;
-
-       clear_test_events();
-       current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR;
-       diag("test: output port notification iterator with event subscription");
-       graph = bt_graph_create();
-       assert(graph);
-       create_source_sink(graph, &src_comp, NULL);
-
-       /* 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, notification_types);
+               NULL);
        ok(notif_iter, "bt_output_port_notification_iterator_create() succeeds");
        bt_put(upstream_port);
 
@@ -1469,7 +923,7 @@ void test_output_port_notification_iterator_cannot_consume(void)
        /* 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, NULL);
+               NULL);
        assert(notif_iter);
        bt_put(upstream_port);
 
@@ -1496,19 +950,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();
-       test_output_port_notification_iterator_subscribe_events();
        test_output_port_notification_iterator_cannot_consume();
        fini_static_data();
        return exit_status();
This page took 0.03131 seconds and 4 git commands to generate.