lib: strictly type function return status enumerations
[babeltrace.git] / tests / lib / test_trace_ir_ref.c
index 166cddad57232c6af5277eaad321344196a199b8..5051fa6d1d00aa9550ef3f7f7a6ee669816d3019 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <stdio.h>
 #include "tap/tap.h"
-#include <babeltrace/babeltrace.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/compat/stdlib-internal.h>
-#include <babeltrace/assert-internal.h>
+#include <babeltrace2/babeltrace.h>
+#include "lib/object.h"
+#include "compat/stdlib.h"
+#include "common/assert.h"
+#include <babeltrace2/ctf-writer/writer.h>
+#include <babeltrace2/ctf-writer/clock.h>
+#include <babeltrace2/ctf-writer/clock-class.h>
+#include <babeltrace2/ctf-writer/stream.h>
+#include <babeltrace2/ctf-writer/event.h>
+#include <babeltrace2/ctf-writer/event-types.h>
+#include <babeltrace2/ctf-writer/event-fields.h>
+#include <babeltrace2/ctf-writer/stream-class.h>
+#include <babeltrace2/ctf-writer/trace.h>
 #include "common.h"
 
 #define NR_TESTS 37
@@ -193,7 +203,6 @@ static void set_stream_class_field_classes(
        bt_trace_class *trace_class =
                bt_stream_class_borrow_trace_class(stream_class);
        bt_field_class *packet_context_type;
-       bt_field_class *event_header_type;
        bt_field_class *fc;
        int ret;
 
@@ -213,23 +222,10 @@ static void set_stream_class_field_classes(
                "content_size", fc);
        BT_ASSERT(ret == 0);
        bt_field_class_put_ref(fc);
-       event_header_type = bt_field_class_structure_create(trace_class);
-       BT_ASSERT(event_header_type);
-       fc = bt_field_class_unsigned_integer_create(trace_class);
-       BT_ASSERT(fc);
-       bt_field_class_integer_set_field_value_range(fc, 32);
-       ret = bt_field_class_structure_append_member(event_header_type,
-               "id", fc);
-       BT_ASSERT(ret == 0);
-       bt_field_class_put_ref(fc);
        ret = bt_stream_class_set_packet_context_field_class(
                stream_class, packet_context_type);
        BT_ASSERT(ret == 0);
-       ret = bt_stream_class_set_event_header_field_class(
-               stream_class, event_header_type);
-       BT_ASSERT(ret == 0);
        bt_field_class_put_ref(packet_context_type);
-       bt_field_class_put_ref(event_header_type);
 }
 
 static void create_sc1(bt_trace_class *trace_class)
@@ -274,28 +270,6 @@ static void create_sc2(bt_trace_class *trace_class)
        BT_STREAM_CLASS_PUT_REF_AND_RESET(sc2);
 }
 
-static void set_trace_packet_header(bt_trace_class *trace_class)
-{
-       bt_field_class *packet_header_type;
-       bt_field_class *fc;
-       int ret;
-
-       packet_header_type = bt_field_class_structure_create(trace_class);
-       BT_ASSERT(packet_header_type);
-       fc = bt_field_class_unsigned_integer_create(trace_class);
-       BT_ASSERT(fc);
-       bt_field_class_integer_set_field_value_range(fc, 32);
-       ret = bt_field_class_structure_append_member(packet_header_type,
-               "stream_id", fc);
-       BT_ASSERT(ret == 0);
-       bt_field_class_put_ref(fc);
-       ret = bt_trace_class_set_packet_header_field_class(trace_class,
-               packet_header_type);
-       BT_ASSERT(ret == 0);
-
-       bt_field_class_put_ref(packet_header_type);
-}
-
 static bt_trace_class *create_tc1(bt_self_component_source *self_comp)
 {
        bt_trace_class *tc1 = NULL;
@@ -303,7 +277,6 @@ static bt_trace_class *create_tc1(bt_self_component_source *self_comp)
        tc1 = bt_trace_class_create(
                bt_self_component_source_as_self_component(self_comp));
        BT_ASSERT(tc1);
-       set_trace_packet_header(tc1);
        create_sc1(tc1);
        create_sc2(tc1);
        return tc1;
@@ -469,21 +442,21 @@ static void test_example_scenario(bt_self_component_source *self_comp)
 }
 
 static
-bt_self_component_status src_init(
+bt_component_class_init_method_status src_init(
        bt_self_component_source *self_comp,
        const bt_value *params, void *init_method_data)
 {
        test_example_scenario(self_comp);
-       return BT_SELF_COMPONENT_STATUS_OK;
+       return BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
 }
 
 static
-bt_self_message_iterator_status src_iter_next(
+bt_component_class_message_iterator_next_method_status src_iter_next(
                bt_self_message_iterator *self_iterator,
                bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+       return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
 }
 
 static void test_example_scenario_in_graph(void)
@@ -498,7 +471,7 @@ static void test_example_scenario_in_graph(void)
        BT_ASSERT(ret == 0);
        graph = bt_graph_create();
        ret = bt_graph_add_source_component(graph, comp_cls, "src-comp",
-               NULL, NULL);
+               NULL, BT_LOGGING_LEVEL_NONE, NULL);
        BT_ASSERT(ret == 0);
        bt_graph_put_ref(graph);
        bt_component_class_source_put_ref(comp_cls);
This page took 0.025333 seconds and 4 git commands to generate.