Move to kernel style SPDX license identifiers
[babeltrace.git] / tests / lib / test_simple_sink.c
index 87a1319850fcf32afbd0caa8d18db75749b509e4..952b6bf52a1d0300b09583fb8b78e7c4bddc269c 100644 (file)
@@ -1,18 +1,7 @@
 /*
- * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
+ * SPDX-License-Identifier: GPL-2.0-only
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
 #include <babeltrace2/babeltrace.h>
@@ -29,7 +18,7 @@ struct test_data {
 
 static
 bt_graph_simple_sink_component_initialize_func_status simple_INITIALIZE_func(
-               bt_self_component_port_input_message_iterator *iterator,
+               bt_message_iterator *iterator,
                void *data)
 {
        struct test_data *test_data = data;
@@ -41,7 +30,7 @@ bt_graph_simple_sink_component_initialize_func_status simple_INITIALIZE_func(
 
 static
 bt_graph_simple_sink_component_consume_func_status simple_consume_func(
-               bt_self_component_port_input_message_iterator *iterator,
+               bt_message_iterator *iterator,
                void *data)
 {
        struct test_data *test_data = data;
@@ -72,17 +61,18 @@ bt_component_class_initialize_method_status src_init(
 }
 
 static
-bt_component_class_message_iterator_next_method_status src_iter_next(
+bt_message_iterator_class_next_method_status src_iter_next(
                bt_self_message_iterator *message_iterator,
                bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       return BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
+       return BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END;
 }
 
 static
 bt_graph *create_graph_with_source(const bt_port_output **out_port)
 {
+       bt_message_iterator_class *msg_iter_cls;
        bt_component_class_source *src_comp_cls;
        bt_graph *graph;
        const bt_component_source *src_comp = NULL;
@@ -90,7 +80,11 @@ bt_graph *create_graph_with_source(const bt_port_output **out_port)
        bt_component_class_set_method_status set_method_status;
 
        BT_ASSERT(out_port);
-       src_comp_cls = bt_component_class_source_create("src", src_iter_next);
+
+       msg_iter_cls = bt_message_iterator_class_create(src_iter_next);
+       BT_ASSERT(msg_iter_cls);
+
+       src_comp_cls = bt_component_class_source_create("src", msg_iter_cls);
        BT_ASSERT(src_comp_cls);
        set_method_status = bt_component_class_source_set_initialize_method(
                src_comp_cls, src_init);
@@ -104,8 +98,8 @@ bt_graph *create_graph_with_source(const bt_port_output **out_port)
        *out_port = bt_component_source_borrow_output_port_by_index_const(
                src_comp, 0);
        BT_ASSERT(*out_port);
-       bt_component_source_put_ref(src_comp);
        bt_component_class_source_put_ref(src_comp_cls);
+       bt_message_iterator_class_put_ref(msg_iter_cls);
        return graph;
 }
 
@@ -157,7 +151,6 @@ void test_simple_expect_run_once_status(
        ok((run_once_status < 0) == (err != NULL),
                "Current thread error is set if bt_graph_run_once returned an error");
 
-       bt_component_sink_put_ref(sink_comp);
        bt_graph_put_ref(graph);
        if (err) {
                bt_error_release(err);
This page took 0.025089 seconds and 4 git commands to generate.