ros2_tracing/tracetools_test/test/test_node.py

33 lines
818 B
Python
Raw Normal View History

2019-06-03 10:07:43 +02:00
import unittest
from tracetools_test.utils import (
get_trace_event_names,
run_and_trace,
cleanup_trace,
)
2019-06-03 11:39:37 +02:00
BASE_PATH = '/tmp'
2019-06-03 10:07:43 +02:00
PKG = 'tracetools_test'
node_creation_events = [
'ros2:rcl_init',
'ros2:rcl_node_init',
]
class TestNode(unittest.TestCase):
def test_creation(self):
session_name_prefix = 'session-test-node-creation'
test_node = ['test_publisher']
2019-06-03 10:07:43 +02:00
2019-06-03 11:39:37 +02:00
exit_code, full_path = run_and_trace(BASE_PATH, session_name_prefix, node_creation_events, None, PKG, test_node)
2019-06-03 10:07:43 +02:00
self.assertEqual(exit_code, 0)
trace_events = get_trace_event_names(full_path)
print(f'trace_events: {trace_events}')
self.assertSetEqual(set(node_creation_events), trace_events)
cleanup_trace(full_path)
if __name__ == '__main__':
unittest.main()