X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=tests%2Flib%2Ftest_graph_topo.c;h=7c63ec2cf0c7202f6ad1bfb6cc8c0783d77cf4c0;hb=4cdfc5e86b64137d96c31495cbdea99801714c2b;hp=720dfb06e920218f56797acdefa099b32b0b6ce6;hpb=0d72b8c329ad51d14ab4e83330b38c2c8da69dd4;p=babeltrace.git diff --git a/tests/lib/test_graph_topo.c b/tests/lib/test_graph_topo.c index 720dfb06..7c63ec2c 100644 --- a/tests/lib/test_graph_topo.c +++ b/tests/lib/test_graph_topo.c @@ -58,78 +58,78 @@ struct event { union { struct { - const struct bt_component *comp; - const struct bt_port *self_port; - const struct bt_port *other_port; + const bt_component *comp; + const bt_port *self_port; + const bt_port *other_port; } src_comp_accept_output_port_connection; struct { - const struct bt_component *comp; - const struct bt_port *self_port; - const struct bt_port *other_port; + const bt_component *comp; + const bt_port *self_port; + const bt_port *other_port; } sink_comp_accept_input_port_connection; struct { - const struct bt_component *comp; - const struct bt_port *self_port; - const struct bt_port *other_port; + const bt_component *comp; + const bt_port *self_port; + const bt_port *other_port; } src_comp_output_port_connected; struct { - const struct bt_component *comp; - const struct bt_port *self_port; - const struct bt_port *other_port; + const bt_component *comp; + const bt_port *self_port; + const bt_port *other_port; } sink_comp_input_port_connected; struct { - const struct bt_component *comp; - const struct bt_port *self_port; + const bt_component *comp; + const bt_port *self_port; } src_comp_output_port_disconnected; struct { - const struct bt_component *comp; - const struct bt_port *self_port; + const bt_component *comp; + const bt_port *self_port; } sink_comp_input_port_disconnected; struct { - const struct bt_component *comp; - const struct bt_port *port; + const bt_component *comp; + const bt_port *port; } graph_src_output_port_added; struct { - const struct bt_component *comp; - const struct bt_port *port; + const bt_component *comp; + const bt_port *port; } graph_sink_input_port_added; struct { - const struct bt_component *comp; - const struct bt_port *port; + const bt_component *comp; + const bt_port *port; } graph_src_output_port_removed; struct { - const struct bt_component *comp; - const struct bt_port *port; + const bt_component *comp; + const bt_port *port; } graph_sink_input_port_removed; struct { - const struct bt_component *upstream_comp; - const struct bt_component *downstream_comp; - const struct bt_port *upstream_port; - const struct bt_port *downstream_port; + const bt_component *upstream_comp; + const bt_component *downstream_comp; + const bt_port *upstream_port; + const bt_port *downstream_port; } graph_src_sink_ports_connected; struct { - const struct bt_component *upstream_comp; - const struct bt_component *downstream_comp; - const struct bt_port *upstream_port; - const struct bt_port *downstream_port; + const bt_component *upstream_comp; + const bt_component *downstream_comp; + const bt_port *upstream_port; + const bt_port *downstream_port; } graph_src_sink_ports_disconnected; } data; }; static GArray *events; -static struct bt_component_class_source *src_comp_class; -static struct bt_component_class_sink *sink_comp_class; +static bt_component_class_source *src_comp_class; +static bt_component_class_sink *sink_comp_class; static enum test current_test; static @@ -364,19 +364,19 @@ size_t event_pos(struct event *event) } static -enum bt_self_notification_iterator_status src_iter_next( - struct bt_self_notification_iterator *self_iterator, - bt_notification_array_const notifs, uint64_t capacity, +bt_self_message_iterator_status src_iter_next( + bt_self_message_iterator *self_iterator, + bt_message_array_const msgs, uint64_t capacity, uint64_t *count) { - return BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR; + return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR; } static -enum bt_self_component_status src_accept_output_port_connection( - struct bt_self_component_source *self_comp, - struct bt_self_component_port_output *self_comp_port, - const struct bt_port_input *other_port) +bt_self_component_status src_accept_output_port_connection( + bt_self_component_source *self_comp, + bt_self_component_port_output *self_comp_port, + const bt_port_input *other_port) { struct event event = { .type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION, @@ -396,10 +396,10 @@ enum bt_self_component_status src_accept_output_port_connection( } static -enum bt_self_component_status sink_accept_input_port_connection( - struct bt_self_component_sink *self_comp, - struct bt_self_component_port_input *self_comp_port, - const struct bt_port_output *other_port) +bt_self_component_status sink_accept_input_port_connection( + bt_self_component_sink *self_comp, + bt_self_component_port_input *self_comp_port, + const bt_port_output *other_port) { struct event event = { .type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION, @@ -419,10 +419,10 @@ enum bt_self_component_status sink_accept_input_port_connection( } static -enum bt_self_component_status src_output_port_connected( - struct bt_self_component_source *self_comp, - struct bt_self_component_port_output *self_comp_port, - const struct bt_port_input *other_port) +bt_self_component_status src_output_port_connected( + bt_self_component_source *self_comp, + bt_self_component_port_output *self_comp_port, + const bt_port_input *other_port) { int ret; struct event event = { @@ -456,10 +456,10 @@ enum bt_self_component_status src_output_port_connected( } static -enum bt_self_component_status sink_input_port_connected( - struct bt_self_component_sink *self_comp, - struct bt_self_component_port_input *self_comp_port, - const struct bt_port_output *other_port) +bt_self_component_status sink_input_port_connected( + bt_self_component_sink *self_comp, + bt_self_component_port_input *self_comp_port, + const bt_port_output *other_port) { struct event event = { .type = SINK_COMP_INPUT_PORT_CONNECTED, @@ -484,8 +484,8 @@ enum bt_self_component_status sink_input_port_connected( } static -void src_output_port_disconnected(struct bt_self_component_source *self_comp, - struct bt_self_component_port_output *self_comp_port) +void src_output_port_disconnected(bt_self_component_source *self_comp, + bt_self_component_port_output *self_comp_port) { int ret; struct event event = { @@ -514,8 +514,8 @@ void src_output_port_disconnected(struct bt_self_component_source *self_comp, } static -void sink_input_port_disconnected(struct bt_self_component_sink *self_comp, - struct bt_self_component_port_input *self_comp_port) +void sink_input_port_disconnected(bt_self_component_sink *self_comp, + bt_self_component_port_input *self_comp_port) { struct event event = { .type = SINK_COMP_INPUT_PORT_DISCONNECTED, @@ -533,9 +533,9 @@ void sink_input_port_disconnected(struct bt_self_component_sink *self_comp, } static -enum bt_self_component_status src_init( - struct bt_self_component_source *self_comp, - const struct bt_value *params, void *init_method_data) +bt_self_component_status src_init( + bt_self_component_source *self_comp, + const bt_value *params, void *init_method_data) { int ret; @@ -546,9 +546,9 @@ enum bt_self_component_status src_init( } static -enum bt_self_component_status sink_init( - struct bt_self_component_sink *self_comp, - const struct bt_value *params, void *init_method_data) +bt_self_component_status sink_init( + bt_self_component_sink *self_comp, + const bt_value *params, void *init_method_data) { int ret; @@ -559,10 +559,10 @@ enum bt_self_component_status sink_init( } static -enum bt_self_component_status sink_consume( - struct bt_self_component_sink *self_comp) +bt_self_component_status sink_consume( + bt_self_component_sink *self_comp) { - struct bt_self_component_port_input *def_port; + bt_self_component_port_input *def_port; int ret; switch (current_test) { @@ -584,8 +584,8 @@ enum bt_self_component_status sink_consume( } static -void graph_src_output_port_added(const struct bt_component_source *comp, - const struct bt_port_output *port, void *data) +void graph_src_output_port_added(const bt_component_source *comp, + const bt_port_output *port, void *data) { struct event event = { .type = GRAPH_SRC_OUTPUT_PORT_ADDED, @@ -599,8 +599,8 @@ void graph_src_output_port_added(const struct bt_component_source *comp, } static -void graph_sink_input_port_added(const struct bt_component_sink *comp, - const struct bt_port_input *port, void *data) +void graph_sink_input_port_added(const bt_component_sink *comp, + const bt_port_input *port, void *data) { struct event event = { .type = GRAPH_SINK_INPUT_PORT_ADDED, @@ -614,8 +614,8 @@ void graph_sink_input_port_added(const struct bt_component_sink *comp, } static -void graph_src_output_port_removed(const struct bt_component_source *comp, - const struct bt_port_output *port, void *data) +void graph_src_output_port_removed(const bt_component_source *comp, + const bt_port_output *port, void *data) { struct event event = { .type = GRAPH_SRC_OUTPUT_PORT_REMOVED, @@ -629,8 +629,8 @@ void graph_src_output_port_removed(const struct bt_component_source *comp, } static -void graph_sink_input_port_removed(const struct bt_component_sink *comp, - const struct bt_port_input *port, void *data) +void graph_sink_input_port_removed(const bt_component_sink *comp, + const bt_port_input *port, void *data) { struct event event = { .type = GRAPH_SINK_INPUT_PORT_REMOVED, @@ -644,10 +644,10 @@ void graph_sink_input_port_removed(const struct bt_component_sink *comp, } static -void graph_src_sink_ports_connected(const struct bt_component_source *upstream_comp, - const struct bt_component_sink *downstream_comp, - const struct bt_port_output *upstream_port, - const struct bt_port_input *downstream_port, void *data) +void graph_src_sink_ports_connected(const bt_component_source *upstream_comp, + const bt_component_sink *downstream_comp, + const bt_port_output *upstream_port, + const bt_port_input *downstream_port, void *data) { struct event event = { .type = GRAPH_SRC_SINK_PORTS_CONNECTED, @@ -667,10 +667,10 @@ void graph_src_sink_ports_connected(const struct bt_component_source *upstream_c } static -void graph_src_sink_ports_disconnected(const struct bt_component_source *upstream_comp, - const struct bt_component_sink *downstream_comp, - const struct bt_port_output *upstream_port, - const struct bt_port_input *downstream_port, void *data) +void graph_src_sink_ports_disconnected(const bt_component_source *upstream_comp, + const bt_component_sink *downstream_comp, + const bt_port_output *upstream_port, + const bt_port_input *downstream_port, void *data) { struct event event = { .type = GRAPH_SRC_SINK_PORTS_DISCONNECTED, @@ -731,15 +731,15 @@ void init_test(void) static void fini_test(void) { - bt_object_put_ref(src_comp_class); - bt_object_put_ref(sink_comp_class); + bt_component_class_source_put_ref(src_comp_class); + bt_component_class_sink_put_ref(sink_comp_class); g_array_free(events, TRUE); } static -const struct bt_component_source *create_src(struct bt_graph *graph) +const bt_component_source *create_src(bt_graph *graph) { - const struct bt_component_source *comp; + const bt_component_source *comp; int ret; ret = bt_graph_add_source_component(graph, src_comp_class, @@ -749,9 +749,9 @@ const struct bt_component_source *create_src(struct bt_graph *graph) } static -const struct bt_component_sink *create_sink(struct bt_graph *graph) +const bt_component_sink *create_sink(bt_graph *graph) { - const struct bt_component_sink *comp; + const bt_component_sink *comp; int ret; ret = bt_graph_add_sink_component(graph, sink_comp_class, @@ -761,9 +761,9 @@ const struct bt_component_sink *create_sink(struct bt_graph *graph) } static -struct bt_graph *create_graph(void) +bt_graph *create_graph(void) { - struct bt_graph *graph = bt_graph_create(); + bt_graph *graph = bt_graph_create(); int ret; BT_ASSERT(graph); @@ -800,17 +800,17 @@ static void test_sink_removes_port_in_consume_then_src_removes_disconnected_port(void) { int ret; - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsink_def_port; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsink_def_port; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; @@ -973,26 +973,26 @@ void test_sink_removes_port_in_consume_then_src_removes_disconnected_port(void) ok(graph_port_removed_src_pos < graph_port_removed_sink_pos, "event order is good (13)"); - bt_object_put_ref(graph); - bt_object_put_ref(sink); - bt_object_put_ref(src); + bt_graph_put_ref(graph); + bt_component_sink_put_ref(sink); + bt_component_source_put_ref(src); } static void test_sink_removes_port_in_consume(void) { int ret; - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsink_def_port; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsink_def_port; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; @@ -1139,27 +1139,27 @@ void test_sink_removes_port_in_consume(void) ok(graph_ports_disconnected_pos < graph_port_removed_sink_pos, "event order is good (11)"); - bt_object_put_ref(sink); - bt_object_put_ref(src); - bt_object_put_ref(graph); + bt_component_sink_put_ref(sink); + bt_component_source_put_ref(src); + bt_graph_put_ref(graph); } static void test_src_adds_port_in_port_connected(void) { - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_output *src_hello_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsrc_hello_port; - const struct bt_port *gsink_def_port; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_output *src_hello_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsrc_hello_port; + const bt_port *gsink_def_port; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; @@ -1268,25 +1268,25 @@ void test_src_adds_port_in_port_connected(void) ok(graph_port_added_src_pos < graph_ports_connected_pos, "event order is good (6)"); - bt_object_put_ref(src); - bt_object_put_ref(sink); - bt_object_put_ref(graph); + bt_component_source_put_ref(src); + bt_component_sink_put_ref(sink); + bt_graph_put_ref(graph); } static void test_simple(void) { - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsink_def_port; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsink_def_port; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; @@ -1378,26 +1378,26 @@ void test_simple(void) ok(sink_accept_port_connection_pos < sink_port_connected_pos, "event order is good (4)"); - bt_object_put_ref(sink); - bt_object_put_ref(graph); - bt_object_put_ref(src); + bt_component_sink_put_ref(sink); + bt_graph_put_ref(graph); + bt_component_source_put_ref(src); } static void test_src_port_connected_error(void) { - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsink_def_port; - const struct bt_connection *conn = NULL; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsink_def_port; + const bt_connection *conn = NULL; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t src_port_connected_pos; @@ -1464,27 +1464,27 @@ void test_src_port_connected_error(void) ok(src_accept_port_connection_pos < src_port_connected_pos, "event order is good (1)"); - bt_object_put_ref(graph); - bt_object_put_ref(sink); - bt_object_put_ref(src); - bt_object_put_ref(conn); + bt_graph_put_ref(graph); + bt_component_sink_put_ref(sink); + bt_component_source_put_ref(src); + bt_connection_put_ref(conn); } static void test_sink_port_connected_error(void) { - const struct bt_component_source *src; - const struct bt_component_sink *sink; - const struct bt_component *gsrc; - const struct bt_component *gsink; - struct bt_graph *graph; - const struct bt_port_output *src_def_port; - const struct bt_port_input *sink_def_port; - const struct bt_port *gsrc_def_port; - const struct bt_port *gsink_def_port; - const struct bt_connection *conn = NULL; + const bt_component_source *src; + const bt_component_sink *sink; + const bt_component *gsrc; + const bt_component *gsink; + bt_graph *graph; + const bt_port_output *src_def_port; + const bt_port_input *sink_def_port; + const bt_port *gsrc_def_port; + const bt_port *gsink_def_port; + const bt_connection *conn = NULL; struct event event; - enum bt_graph_status status; + bt_graph_status status; size_t src_accept_port_connection_pos; size_t sink_accept_port_connection_pos; size_t src_port_connected_pos; @@ -1574,21 +1574,21 @@ void test_sink_port_connected_error(void) ok(sink_port_connected_pos < src_port_disconnected_pos, "event order is good (3)"); - bt_object_put_ref(conn); - bt_object_put_ref(graph); - bt_object_put_ref(sink); - bt_object_put_ref(src); + bt_connection_put_ref(conn); + bt_graph_put_ref(graph); + bt_component_sink_put_ref(sink); + bt_component_source_put_ref(src); } static void test_empty_graph(void) { - struct bt_graph *graph; + bt_graph *graph; prepare_test(TEST_EMPTY_GRAPH, "empty graph"); graph = create_graph(); ok(events->len == 0, "empty graph generates no events"); - bt_object_put_ref(graph); + bt_graph_put_ref(graph); } int main(int argc, char **argv)