#include <babeltrace2/value-const.h>
#include "lib/value.h"
#include <unistd.h>
+#include <stdbool.h>
#include <glib.h>
#include "component-class-sink-simple.h"
struct bt_graph *graph;
int ret;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE(mip_version <= bt_get_maximal_mip_version(),
"Unknown MIP version: mip-version=%" PRIu64 ", "
"max-mip-version=%" PRIu64,
enum bt_component_class_port_connected_method_status port_connected_status;
bool init_can_consume;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(upstream_port, "Upstream port");
BT_ASSERT_PRE_NON_NULL(downstream_port, "Downstream port port");
consume_status == BT_FUNC_STATUS_MEMORY_ERROR,
"Invalid component status returned by consuming method: "
"status=%s", bt_common_func_status_string(consume_status));
+ BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(consume_status);
if (consume_status) {
if (consume_status < 0) {
BT_LIB_LOGW_APPEND_CAUSE(
{
enum bt_graph_run_once_status status;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_DEV_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_DEV(graph->can_consume,
"Cannot consume graph in its current state: %!+g", graph);
{
enum bt_graph_run_status status;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE(graph->can_consume,
"Cannot consume graph in its current state: %!+g", graph);
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
};
bt_listener_id listener_id;
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(func, "Listener");
BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
listeners = graph->listeners.source_output_port_added;
break;
default:
- abort();
+ bt_common_abort();
}
break;
listeners = graph->listeners.filter_output_port_added;
break;
default:
- abort();
+ bt_common_abort();
}
break;
listeners = graph->listeners.sink_input_port_added;
break;
default:
- abort();
+ bt_common_abort();
}
break;
}
default:
- abort();
+ bt_common_abort();
}
for (i = 0; i < listeners->len; i++) {
BT_ASSERT(listener->func);
status = listener->func(comp, port, listener->base.data);
+ BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(status);
if (status != BT_FUNC_STATUS_OK) {
goto end;
}
graph->listeners.source_sink_ports_connected;
break;
default:
- abort();
+ bt_common_abort();
}
break;
graph->listeners.filter_sink_ports_connected;
break;
default:
- abort();
+ bt_common_abort();
}
break;
}
default:
- abort();
+ bt_common_abort();
}
for (i = 0; i < listeners->len; i++) {
BT_ASSERT(listener->func);
status = listener->func(upstream_comp, downstream_comp,
upstream_port, downstream_port, listener->base.data);
+ BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(status);
if (status != BT_FUNC_STATUS_OK) {
goto end;
}
init_status = init_method(component, NULL, params, init_method_data);
BT_LOGD("User method returned: status=%s",
bt_common_func_status_string(init_status));
+ BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(init_status);
if (init_status != BT_FUNC_STATUS_OK) {
if (init_status < 0) {
BT_LIB_LOGW_APPEND_CAUSE(
void *init_method_data, bt_logging_level log_level,
const struct bt_component_source **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
return add_component_with_init_method_data(graph,
(void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
enum bt_logging_level log_level,
const struct bt_component_source **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
return bt_graph_add_source_component_with_initialize_method_data(
graph, comp_cls, name, params, NULL, log_level, component);
}
void *init_method_data, enum bt_logging_level log_level,
const struct bt_component_filter **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
return add_component_with_init_method_data(graph,
(void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
enum bt_logging_level log_level,
const struct bt_component_filter **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
return bt_graph_add_filter_component_with_initialize_method_data(
graph, comp_cls, name, params, NULL, log_level, component);
}
void *init_method_data, enum bt_logging_level log_level,
const struct bt_component_sink **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
return add_component_with_init_method_data(graph,
(void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
enum bt_logging_level log_level,
const struct bt_component_sink **component)
{
+ BT_ASSERT_PRE_NO_ERROR();
return bt_graph_add_sink_component_with_initialize_method_data(
graph, comp_cls, name, params, NULL, log_level, component);
}
.user_data = user_data,
};
+ BT_ASSERT_PRE_NO_ERROR();
+
/*
* Other preconditions are checked by
* bt_graph_add_sink_component_with_init_method_data().
enum bt_graph_add_interrupter_status bt_graph_add_interrupter(
struct bt_graph *graph, const struct bt_interrupter *intr)
{
+ BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(graph, "Graph");
BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
g_ptr_array_add(graph->interrupters, (void *) intr);