[llvm] [lit] Fix to make "RUN: env PATH=..." work as intended (PR #165308)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 27 12:56:41 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Björn Pettersson (bjope)
<details>
<summary>Changes</summary>
There was a bug in llvm-lit related to setting PATH using env in the internal shell.
The new PATH wasn't used when looking up the command to be executed. So when doing things like this in a test case
RUN: mkdir %t
RUN: env PATH=%t program ...
the internal shell would search for "program" using the orignal PATH and not the PATH set by env when preceeding the command.
It seems like this was a simple mistake in commit 57782eff31e9d454, since the logic to pick a PATH from the cmd_shenv instead of shenv actually was added in that patch, but the resulting path wasn't used.
---
Full diff: https://github.com/llvm/llvm-project/pull/165308.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/TestRunner.py (+1-1)
``````````diff
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index f88314547bb3f..9fba96a1471a0 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -945,7 +945,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
path = (
cmd_shenv.env["PATH"] if "PATH" in cmd_shenv.env else shenv.env["PATH"]
)
- executable = lit.util.which(args[0], shenv.env["PATH"])
+ executable = lit.util.which(args[0], path)
if not executable:
raise InternalShellError(j, "%r: command not found" % args[0])
``````````
</details>
https://github.com/llvm/llvm-project/pull/165308
More information about the llvm-commits
mailing list