File tree Expand file tree Collapse file tree 5 files changed +20
-1
lines changed
tracetools_test/tracetools_test Expand file tree Collapse file tree 5 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1414
1515import unittest
1616
17+ from launch .actions import SetEnvironmentVariable
1718from tracetools_test .case import TraceTestCase
1819from tracetools_trace .tools import tracepoints as tp
1920
@@ -39,6 +40,8 @@ def __init__(self, *args) -> None:
3940 ],
4041 package = 'test_tracetools' ,
4142 nodes = ['test_ping' , 'test_pong' ],
43+ # Need rmw_cyclonedds_cpp for the rmw instrumentation
44+ additional_actions = SetEnvironmentVariable ('RMW_IMPLEMENTATION' , 'rmw_cyclonedds_cpp' ),
4245 )
4346
4447 def test_all (self ):
Original file line number Diff line number Diff line change 1515
1616import unittest
1717
18+ from launch .actions import SetEnvironmentVariable
1819from tracetools_test .case import TraceTestCase
1920from tracetools_trace .tools import tracepoints as tp
2021
@@ -35,6 +36,8 @@ def __init__(self, *args) -> None:
3536 ],
3637 package = 'test_tracetools' ,
3738 nodes = ['test_publisher' ],
39+ # Need rmw_cyclonedds_cpp for the rmw instrumentation
40+ additional_actions = SetEnvironmentVariable ('RMW_IMPLEMENTATION' , 'rmw_cyclonedds_cpp' ),
3841 )
3942
4043 def test_all (self ):
Original file line number Diff line number Diff line change 1616
1717import unittest
1818
19+ from launch .actions import SetEnvironmentVariable
1920from tracetools_test .case import TraceTestCase
2021from tracetools_trace .tools import tracepoints as tp
2122
@@ -41,6 +42,8 @@ def __init__(self, *args) -> None:
4142 ],
4243 package = 'test_tracetools' ,
4344 nodes = ['test_ping' , 'test_pong' ],
45+ # Need rmw_cyclonedds_cpp for the rmw instrumentation
46+ additional_actions = SetEnvironmentVariable ('RMW_IMPLEMENTATION' , 'rmw_cyclonedds_cpp' ),
4447 )
4548
4649 def test_all (self ):
Original file line number Diff line number Diff line change 2424from typing import Union
2525import unittest
2626
27+ from launch import Action
2728from tracetools_read import DictEvent
2829from tracetools_read import get_event_name
2930from tracetools_read import get_event_timestamp
@@ -59,6 +60,7 @@ def __init__(
5960 nodes : List [str ],
6061 base_path : str = '/tmp' ,
6162 events_kernel : List [str ] = [],
63+ additional_actions : Union [List [Action ], Action ] = [],
6264 ) -> None :
6365 """Create a TraceTestCase."""
6466 super ().__init__ (methodName = args [0 ])
@@ -68,6 +70,7 @@ def __init__(
6870 self ._events_kernel = events_kernel
6971 self ._package = package
7072 self ._nodes = nodes
73+ self ._additional_actions = additional_actions
7174
7275 def setUp (self ):
7376 # Get timestamp before trace (ns)
@@ -80,6 +83,7 @@ def setUp(self):
8083 self ._events_kernel ,
8184 self ._package ,
8285 self ._nodes ,
86+ self ._additional_actions ,
8387 )
8488
8589 print (f'TRACE DIRECTORY: { full_path } ' )
Original file line number Diff line number Diff line change 1818import shutil
1919from typing import List
2020from typing import Tuple
21+ from typing import Union
2122
23+ from launch import Action
2224from launch import LaunchDescription
2325from launch import LaunchService
2426from launch_ros .actions import Node
@@ -35,6 +37,7 @@ def run_and_trace(
3537 kernel_events : List [str ],
3638 package_name : str ,
3739 node_names : List [str ],
40+ additional_actions : Union [List [Action ], Action ] = [],
3841) -> Tuple [int , str ]:
3942 """
4043 Run a node while tracing.
@@ -45,12 +48,15 @@ def run_and_trace(
4548 :param kernel_events: the list of kernel events to enable
4649 :param package_name: the name of the package to use
4750 :param node_names: the names of the nodes to execute
51+ :param additional_actions: the list of additional actions to prepend
4852 :return: exit code, full generated path
4953 """
5054 session_name = append_timestamp (session_name_prefix )
5155 full_path = os .path .join (base_path , session_name )
56+ if not isinstance (additional_actions , list ):
57+ additional_actions = [additional_actions ]
5258
53- launch_actions = []
59+ launch_actions = additional_actions
5460 # Add trace action
5561 launch_actions .append (
5662 Trace (
You can’t perform that action at this time.
0 commit comments