ros2_tracing/tracetools_test/test/test_node.py

40 lines
1 KiB
Python
Raw Normal View History

2019-06-03 10:07:43 +02:00
import unittest
2019-06-05 15:35:46 +02:00
2019-06-03 10:07:43 +02:00
from tracetools_test.utils import (
2019-06-05 15:35:46 +02:00
cleanup_trace,
2019-06-03 10:07:43 +02:00
get_trace_event_names,
run_and_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',
]
2019-06-05 15:35:46 +02:00
2019-06-03 10:07:43 +02:00
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:42:23 +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()