lib, bt2: add precondition check for port name unicity
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 9 Apr 2020 20:23:47 +0000 (16:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 14 Apr 2020 14:56:41 +0000 (10:56 -0400)
commit157a98edd5aebe1b6ab7f60a49d8430450fabe76
tree9a308a665aa90574fa08fa1cbdaaedbc7676fe47
parent5d9ef4cb64e5bd7793d443cbfcc0248bb8804580
lib, bt2: add precondition check for port name unicity

The documentation for the _add_input_port API functions state that there
must be no other input port with the same name.  Ditto for output ports.

This patch adds some precondition checks for that.  A failed assertion looks
like this:

    04-09 16:29:23.968 2961462 2961462 F LIB/COMPONENT-SINK bt_self_component_sink_add_input_port@component-sink.c:132 Babeltrace 2 library precondition not satisfied; error is:
    04-09 16:29:23.968 2961462 2961462 F LIB/COMPONENT-SINK bt_self_component_sink_add_input_port@component-sink.c:132 Input port name is not unique: name="bob", comp-addr=0x60c000001e40, comp-name="mon sink", comp-log-level=NONE, comp-class-type=SINK, comp-class-name="MySink", comp-class-partial-descr=""
    04-09 16:29:23.968 2961462 2961462 F LIB/COMPONENT-SINK bt_self_component_sink_add_input_port@component-sink.c:132 Aborting...

Equivalent checks are added to the Python bindings, as well as tests.

Change-Id: I12f5a16b6b5efc46f2b50f27e338cc57b8487ff6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3387
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/bindings/python/bt2/bt2/component.py
src/lib/graph/component-filter.c
src/lib/graph/component-sink.c
src/lib/graph/component-source.c
src/lib/graph/component.c
src/lib/graph/component.h
tests/bindings/python/bt2/test_port.py
This page took 0.0255649999999999 seconds and 4 git commands to generate.