rr
rr copied to clipboard
Add `--save-as` param to record
--save-as
specifies the trace dir name (basename?), not the full path.
Merged output_trace_dir
in RecordFlags with name
into new type TraceOutputPath
.
Changed all usage of output_trace_dir
string to use this type instead.
This PR is backwards compatible, in the sense that the old usage of the -o
flag remains the same, if --save-as
is not provided, i.e., will error out, if dir exists etc. If --save-as
is provided together with -o
the new behavior will happen instead, where the output dir will be the "root dir", thus, the user can save many traces there.
If only --save-as
is provided, record uses normal behavior, of setting the trace root dir to $RR_TRACE_DIR (or it's user provided env var).
Naming of user provided dirs, follows old behavior, i.e. appending -0, -1, -2 etc to the trace dir. I think this is preferable - if some automated thing is recording something with a specific name provided, this makes it so the end user don't have to manage the file system (i.e. checking if that name is "taken" and having to do clean up before recording, etc.) - especially since there's kind of functionality for that, already existing (just using the -o
on it's own, though you have to specify a path, not a name)
As a side note @khuey & @rocallahan - I noticed that in the RecordFlags
-s
is sort of taken - though it's not parsed by the option parsing logic. It's used for always_switch
- but if it's not parsed in the option parsing logic, how can it ever be set?
I had originally intended the --save-as
to have -s
as a short, when I found that it was being used (but not being parsed). Perhaps this needs fixing?
though it's not parsed by the option parsing logic
Why do you think it's not parsed?
though it's not parsed by the option parsing logic
Why do you think it's not parsed?
Never mind. I had entirely missed that it was specified in the OptionSpec. And I even grepped for it last night. goes to show, don't do things if you're tired. :stuck_out_tongue:
Either way, I had asked Roc about a feature like this and if it would be acceptable as a PR. I can think of at least one use case where this would be useful, where RR is used to record failing tests (automatically) and being able to specify a name, instead of just the application name (and instead of just a path, that has to be unique) and he OK'd it on Matrix. Let me know what you think of the PR.
@theIDinside Would you mind rebasing this PR so it is more easily tested and integrated?
@theIDinside Would you mind rebasing this PR so it is more easily tested and integrated?
Absolutely. I need to do the same with another PR so I will do that after work or this weekend.
@theIDinside Would you mind rebasing this PR so it is more easily tested and integrated?
@GitMensch Rebased & added tests for good measure.
I screwed this one up. I will re-send PR.