lib: remove unused _NO_SINK graph status
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 11 Apr 2019 21:09:32 +0000 (17:09 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 5 Jun 2019 17:47:34 +0000 (13:47 -0400)
Also:

- Add an assert to verify that there is at least a sink component in
  the graph when it's configured.
- Remove the equivalent in the Python bindings, including the test in
  test_graph.py, even though test_graph.py is not functional at the
  moment.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8d6ce79a2c77527908f500017bb346b2c2d94c63
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1315
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bindings/python/bt2/bt2/__init__.py.in
cli/babeltrace.c
include/babeltrace/graph/graph-const.h
include/babeltrace/graph/graph-internal.h
lib/graph/graph.c
tests/bindings/python/bt2/test_graph.py

index e1058890ee29e868f870ba135252ff71795d9373..f8fd8482086967ba3370d25e4c183e05aa2cd2f1 100644 (file)
@@ -99,10 +99,6 @@ class UnsupportedFeature(Exception):
     pass
 
 
-class NoSinkComponent(Exception):
-    pass
-
-
 class TryAgain(Exception):
     pass
 
index 934f9f85eda9ebecaa44c0a6f296ede10da006d2..791c6c8eba18190c6a670e634e2c735866fa25f9 100644 (file)
@@ -2614,8 +2614,6 @@ const char *bt_graph_status_str(bt_graph_status status)
                return "BT_GRAPH_STATUS_CANCELED";
        case BT_GRAPH_STATUS_ERROR:
                return "BT_GRAPH_STATUS_ERROR";
-       case BT_GRAPH_STATUS_NO_SINK:
-               return "BT_GRAPH_STATUS_NO_SINK";
        case BT_GRAPH_STATUS_NOMEM:
                return "BT_GRAPH_STATUS_NOMEM";
        default:
index a8c5a5148b83e157341b09ac31bf98fe855907e2..9cb12acfd02ad7ed62822b06e7bdb081f965fe18 100644 (file)
@@ -38,7 +38,6 @@ typedef enum bt_graph_status {
        BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION = 111,
        BT_GRAPH_STATUS_CANCELED = 125,
        BT_GRAPH_STATUS_ERROR = -1,
-       BT_GRAPH_STATUS_NO_SINK = -6,
        BT_GRAPH_STATUS_NOMEM = -12,
 } bt_graph_status;
 
index ec2f65ecff9d2afd55ab548f84b2f539a4991530..d9ae46f6b0573785e462e8c6f8f8f52a3145a43f 100644 (file)
@@ -177,8 +177,6 @@ const char *bt_graph_status_string(enum bt_graph_status status)
                return "BT_GRAPH_STATUS_END";
        case BT_GRAPH_STATUS_OK:
                return "BT_GRAPH_STATUS_OK";
-       case BT_GRAPH_STATUS_NO_SINK:
-               return "BT_GRAPH_STATUS_NO_SINK";
        case BT_GRAPH_STATUS_ERROR:
                return "BT_GRAPH_STATUS_ERROR";
        case BT_GRAPH_STATUS_COMPONENT_REFUSES_PORT_CONNECTION:
@@ -219,6 +217,10 @@ enum bt_graph_status bt_graph_configure(struct bt_graph *graph)
                goto end;
        }
 
+#ifdef BT_ASSERT_PRE
+       BT_ASSERT_PRE(graph->has_sink, "Graph has no sink component: %!+g", graph);
+#endif
+
        graph->config_state = BT_GRAPH_CONFIGURATION_STATE_PARTIALLY_CONFIGURED;
 
        for (i = 0; i < graph->components->len; i++) {
index 2940355faf897ccbbb691a1e77be6ee46133f9dc..219ca277ae6a197ea4d2e604cd9730db35745ac4 100644 (file)
@@ -752,8 +752,6 @@ enum bt_graph_status bt_graph_run(struct bt_graph *graph)
                        if (graph->sinks_to_consume->length > 1) {
                                status = BT_GRAPH_STATUS_OK;
                        }
-               } else if (status == BT_GRAPH_STATUS_NO_SINK) {
-                       goto end;
                }
        } while (status == BT_GRAPH_STATUS_OK);
 
index 1d37e22502e67e4e542b57a4fbea28184bd30e20..73788b48001f3b31dd2b3ce00171a7269fa2153e 100644 (file)
@@ -370,29 +370,6 @@ class GraphTestCase(unittest.TestCase):
         with self.assertRaises(bt2.TryAgain):
             self._graph.run()
 
-    def test_run_no_sink(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
-        class MySource(bt2._UserSourceComponent,
-                       message_iterator_class=MyIter):
-            def __init__(self, params):
-                self._add_output_port('out')
-
-        class MyFilter(bt2._UserFilterComponent,
-                       message_iterator_class=MyIter):
-            def __init__(self, params):
-                self._add_output_port('out')
-                self._add_input_port('in')
-
-        src = self._graph.add_component(MySource, 'src')
-        flt = self._graph.add_component(MyFilter, 'flt')
-        conn = self._graph.connect_ports(src.output_ports['out'],
-                                         flt.input_ports['in'])
-
-        with self.assertRaises(bt2.NoSinkComponent):
-            self._graph.run()
-
     def test_run_error(self):
         class MyIter(bt2._UserMessageIterator):
             def __init__(self):
This page took 0.029374 seconds and 4 git commands to generate.