[PATCH] D154984: [lit] Drop "Script:", make -v and -a imply -vv
Joel E. Denny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 27 10:49:34 PDT 2023
jdenny added a comment.
In D154984#4537086 <https://reviews.llvm.org/D154984#4537086>, @jdenny wrote:
> What if we put the output in shell comments so it has no effect when pasted into a terminal?
Here's an example of what I mean, but we can certainly tweak more:
echo hello world
# command stdout
# hello world
echo goodbye world
# command stdout
# goodbye world
I found I can copy and paste that entire text into a terminal, and just the actual command lines execute, as desired.
In D154984#4539495 <https://reviews.llvm.org/D154984#4539495>, @awarzynski wrote:
> Personally, I mostly care about being able to copy & paste the command. "Script" (in the output) is nice as it makes finding `RUN` lines easy, but it's definitely not a show-stopper.
Would the above work for you?
In D154984#4539495 <https://reviews.llvm.org/D154984#4539495>, @awarzynski wrote:
> I don't quite follow the "internal vs external shell" argument - could you explain? Why can't we make this work with both internal _and_ external shell?
To execute RUN lines, lit can use its own internal shell, which is written in python. As lit developers, we have complete control over how it formats execution traces.
Alternatively, lit can use external shells, such as `cmd` for windows or `bash`/`sh` for unix. In those cases, lit uses the external shell's debug features, such as `@echo on` or `set -x`. I just checked the `sh` standard, and I now see that the `PS4` variable controls the prefix (defaults to `+`) printed before a command. If the format we settle on requires no changes beyond that, then we're probably fine. However, I don't yet know how to prevent it from breaking apart pipelines into separate commands. I don't yet know how to prevent it from mixing the commands and their stderr (where it prints the commands). I don't yet know how to control windows.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154984/new/
https://reviews.llvm.org/D154984
More information about the llvm-commits
mailing list