Update test_intra after new intraprocess communications
This commit is contained in:
parent
d94b6172aa
commit
ce0c39a24d
2 changed files with 12 additions and 37 deletions
|
@ -141,7 +141,7 @@ if(BUILD_TESTING)
|
||||||
|
|
||||||
# Run each test in its own pytest invocation
|
# Run each test in its own pytest invocation
|
||||||
set(_tracetools_test_pytest_tests
|
set(_tracetools_test_pytest_tests
|
||||||
#test/test_intra.py
|
test/test_intra.py
|
||||||
test/test_node.py
|
test/test_node.py
|
||||||
test/test_publisher.py
|
test/test_publisher.py
|
||||||
test/test_service.py
|
test/test_service.py
|
||||||
|
|
|
@ -36,28 +36,19 @@ class TestIntra(TraceTestCase):
|
||||||
# Check events order as set (e.g. node_init before pub_init)
|
# Check events order as set (e.g. node_init before pub_init)
|
||||||
self.assertEventsOrderSet(self._events_ros)
|
self.assertEventsOrderSet(self._events_ros)
|
||||||
|
|
||||||
# Check sub_init for normal and intraprocess events
|
# Check sub_init
|
||||||
sub_init_events = self.get_events_with_name('ros2:rcl_subscription_init')
|
sub_init_events = self.get_events_with_name('ros2:rcl_subscription_init')
|
||||||
sub_init_normal_events = self.get_events_with_field_value(
|
sub_init_normal_events = self.get_events_with_field_value(
|
||||||
'topic_name',
|
'topic_name',
|
||||||
'/the_topic',
|
'/the_topic',
|
||||||
sub_init_events)
|
sub_init_events)
|
||||||
sub_init_intra_events = self.get_events_with_field_value(
|
|
||||||
'topic_name',
|
|
||||||
'/the_topic/_intra',
|
|
||||||
sub_init_events)
|
|
||||||
self.assertNumEventsEqual(
|
self.assertNumEventsEqual(
|
||||||
sub_init_normal_events,
|
sub_init_normal_events,
|
||||||
1,
|
1,
|
||||||
'none or more than 1 sub init event for normal sub')
|
'none or more than 1 sub init event')
|
||||||
self.assertNumEventsEqual(
|
|
||||||
sub_init_intra_events,
|
|
||||||
1,
|
|
||||||
'none or more than 1 sub init event for intra sub')
|
|
||||||
|
|
||||||
# Get subscription handles for normal & intra subscriptions
|
# Get subscription handle
|
||||||
sub_init_normal_event = sub_init_normal_events[0]
|
sub_init_normal_event = sub_init_normal_events[0]
|
||||||
# Note: sub handle linked to "normal" topic is the one actually linked to intra callback
|
|
||||||
sub_handle_intra = self.get_field(sub_init_normal_event, 'subscription_handle')
|
sub_handle_intra = self.get_field(sub_init_normal_event, 'subscription_handle')
|
||||||
print(f'sub_handle_intra: {sub_handle_intra}')
|
print(f'sub_handle_intra: {sub_handle_intra}')
|
||||||
|
|
||||||
|
@ -73,27 +64,27 @@ class TestIntra(TraceTestCase):
|
||||||
1,
|
1,
|
||||||
'none or more than 1 callback added event')
|
'none or more than 1 callback added event')
|
||||||
callback_added_event = callback_added_events[0]
|
callback_added_event = callback_added_events[0]
|
||||||
callback_handle_intra = self.get_field(callback_added_event, 'callback')
|
callback_handle = self.get_field(callback_added_event, 'callback')
|
||||||
|
|
||||||
# Get corresponding callback start/end pairs
|
# Get corresponding callback start/end pairs
|
||||||
start_events = self.get_events_with_name('ros2:callback_start')
|
start_events = self.get_events_with_name('ros2:callback_start')
|
||||||
end_events = self.get_events_with_name('ros2:callback_end')
|
end_events = self.get_events_with_name('ros2:callback_end')
|
||||||
# Should still have at least two start:end pairs (1 normal + 1 intra)
|
# Should have at least one start:end pair
|
||||||
self.assertNumEventsGreaterEqual(
|
self.assertNumEventsGreaterEqual(
|
||||||
start_events,
|
start_events,
|
||||||
2,
|
1,
|
||||||
'does not have at least 2 callback start events')
|
'does not have at least 1 callback start event')
|
||||||
self.assertNumEventsGreaterEqual(
|
self.assertNumEventsGreaterEqual(
|
||||||
end_events,
|
end_events,
|
||||||
2,
|
1,
|
||||||
'does not have at least 2 callback end events')
|
'does not have at least 1 callback end event')
|
||||||
start_events_intra = self.get_events_with_field_value(
|
start_events_intra = self.get_events_with_field_value(
|
||||||
'callback',
|
'callback',
|
||||||
callback_handle_intra,
|
callback_handle,
|
||||||
start_events)
|
start_events)
|
||||||
end_events_intra = self.get_events_with_field_value(
|
end_events_intra = self.get_events_with_field_value(
|
||||||
'callback',
|
'callback',
|
||||||
callback_handle_intra,
|
callback_handle,
|
||||||
end_events)
|
end_events)
|
||||||
self.assertNumEventsGreaterEqual(
|
self.assertNumEventsGreaterEqual(
|
||||||
start_events_intra,
|
start_events_intra,
|
||||||
|
@ -112,22 +103,6 @@ class TestIntra(TraceTestCase):
|
||||||
1,
|
1,
|
||||||
'is_intra_process field value not valid for intra callback')
|
'is_intra_process field value not valid for intra callback')
|
||||||
|
|
||||||
# Also check that the other callback_start event (normal one) has the right field value
|
|
||||||
start_events_not_intra = self.get_events_with_field_not_value(
|
|
||||||
'callback',
|
|
||||||
callback_handle_intra,
|
|
||||||
start_events)
|
|
||||||
self.assertNumEventsGreaterEqual(
|
|
||||||
start_events_not_intra,
|
|
||||||
1,
|
|
||||||
'no normal start event')
|
|
||||||
start_event_not_intra = start_events_not_intra[0]
|
|
||||||
self.assertFieldEquals(
|
|
||||||
start_event_not_intra,
|
|
||||||
'is_intra_process',
|
|
||||||
0,
|
|
||||||
'is_intra_process field value not valid for normal callback')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue