Fix: sink.text.pretty: check that port is connected before creating message iterator
sink.text.pretty does not check if its input port is connected before
trying to create a message iterator on it. This can lead to a
precondition assertion failure. It can be reproduced with this Python
snippet.
import bt2
g = bt2.Graph()
g.add_component(bt2.find_plugin('text').sink_component_classes['pretty'], 'snk')
g.run()
The assertion failure we get is:
04-14 11:35:27.339
1231815 1231815 F LIB/MSG-ITER create_self_component_input_port_message_iterator@iterator.c:295 Babeltrace 2 library precondition not satisfied; error is:
04-14 11:35:27.339
1231815 1231815 F LIB/MSG-ITER create_self_component_input_port_message_iterator@iterator.c:295 Input port is not connected: port-addr=0x607000001d70, port-type=INPUT, port-name="in"
04-14 11:35:27.339
1231815 1231815 F LIB/MSG-ITER create_self_component_input_port_message_iterator@iterator.c:295 Aborting...
./tests/utils/../utils/utils.sh: line 283:
1231815 Aborted (core dumped) env "${env_args[@]}" "$@"
Add a check and return an error if that happens instead. A
corresponding test is also added.
Change-Id: Ibeed94cd6ece543817fe8a765a69cb52bbaaba76
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3403
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3411