struct test_event {
enum test_event_type type;
- const struct bt_stream *stream;
- const struct bt_packet *packet;
+ const bt_stream *stream;
+ const bt_packet *packet;
};
static bool debug = false;
static enum test current_test;
static GArray *test_events;
-static struct bt_graph *graph;
-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;
+static bt_graph *graph;
+static bt_stream_class *src_stream_class;
+static bt_event_class *src_event_class;
+static bt_stream *src_stream1;
+static bt_stream *src_stream2;
+static bt_packet *src_stream1_packet1;
+static bt_packet *src_stream1_packet2;
+static bt_packet *src_stream2_packet1;
+static bt_packet *src_stream2_packet2;
enum {
SEQ_END = -1,
};
struct sink_user_data {
- void *notif_iter;
+ bt_self_component_port_input_notification_iterator *notif_iter;
};
/*
static
void init_static_data(void)
{
- struct bt_trace_class *trace_class;
- struct bt_trace *trace;
+ bt_trace_class *trace_class;
+ bt_trace *trace;
/* Test events */
test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event));
fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2);
}
- bt_object_put_ref(trace);
- bt_object_put_ref(trace_class);
+ bt_trace_put_ref(trace);
+ bt_trace_class_put_ref(trace_class);
}
static
g_array_free(test_events, TRUE);
/* Metadata */
- bt_object_put_ref(src_stream_class);
- bt_object_put_ref(src_event_class);
- bt_object_put_ref(src_stream1);
- bt_object_put_ref(src_stream2);
- bt_object_put_ref(src_stream1_packet1);
- bt_object_put_ref(src_stream1_packet2);
- bt_object_put_ref(src_stream2_packet1);
- bt_object_put_ref(src_stream2_packet2);
+ bt_stream_class_put_ref(src_stream_class);
+ bt_event_class_put_ref(src_event_class);
+ bt_stream_put_ref(src_stream1);
+ bt_stream_put_ref(src_stream2);
+ bt_packet_put_ref(src_stream1_packet1);
+ bt_packet_put_ref(src_stream1_packet2);
+ bt_packet_put_ref(src_stream2_packet1);
+ bt_packet_put_ref(src_stream2_packet2);
}
static
-void src_iter_finalize(struct bt_self_notification_iterator *self_notif_iter)
+void src_iter_finalize(bt_self_notification_iterator *self_notif_iter)
{
struct src_iter_user_data *user_data =
bt_self_notification_iterator_get_data(
static
enum bt_self_notification_iterator_status src_iter_init(
- struct bt_self_notification_iterator *self_notif_iter,
- struct bt_self_component_source *self_comp,
- struct bt_self_component_port_output *self_port)
+ bt_self_notification_iterator *self_notif_iter,
+ bt_self_component_source *self_comp,
+ bt_self_component_port_output *self_port)
{
struct src_iter_user_data *user_data =
g_new0(struct src_iter_user_data, 1);
}
static
-void src_iter_next_seq_one(struct bt_self_notification_iterator* notif_iter,
+void src_iter_next_seq_one(bt_self_notification_iterator* notif_iter,
struct src_iter_user_data *user_data,
- const struct bt_notification **notif)
+ const bt_notification **notif)
{
- struct bt_packet *event_packet = NULL;
+ bt_packet *event_packet = NULL;
switch (user_data->seq[user_data->at]) {
case SEQ_STREAM1_BEGIN:
static
enum bt_self_notification_iterator_status src_iter_next_seq(
- struct bt_self_notification_iterator *notif_iter,
+ bt_self_notification_iterator *notif_iter,
struct src_iter_user_data *user_data,
bt_notification_array_const notifs, uint64_t capacity,
uint64_t *count)
static
enum bt_self_notification_iterator_status src_iter_next(
- struct bt_self_notification_iterator *self_notif_iter,
+ bt_self_notification_iterator *self_notif_iter,
bt_notification_array_const notifs, uint64_t capacity,
uint64_t *count)
{
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
-void src_finalize(struct bt_self_component_source *self_comp)
+void src_finalize(bt_self_component_source *self_comp)
{
}
static
-void append_test_events_from_notification(const struct bt_notification *notification)
+void append_test_events_from_notification(const bt_notification *notification)
{
struct test_event test_event = { 0 };
switch (bt_notification_get_type(notification)) {
case BT_NOTIFICATION_TYPE_EVENT:
{
- const struct bt_event *event;
+ const bt_event *event;
test_event.type = TEST_EV_TYPE_NOTIF_EVENT;
event = bt_notification_event_borrow_event_const(notification);
for (i = 0; i < count; i++) {
append_test_events_from_notification(notifications[i]);
- bt_object_put_ref(notifications[i]);
+ bt_notification_put_ref(notifications[i]);
}
end:
static
enum bt_self_component_status sink_consume(
- struct bt_self_component_sink *self_comp)
+ bt_self_component_sink *self_comp)
{
enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
struct sink_user_data *user_data =
switch (it_ret) {
case BT_NOTIFICATION_ITERATOR_STATUS_END:
ret = BT_SELF_COMPONENT_STATUS_END;
- BT_OBJECT_PUT_REF_AND_RESET(user_data->notif_iter);
+ BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+ user_data->notif_iter);
goto end;
case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
abort();
static
enum bt_self_component_status sink_port_connected(
- struct bt_self_component_sink *self_comp,
- struct bt_self_component_port_input *self_port,
- const struct bt_port_output *other_port)
+ bt_self_component_sink *self_comp,
+ bt_self_component_port_input *self_port,
+ const bt_port_output *other_port)
{
struct sink_user_data *user_data =
bt_self_component_get_data(
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)
{
struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
int ret;
}
static
-void sink_finalize(struct bt_self_component_sink *self_comp)
+void sink_finalize(bt_self_component_sink *self_comp)
{
struct sink_user_data *user_data =
bt_self_component_get_data(
self_comp));
if (user_data) {
- bt_object_put_ref(user_data->notif_iter);
+ BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+ user_data->notif_iter);
g_free(user_data);
}
}
static
-void create_source_sink(struct bt_graph *graph,
- const struct bt_component_source **source,
- const struct bt_component_sink **sink)
+void create_source_sink(bt_graph *graph,
+ const bt_component_source **source,
+ const bt_component_sink **sink)
{
- struct bt_component_class_source *src_comp_class;
- struct bt_component_class_sink *sink_comp_class;
+ bt_component_class_source *src_comp_class;
+ bt_component_class_sink *sink_comp_class;
int ret;
/* Create source component */
ret = bt_graph_add_source_component(graph,
src_comp_class, "source", NULL, source);
BT_ASSERT(ret == 0);
- bt_object_put_ref(src_comp_class);
+ bt_component_class_source_put_ref(src_comp_class);
}
/* Create sink component */
sink_comp_class,
"sink", NULL, sink);
BT_ASSERT(ret == 0);
- bt_object_put_ref(sink_comp_class);
+ bt_component_class_sink_put_ref(sink_comp_class);
}
}
void do_std_test(enum test test, const char *name,
const struct test_event *expected_test_events)
{
- const struct bt_component_source *src_comp;
- const struct bt_component_sink *sink_comp;
- const struct bt_port_output *upstream_port;
- const struct bt_port_input *downstream_port;
+ const bt_component_source *src_comp;
+ const bt_component_sink *sink_comp;
+ const bt_port_output *upstream_port;
+ const bt_port_input *downstream_port;
enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
clear_test_events();
"the produced sequence of test events is the expected one");
}
- bt_object_put_ref(src_comp);
- bt_object_put_ref(sink_comp);
- BT_OBJECT_PUT_REF_AND_RESET(graph);
+ bt_component_source_put_ref(src_comp);
+ bt_component_sink_put_ref(sink_comp);
+ BT_GRAPH_PUT_REF_AND_RESET(graph);
}
static
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
- const struct bt_component_source *src_comp;
- struct bt_port_output_notification_iterator *notif_iter;
+ const bt_component_source *src_comp;
+ bt_port_output_notification_iterator *notif_iter;
enum bt_notification_iterator_status iter_status =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
- const struct bt_port_output *upstream_port;
+ const bt_port_output *upstream_port;
clear_test_events();
current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR;
ok(compare_test_events(expected_test_events),
"the produced sequence of test events is the expected one");
- bt_object_put_ref(src_comp);
- BT_OBJECT_PUT_REF_AND_RESET(graph);
- bt_object_put_ref(notif_iter);
+ bt_component_source_put_ref(src_comp);
+ BT_GRAPH_PUT_REF_AND_RESET(graph);
+ bt_port_output_notification_iterator_put_ref(notif_iter);
}
#define DEBUG_ENV_VAR "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"