Skip to content

Commit 8d3dc1e

Browse files
authored
lit: Move RUN at line comment after the command.
When a developer copy/pastes a failing command line into their shell to rerun it, they have to manually delete the "RUN: at line N:" prefix. To make life easier for such developers, let's make it possible to copy/paste a command without needing to modify it while still showing the line number in the output by moving the line number to a comment at the end of the command line. Reviewers: jroelofs, MaskRay Reviewed By: jroelofs, MaskRay Pull Request: #132485
1 parent 6c68cc4 commit 8d3dc1e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/docs/CommandGuide/lit.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ OUTPUT OPTIONS
100100

101101
Each command is printed before it is executed. This can be valuable for
102102
debugging test failures, as the last printed command is the one that failed.
103-
Moreover, :program:`lit` inserts ``'RUN: at line N'`` before each
103+
Moreover, :program:`lit` inserts ``'RUN: at line N'`` after each
104104
command pipeline in the output to help you locate the source line of
105105
the failed command.
106106

llvm/utils/lit/lit/TestRunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
12311231
# the shell's execution trace for the 'set' commands by
12321232
# redirecting their stderr to /dev/null.
12331233
if command:
1234-
msg = f"'{dbg}': {shlex.quote(command.lstrip())}"
1234+
msg = f"{shlex.quote(command.lstrip())} \\# '{dbg}'"
12351235
else:
12361236
msg = f"'{dbg}' has no command after substitutions"
12371237
commands[i] = (

0 commit comments

Comments
 (0)