aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2025-03-24 11:29:57 -0700
committerGitHub <noreply@github.com>2025-03-24 11:29:57 -0700
commit8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc (patch)
tree7970990a618647edc5c644816f62e6193e8a0c6b
parent6c68cc4df1bfbb846e7724568a4cada61847c7f4 (diff)
downloadllvm-8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc.zip
llvm-8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc.tar.gz
llvm-8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc.tar.bz2
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: https://github.com/llvm/llvm-project/pull/132485
-rw-r--r--llvm/docs/CommandGuide/lit.rst2
-rw-r--r--llvm/utils/lit/lit/TestRunner.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst
index 8c0e275..812e1d8 100644
--- a/llvm/docs/CommandGuide/lit.rst
+++ b/llvm/docs/CommandGuide/lit.rst
@@ -100,7 +100,7 @@ OUTPUT OPTIONS
Each command is printed before it is executed. This can be valuable for
debugging test failures, as the last printed command is the one that failed.
- Moreover, :program:`lit` inserts ``'RUN: at line N'`` before each
+ Moreover, :program:`lit` inserts ``'RUN: at line N'`` after each
command pipeline in the output to help you locate the source line of
the failed command.
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 00432b8..dab83cb 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -1231,7 +1231,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
# the shell's execution trace for the 'set' commands by
# redirecting their stderr to /dev/null.
if command:
- msg = f"'{dbg}': {shlex.quote(command.lstrip())}"
+ msg = f"{shlex.quote(command.lstrip())} \\# '{dbg}'"
else:
msg = f"'{dbg}' has no command after substitutions"
commands[i] = (