[llvm] [lit] Fix missing command for external Windows shell (PR #116603)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 03:29:43 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Sven van Haastregt (svenvh)
<details>
<summary>Changes</summary>
On Windows, when using the external shell (.bat) the command to be executed is not generated. This is a regression introduced by https://reviews.llvm.org/D122569.
A command of the form `RUN: mycmd` is internally transformed into `dbg(line XX) mycmd`. Previously `dbg()` was substituted by `echo \\1 && `, with `\\1` matching the content of `dbg()`, in the string containing the command to be executed. The new code relies on `str.expand()` which correctly expands `\\1`, but as the template does not reference the command at all, it is lost. The generated .bat file is invalid as there is nothing after the last `&&`.
Fix by appending the command as is done for the common case further down (line 1257).
---
Full diff: https://github.com/llvm/llvm-project/pull/116603.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/TestRunner.py (+2)
``````````diff
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 00432b8d317784..d6a0d26b470436 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -1216,6 +1216,8 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
commands[i] = match.expand(
"echo '\\1' > nul && " if command else "echo '\\1' > nul"
)
+ if command:
+ commands[i] += command
f.write("@echo on\n")
f.write("\n at if %ERRORLEVEL% NEQ 0 EXIT\n".join(commands))
else:
``````````
</details>
https://github.com/llvm/llvm-project/pull/116603
More information about the llvm-commits
mailing list