bt2: Adapt test_message_iterator.py and make it pass
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 3 Jun 2019 20:48:45 +0000 (16:48 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 5 Jun 2019 17:47:34 +0000 (13:47 -0400)
commitc5f330cd909f5dfbdb519546e875b4427434ba4f
tree7fec5fd820588a970b2e96079e86d7d17ab963e2
parent9ec609eca33472c516129ba3b1257fbfc1978e77
bt2: Adapt test_message_iterator.py and make it pass

Update test_message_iterator.py to work with the current Babeltrace API.
Most changes are related to the fact that it is not possible anymore to
create most objects in isolation, everything is derived from a trace
class.  Message iterators are created in the _graph_is_configured
callback rather than _port_connected. Because of this, we now need to
call graph.run() in the tests to get _graph_is_configured called.

I noticed that the component method of _SelfPortInputMessageIterator was
a bit problematic, as we don't know the type of the component at that
point.  Returning the right type of component (the right Python class,
wrapping the right type of Swig pointer) would require a bit of dirty
work.  I am not sure this is even useful, so I've just removed it and
marked the tests as skipped / commented them out (they can be removed if
we rule this is indeed unnecessary).

An important change is the addition the self_output_port parameter in
the constructor of _UserMessageIterator (which the user is expected to
override).  This parameter is how the iterator is supposed to know what
it's supposed to iterate on (if the component has multiple ports).

There are no other changes in message_iterator.py, since everything had
to be done already for test_message.py to pass.

Change-Id: I574d812ed81d9628a8e4a2a2dd5c593c4d730c95
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1326
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bindings/python/bt2/bt2/message_iterator.py
bindings/python/bt2/bt2/native_bt_component_class.i
tests/bindings/python/bt2/test_clock_class.py
tests/bindings/python/bt2/test_event.py
tests/bindings/python/bt2/test_graph.py
tests/bindings/python/bt2/test_message.py
tests/bindings/python/bt2/test_message_iterator.py
This page took 0.025167 seconds and 4 git commands to generate.