#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>
#include "tap/tap.h"
-#define NR_TESTS 14
+#define NR_TESTS 12
enum test {
TEST_NO_TS,
TEST_NO_UPSTREAM_CONNECTION,
- TEST_EVENT_NOTIF_VS_THE_REST,
TEST_SIMPLE_4_PORTS,
TEST_4_PORTS_WITH_RETRIES,
TEST_SINGLE_END_THEN_MULTIPLE_FULL,
TEST_EV_TYPE_NOTIF_INACTIVITY,
TEST_EV_TYPE_NOTIF_PACKET_BEGIN,
TEST_EV_TYPE_NOTIF_PACKET_END,
+ TEST_EV_TYPE_NOTIF_STREAM_BEGIN,
+ TEST_EV_TYPE_NOTIF_STREAM_END,
TEST_EV_TYPE_AGAIN,
TEST_EV_TYPE_END,
TEST_EV_TYPE_SENTINEL,
static struct bt_ctf_clock_class *src_clock_class;
static struct bt_ctf_stream_class *src_stream_class;
static struct bt_ctf_event_class *src_event_class;
-static struct bt_ctf_packet *src_packet;
+static struct bt_ctf_packet *src_packet0;
+static struct bt_ctf_packet *src_packet1;
+static struct bt_ctf_packet *src_packet2;
+static struct bt_ctf_packet *src_packet3;
enum {
SEQ_END = -1,
size_t iter_index;
int64_t *seq;
size_t at;
+ struct bt_ctf_packet *packet;
};
struct sink_user_data {
};
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[] = {
1, 4, 189, 1001, SEQ_END,
};
-static int64_t seq6[] = {
- 1, 2, 12, SEQ_PACKET_BEGIN, 14, 19, SEQ_END,
-};
-
-static int64_t seq7[] = {
- 8, 9, SEQ_PACKET_BEGIN, 10, 13, SEQ_PACKET_END, 22, SEQ_END,
-};
-
static
void clear_test_events(void)
{
case TEST_EV_TYPE_NOTIF_PACKET_END:
fprintf(fp, "TEST_EV_TYPE_NOTIF_PACKET_END");
break;
+ case TEST_EV_TYPE_NOTIF_STREAM_BEGIN:
+ fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
+ break;
+ case TEST_EV_TYPE_NOTIF_STREAM_END:
+ fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_END");
+ break;
case TEST_EV_TYPE_AGAIN:
fprintf(fp, "TEST_EV_TYPE_AGAIN");
break;
}
if (i != test_events->len) {
+ if (debug) {
+ fprintf(stderr, ":: Length mismatch\n");
+ }
+
return false;
}
assert(ret == 0);
ret = bt_ctf_trace_add_stream_class(trace, src_stream_class);
assert(ret == 0);
- stream = bt_ctf_stream_create(src_stream_class, "my-stream");
+ stream = bt_ctf_stream_create(src_stream_class, "stream0");
assert(stream);
- src_packet = bt_ctf_packet_create(stream);
- assert(src_packet);
+ src_packet0 = bt_ctf_packet_create(stream);
+ assert(src_packet0);
+ bt_put(stream);
+ stream = bt_ctf_stream_create(src_stream_class, "stream1");
+ assert(stream);
+ src_packet1 = bt_ctf_packet_create(stream);
+ assert(src_packet0);
+ bt_put(stream);
+ stream = bt_ctf_stream_create(src_stream_class, "stream2");
+ assert(stream);
+ src_packet2 = bt_ctf_packet_create(stream);
+ assert(src_packet0);
+ bt_put(stream);
+ stream = bt_ctf_stream_create(src_stream_class, "stream3");
+ assert(stream);
+ src_packet3 = bt_ctf_packet_create(stream);
+ assert(src_packet0);
+ bt_put(stream);
bt_put(trace);
- bt_put(stream);
bt_put(empty_struct_ft);
}
bt_put(src_clock_class);
bt_put(src_stream_class);
bt_put(src_event_class);
+ bt_put(src_packet0);
+ bt_put(src_packet1);
+ bt_put(src_packet2);
+ bt_put(src_packet3);
}
static
user_data->iter_index = port_name[3] - '0';
bt_put(port);
+ switch (user_data->iter_index) {
+ case 0:
+ user_data->packet = src_packet0;
+ break;
+ case 1:
+ user_data->packet = src_packet1;
+ break;
+ case 2:
+ user_data->packet = src_packet2;
+ break;
+ case 3:
+ user_data->packet = src_packet3;
+ break;
+ default:
+ assert(false);
+ }
+
switch (current_test) {
case TEST_NO_TS:
if (user_data->iter_index == 1) {
user_data->seq = seq5;
}
break;
- case TEST_EVENT_NOTIF_VS_THE_REST:
- if (user_data->iter_index == 0) {
- user_data->seq = seq6;
- } else {
- user_data->seq = seq7;
- }
- break;
case TEST_SIMPLE_4_PORTS:
if (user_data->iter_index == 0) {
user_data->seq = seq1;
}
static
-struct bt_ctf_event *src_create_event(int64_t ts_ns)
+struct bt_ctf_event *src_create_event(struct bt_ctf_packet *packet,
+ int64_t ts_ns)
{
struct bt_ctf_event *event = bt_ctf_event_create(src_event_class);
int ret;
assert(event);
- ret = bt_ctf_event_set_packet(event, src_packet);
+ ret = bt_ctf_event_set_packet(event, packet);
assert(ret == 0);
if (ts_ns != -1) {
break;
case SEQ_PACKET_BEGIN:
next_return.notification =
- bt_notification_packet_begin_create(src_packet);
+ bt_notification_packet_begin_create(user_data->packet);
assert(next_return.notification);
break;
case SEQ_PACKET_END:
next_return.notification =
- bt_notification_packet_end_create(src_packet);
+ bt_notification_packet_end_create(user_data->packet);
assert(next_return.notification);
break;
default:
{
- struct bt_ctf_event *event = src_create_event(cur_ts_ns);
+ struct bt_ctf_event *event = src_create_event(
+ user_data->packet, cur_ts_ns);
assert(event);
next_return.notification = bt_notification_event_create(event,
if (user_data->iter_index == 0) {
if (user_data->at == 0) {
next_return.notification =
- bt_notification_packet_begin_create(src_packet);
+ bt_notification_packet_begin_create(
+ user_data->packet);
assert(next_return.notification);
} else if (user_data->at < 6) {
- struct bt_ctf_event *event = src_create_event(-1);
+ struct bt_ctf_event *event = src_create_event(
+ user_data->packet, -1);
assert(event);
next_return.notification =
next_return = src_iter_next_seq(user_data);
}
break;
- case TEST_EVENT_NOTIF_VS_THE_REST:
case TEST_SIMPLE_4_PORTS:
case TEST_4_PORTS_WITH_RETRIES:
next_return = src_iter_next_seq(user_data);
struct bt_private_port *priv_port;
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out1");
+ private_component, "out1", NULL);
assert(priv_port);
bt_put(priv_port);
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out2");
+ private_component, "out2", NULL);
assert(priv_port);
bt_put(priv_port);
next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END;
struct bt_private_port *priv_port;
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out1");
+ private_component, "out1", NULL);
assert(priv_port);
bt_put(priv_port);
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out2");
+ private_component, "out2", NULL);
assert(priv_port);
bt_put(priv_port);
next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END;
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:
- case TEST_EVENT_NOTIF_VS_THE_REST:
nb_ports = 2;
break;
case TEST_SINGLE_END_THEN_MULTIPLE_FULL:
if (nb_ports >= 1) {
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out0");
+ private_component, "out0", NULL);
assert(priv_port);
bt_put(priv_port);
}
if (nb_ports >= 2) {
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out1");
+ private_component, "out1", NULL);
assert(priv_port);
bt_put(priv_port);
}
if (nb_ports >= 3) {
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out2");
+ private_component, "out2", NULL);
assert(priv_port);
bt_put(priv_port);
}
if (nb_ports >= 4) {
priv_port = bt_private_component_source_add_output_private_port(
- private_component, "out3");
+ private_component, "out3", NULL);
assert(priv_port);
bt_put(priv_port);
}
case BT_NOTIFICATION_TYPE_PACKET_END:
test_event.type = TEST_EV_TYPE_NOTIF_PACKET_END;
break;
+ case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
+ test_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN;
+ break;
+ case BT_NOTIFICATION_TYPE_STREAM_END:
+ test_event.type = TEST_EV_TYPE_NOTIF_STREAM_END;
+ break;
default:
test_event.type = TEST_EV_TYPE_NOTIF_UNEXPECTED;
break;
{
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;
}
struct bt_port *upstream_port;
struct bt_port *downstream_port;
struct bt_graph *graph;
- size_t i;
- uint64_t count;
+ int64_t i;
+ int64_t count;
void *conn;
- int ret;
enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
clear_test_events();
/* Connect source output ports to muxer input ports */
if (with_upstream) {
- ret = bt_component_source_get_output_port_count(src_comp, &count);
- assert(ret == 0);
+ count = bt_component_source_get_output_port_count(src_comp);
+ assert(count >= 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
- downstream_port = bt_component_filter_get_input_port_at_index(
+ downstream_port = bt_component_filter_get_input_port_by_index(
muxer_comp, i);
assert(downstream_port);
conn = bt_graph_connect_ports(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ 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);
void test_no_ts(void)
{
const struct test_event expected_test_events[] = {
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = -1, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = -1, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = -1, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = -1, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = -1, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 1, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 4, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 189, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 1001, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
}
static
-void test_event_notif_vs_the_rest(void)
+void test_simple_4_ports(void)
{
const struct test_event expected_test_events[] = {
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 1, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 2, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 8, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 9, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 10, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 12, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 13, },
- { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 14, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 19, },
- { .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 22, },
- { .type = TEST_EV_TYPE_END, },
- { .type = TEST_EV_TYPE_SENTINEL, },
- };
-
- do_std_test(TEST_EVENT_NOTIF_VS_THE_REST, "event notifications vs. the rest",
- expected_test_events, true);
-}
-
-
-static
-void test_simple_4_ports(void)
-{
- const struct test_event expected_test_events[] = {
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 8 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 24 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 41 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 820 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 825 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 836 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 850 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 852 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 857 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 956 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 985 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 996 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 998 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 999 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
{
const struct test_event expected_test_events[] = {
{ .type = TEST_EV_TYPE_AGAIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 8 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 24 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 41 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 825 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 836 },
{ .type = TEST_EV_TYPE_AGAIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 850 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 852 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 857 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 956 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 985 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 996 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 998 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 999 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
{
struct bt_port *avail_muxer_port = NULL;
void *conn;
- uint64_t i;
- uint64_t count;
- int ret;
+ int64_t i;
+ int64_t count;
- ret = bt_component_filter_get_input_port_count(muxer_comp, &count);
- assert(ret == 0);
+ count = bt_component_filter_get_input_port_count(muxer_comp);
+ assert(count >= 0);
for (i = 0; i < count; i++) {
struct bt_port *muxer_port =
- bt_component_filter_get_input_port_at_index(
+ bt_component_filter_get_input_port_by_index(
muxer_comp, i);
assert(muxer_port);
struct bt_port *upstream_port;
struct bt_port *downstream_port;
struct bt_graph *graph;
- size_t i;
- uint64_t count;
+ int64_t i;
+ int64_t count;
void *conn;
int ret;
enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
struct graph_listener_data graph_listener_data;
const struct test_event expected_test_events[] = {
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 8 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 51 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 59 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 819 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 820 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 836 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 857 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 892 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 903 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 944 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 998 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
assert(ret == 0);
/* Connect source output ports to muxer input ports */
- ret = bt_component_source_get_output_port_count(src_comp, &count);
+ count = bt_component_source_get_output_port_count(src_comp);
assert(ret == 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
connect_port_to_first_avail_muxer_port(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ 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);
struct bt_port *upstream_port;
struct bt_port *downstream_port;
struct bt_graph *graph;
- size_t i;
- uint64_t count;
+ int64_t i;
+ int64_t count;
void *conn;
int ret;
enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
struct graph_listener_data graph_listener_data;
const struct test_event expected_test_events[] = {
{ .type = TEST_EV_TYPE_AGAIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 8 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 51 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 59 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 819 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 820 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 836 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 857 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 892 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 903 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 944 },
{ .type = TEST_EV_TYPE_NOTIF_EVENT, .ts_ns = 998 },
+ { .type = TEST_EV_TYPE_NOTIF_PACKET_END, },
+ { .type = TEST_EV_TYPE_NOTIF_STREAM_END, },
{ .type = TEST_EV_TYPE_END, },
{ .type = TEST_EV_TYPE_SENTINEL, },
};
assert(ret == 0);
/* Connect source output ports to muxer input ports */
- ret = bt_component_source_get_output_port_count(src_comp, &count);
+ count = bt_component_source_get_output_port_count(src_comp);
assert(ret == 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
connect_port_to_first_avail_muxer_port(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ 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);
init_static_data();
test_no_ts();
test_no_upstream_connection();
- test_event_notif_vs_the_rest();
test_simple_4_ports();
test_4_ports_with_retries();
test_single_end_then_multiple_full();