Fix: lib: set iterator state even in non-dev mode
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 5 Jun 2019 20:38:08 +0000 (16:38 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 6 Jun 2019 14:20:32 +0000 (10:20 -0400)
commit003e713f9ed79e4d7dd5aed20bc270fc9b22374b
tree16b291d8fd0ea44b01745599f5bf2eb1c116fc41
parent4430bc809d78701c128ced642fb4e9597bc00ad0
Fix: lib: set iterator state even in non-dev mode

The following test fails currently when building with
BABELTRACE_DEV_MODE off:

    FAIL: test_finalize (test_message_iterator.UserMessageIteratorTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File ".../babeltrace/tests/bindings/python/bt2/test_message_iterator.py", line 67, in test_finalize
        self.assertTrue(finalized)
    AssertionError: False is not true

The test verifies that the _finalize method (in Python) of an input port
message iterator is called when the iterator is destroyed.  The failure
shows that the method is not getting called.

The issue is that
bt_self_component_port_input_message_iterator_try_finalize doesn't call
the finalize method if the iterator state is
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED.
However, the iterator state is only set when in dev mode.  In non-dev
mode, the state is left to its initial value of
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED.

Fix this by setting the state of the iterator regardless of whether we
are in dev mode or not.

Change-Id: I158c9d913777eba117ed0d32e82db5a1b29f50ab
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1385
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
lib/graph/iterator.c
This page took 0.023952 seconds and 4 git commands to generate.