-
Notifications
You must be signed in to change notification settings - Fork 60
Add dual session tests #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ShravanDeva5327
wants to merge
3
commits into
ros2:rolling
Choose a base branch
from
ShravanDeva5327:add-dual-session-tests
base: rolling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,7 @@ def _check_trace_action( | |
| *, | ||
| session_name: Optional[str] = 'my-session-name', | ||
| snapshot_mode: bool = False, | ||
| dual_session: bool = False, | ||
| append_trace: bool = False, | ||
| events_ust: List[str] = ['ros2:*', '*'], | ||
| subbuffer_size_ust: int = 524288, | ||
|
|
@@ -111,6 +112,10 @@ def _check_trace_action( | |
| snapshot_mode, | ||
| perform_typed_substitution(context, action.snapshot_mode, bool) | ||
| ) | ||
| self.assertEqual( | ||
| dual_session, | ||
| perform_typed_substitution(context, action.dual_session, bool) | ||
| ) | ||
| self.assertEqual( | ||
| append_trace, | ||
| perform_typed_substitution(context, action.append_trace, bool) | ||
|
|
@@ -169,6 +174,27 @@ def test_action_snapshot_mode(self) -> None: | |
|
|
||
| shutil.rmtree(tmpdir) | ||
|
|
||
| def test_action_dual_session(self) -> None: | ||
| tmpdir = tempfile.mkdtemp(prefix='TestTraceAction__test_action_dual_session') | ||
|
|
||
| action = Trace( | ||
| session_name='my-session-name', | ||
| dual_session=True, | ||
| base_path=tmpdir, | ||
| events_kernel=[], | ||
| syscalls=[], | ||
| events_ust=[ | ||
| 'ros2:*', | ||
| '*', | ||
| ], | ||
| subbuffer_size_ust=524288, | ||
| subbuffer_size_kernel=1048576, | ||
| ) | ||
| context = self._assert_launch_no_errors([action]) | ||
| self._check_trace_action(action, context, tmpdir, dual_session=True) | ||
|
|
||
| shutil.rmtree(tmpdir) | ||
|
|
||
| def test_action_frontend_xml(self) -> None: | ||
| tmpdir = tempfile.mkdtemp(prefix='TestTraceAction__test_frontend_xml') | ||
|
|
||
|
|
@@ -178,6 +204,7 @@ def test_action_frontend_xml(self) -> None: | |
| <trace | ||
| session-name="my-session-name" | ||
| snapshot-mode="false" | ||
| dual-session="false" | ||
| append-timestamp="false" | ||
| base-path="{}" | ||
| append-trace="true" | ||
|
|
@@ -208,6 +235,7 @@ def test_action_frontend_yaml(self) -> None: | |
| - trace: | ||
| session-name: my-session-name | ||
| snapshot-mode: false | ||
| dual-session: false | ||
| append-timestamp: false | ||
| base-path: {} | ||
| append-trace: true | ||
|
|
@@ -300,6 +328,11 @@ def test_action_substitutions(self) -> None: | |
| default_value='False', | ||
| description='whether to take a snapshot of the session', | ||
| ) | ||
| dual_session_arg = DeclareLaunchArgument( | ||
| 'dual-session', | ||
| default_value='False', | ||
| description='whether to pre-configure a dual session', | ||
| ) | ||
| append_timestamp_arg = DeclareLaunchArgument( | ||
| 'append-timestamp', | ||
| default_value='False', | ||
|
|
@@ -323,6 +356,7 @@ def test_action_substitutions(self) -> None: | |
| action = Trace( | ||
| session_name=LaunchConfiguration(session_name_arg.name), | ||
| snapshot_mode=LaunchConfiguration(snapshot_mode_arg.name), | ||
| dual_session=LaunchConfiguration(dual_session_arg.name), | ||
| append_timestamp=LaunchConfiguration(append_timestamp_arg.name), | ||
| base_path=TextSubstitution(text=tmpdir), | ||
| append_trace=LaunchConfiguration(append_trace_arg.name), | ||
|
|
@@ -345,6 +379,7 @@ def test_action_substitutions(self) -> None: | |
| context = self._assert_launch_no_errors([ | ||
| session_name_arg, | ||
| snapshot_mode_arg, | ||
| dual_session_arg, | ||
| append_timestamp_arg, | ||
| append_trace_arg, | ||
| subbuffer_size_ust_arg, | ||
|
|
@@ -378,6 +413,7 @@ def test_action_substitutions_frontend_xml(self) -> None: | |
| <launch> | ||
| <arg name="session-name" default="my-session-name" /> | ||
| <arg name="snapshot-mode" default="false" /> | ||
| <arg name="dual-session" default="false" /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This (and Same for the YAML launch file in |
||
| <arg name="append-timestamp" default="false" /> | ||
| <arg name="base-path" default="{}" /> | ||
| <arg name="append-trace" default="true" /> | ||
|
|
@@ -387,6 +423,8 @@ def test_action_substitutions_frontend_xml(self) -> None: | |
| <arg name="subbuffer-size-kernel" default="1048576" /> | ||
| <trace | ||
| session-name="$(var session-name)" | ||
| snapshot-mode="$(var snapshot-mode)" | ||
| dual-session="$(var dual-session)" | ||
| append-timestamp="$(var append-timestamp)" | ||
| base-path="$(var base-path)" | ||
| append-trace="$(var append-trace)" | ||
|
|
@@ -421,6 +459,9 @@ def test_action_substitutions_frontend_yaml(self) -> None: | |
| - arg: | ||
| name: snapshot-mode | ||
| default: "false" | ||
| - arg: | ||
| name: dual-session | ||
| default: "false" | ||
| - arg: | ||
| name: append-timestamp | ||
| default: "false" | ||
|
|
@@ -444,6 +485,8 @@ def test_action_substitutions_frontend_yaml(self) -> None: | |
| default: "1048576" | ||
| - trace: | ||
| session-name: "$(var session-name)" | ||
| snapshot-mode: "$(var snapshot-mode)" | ||
| dual-session: "$(var dual-session)" | ||
| append-timestamp: "$(var append-timestamp)" | ||
| base-path: "$(var base-path)" | ||
| append-trace: "$(var append-trace)" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check the runtime trace data specifically as opposed to the whole trace, just to make sure the runtime trace contains what we think it should contain.
That means you can't use
topic_namehere, since that's from an init tracepoint (that wouldn't be recorded by the runtime trace, since it starts recording too late), and runtime events don't contain a lot of strings like topic names. I think you could instead check the trace event names using_name: