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
}
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,
+enum 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_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,
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_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,
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_source *self_comp,
+ bt_self_component_port_output *self_comp_port,
+ const bt_port_input *other_port)
{
int ret;
struct event event = {
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_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,
}
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 = {
}
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,
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_source *self_comp,
+ const bt_value *params, void *init_method_data)
{
int ret;
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_sink *self_comp,
+ const bt_value *params, void *init_method_data)
{
int ret;
static
enum bt_self_component_status sink_consume(
- struct bt_self_component_sink *self_comp)
+ 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) {
}
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,
}
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,
}
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,
}
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,
}
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,
}
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,
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,
}
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,
}
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);
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;
size_t src_accept_port_connection_pos;
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;
size_t src_accept_port_connection_pos;
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;
size_t src_accept_port_connection_pos;
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;
size_t src_accept_port_connection_pos;
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;
size_t src_accept_port_connection_pos;
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;
size_t src_accept_port_connection_pos;
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)