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>