Do not use `bool` type; use new `bt_bool` instead
[babeltrace.git] / tests / plugins / test-utils-muxer.c
index 50f5be5de37bfcf46991a3dd3d33b01039831ece..f5eac77c29b831e04ae84d7967c8ef56c5b1815b 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <stdbool.h>
 #include <inttypes.h>
 #include <string.h>
 #include <assert.h>
@@ -45,6 +46,7 @@
 #include <babeltrace/graph/notification-packet.h>
 #include <babeltrace/graph/port.h>
 #include <babeltrace/graph/private-component-source.h>
+#include <babeltrace/graph/private-component-sink.h>
 #include <babeltrace/graph/private-component.h>
 #include <babeltrace/graph/private-connection.h>
 #include <babeltrace/graph/private-notification-iterator.h>
@@ -151,21 +153,20 @@ static int64_t seq4[] = {
 };
 
 static int64_t seq1_with_again[] = {
-       24, 53, 97, 105, 119, 210, SEQ_AGAIN, SEQ_AGAIN, 222, 240, 292,
-       317, 353, 407, 433, 473, 487, 504, 572, 615, 708, 766, 850, 852,
-       931, 951, 956, 996, SEQ_END,
+       24, 53, 97, 105, 119, 210, SEQ_AGAIN, 222, 240, 292, 317, 353,
+       407, 433, 473, 487, 504, 572, 615, 708, 766, 850, 852, 931, 951,
+       956, 996, SEQ_END,
 };
 
 static int64_t seq2_with_again[] = {
        51, 59, 68, 77, 91, 121, 139, 170, 179, 266, 352, 454, 478, 631,
-       644, 668, 714, 744, 750, 778, 790, 836, SEQ_AGAIN, SEQ_AGAIN,
-       SEQ_END,
+       644, 668, 714, 744, 750, 778, 790, 836, SEQ_AGAIN, SEQ_END,
 };
 
 static int64_t seq3_with_again[] = {
        8, 71, 209, 254, 298, 320, 350, 393, 419, 624, 651, SEQ_AGAIN,
-       SEQ_AGAIN, 678, 717, 731, 733, 788, 819, 820, 857, 892, 903,
-       944, 998, SEQ_END,
+       678, 717, 731, 733, 788, 819, 820, 857, 892, 903, 944, 998,
+       SEQ_END,
 };
 
 static int64_t seq4_with_again[] = {
@@ -302,6 +303,10 @@ bool compare_test_events(const struct test_event *expected_events)
        }
 
        if (i != test_events->len) {
+               if (debug) {
+                       fprintf(stderr, ":: Length mismatch\n");
+               }
+
                return false;
        }
 
@@ -682,17 +687,8 @@ enum bt_component_status src_init(
                struct bt_value *params, void *init_method_data)
 {
        struct bt_private_port *priv_port;
-       int ret;
        size_t nb_ports;
 
-       priv_port = bt_private_component_source_get_default_output_private_port(
-               private_component);
-       if (priv_port) {
-               ret = bt_private_port_remove_from_component(priv_port);
-               assert(ret == 0);
-               bt_put(priv_port);
-       }
-
        switch (current_test) {
        case TEST_NO_TS:
                nb_ports = 2;
@@ -889,7 +885,8 @@ void sink_port_connected(struct bt_private_component *private_component,
        assert(user_data);
        assert(priv_conn);
        user_data->notif_iter =
-               bt_private_connection_create_notification_iterator(priv_conn);
+               bt_private_connection_create_notification_iterator(priv_conn,
+                       NULL);
        assert(user_data->notif_iter);
        bt_put(priv_conn);
 }
@@ -901,11 +898,16 @@ enum bt_component_status sink_init(
 {
        struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
        int ret;
+       void *priv_port;
 
        assert(user_data);
        ret = bt_private_component_set_user_data(private_component,
                user_data);
        assert(ret == 0);
+       priv_port = bt_private_component_sink_add_input_private_port(
+               private_component, "in", NULL);
+       assert(priv_port);
+       bt_put(priv_port);
        return BT_COMPONENT_STATUS_OK;
 }
 
@@ -1020,7 +1022,7 @@ void do_std_test(enum test test, const char *name,
        upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
-       downstream_port = bt_component_sink_get_default_input_port(sink_comp);
+       downstream_port = bt_component_sink_get_input_port_by_name(sink_comp, "in");
        assert(downstream_port);
        conn = bt_graph_connect_ports(graph, upstream_port, downstream_port);
        assert(conn);
@@ -1496,7 +1498,7 @@ void test_single_end_then_multiple_full(void)
        upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
-       downstream_port = bt_component_sink_get_default_input_port(sink_comp);
+       downstream_port = bt_component_sink_get_input_port_by_name(sink_comp, "in");
        assert(downstream_port);
        conn = bt_graph_connect_ports(graph, upstream_port, downstream_port);
        assert(conn);
@@ -1625,7 +1627,7 @@ void test_single_again_end_then_multiple_full(void)
        upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
-       downstream_port = bt_component_sink_get_default_input_port(sink_comp);
+       downstream_port = bt_component_sink_get_input_port_by_name(sink_comp, "in");
        assert(downstream_port);
        conn = bt_graph_connect_ports(graph, upstream_port, downstream_port);
        assert(conn);
This page took 0.025756 seconds and 4 git commands to generate.