Skip to content
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

Error out if trace already exists unless 'append' option is used #58

Conversation

christophebedard
Copy link
Member

@christophebedard christophebedard commented Apr 10, 2023

Closes #12

This makes the ros2 trace command and the Trace launch action fail if the trace already exists, unless the --append-trace or append_trace/append-trace option is used, respectively. Example:

$ ros2 trace -s 'my-trace'  # Generate trace
UST tracing enabled (28 events)
kernel tracing disabled
context (3 fields)
writing tracing session to: /home/chris/.ros/tracing/my-trace
press enter to start...
press enter to stop...
stopping & destroying tracing session
$ ros2 trace -s 'my-trace'  # Mistakenly append to existing trace, error out
UST tracing enabled (28 events)
kernel tracing disabled
context (3 fields)
writing tracing session to: /home/chris/.ros/tracing/my-trace
press enter to start...
error: trace directory already exists, use the append option to append to it: /home/chris/.ros/tracing/my-trace
$ ros2 trace -s 'my-trace' --append-trace   # Use '--append-trace' option, all good
UST tracing enabled (28 events)
kernel tracing disabled
context (3 fields)
writing tracing session to: /home/chris/.ros/tracing/my-trace
press enter to start...
press enter to stop...
stopping & destroying tracing session

I've also added tests to cover it in both ros2trace and test_tracetools_launch. I added a simple test for the existing append_timestamp Trace launch action option to test_tracetools_launch as well.

Signed-off-by: Christophe Bedard christophe.bedard@apex.ai

@christophebedard christophebedard added the enhancement New feature or request label Apr 10, 2023
@christophebedard christophebedard self-assigned this Apr 10, 2023
@christophebedard christophebedard marked this pull request as draft April 10, 2023 20:49
@christophebedard christophebedard force-pushed the christophebedard/error-if-trace-directory-already-exists branch 2 times, most recently from 618994e to a1fc567 Compare April 12, 2023 18:03
@christophebedard christophebedard force-pushed the christophebedard/error-if-trace-directory-already-exists branch 3 times, most recently from cc77af0 to 7699d9a Compare April 17, 2023 23:42
And add test for existing append_timestamp Trace launch action option.

Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
@christophebedard christophebedard marked this pull request as ready for review April 18, 2023 01:28
@christophebedard christophebedard force-pushed the christophebedard/error-if-trace-directory-already-exists branch from 7699d9a to 403b306 Compare April 18, 2023 01:29
@christophebedard
Copy link
Member Author

Testing --packages-above ros2trace tracetools_launch tracetools_trace:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with green CI!

@christophebedard christophebedard changed the title Error out if trace already exists unless 'append trace' option is used Error out if trace already exists unless 'append' option is used Apr 18, 2023
@christophebedard christophebedard merged commit 4521aa6 into rolling Apr 18, 2023
8 checks passed
@christophebedard christophebedard deleted the christophebedard/error-if-trace-directory-already-exists branch April 18, 2023 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn if trace directory already exists when using tracing tools/commands
2 participants