Skip to content

Commit 45ff976

Browse files
committed
[lit] Fix to make "RUN: env PATH=..." work as intended
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 57782ef, 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.
1 parent 86cd1df commit 45ff976

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
945945
path = (
946946
cmd_shenv.env["PATH"] if "PATH" in cmd_shenv.env else shenv.env["PATH"]
947947
)
948-
executable = lit.util.which(args[0], shenv.env["PATH"])
948+
executable = lit.util.which(args[0], path)
949949
if not executable:
950950
raise InternalShellError(j, "%r: command not found" % args[0])
951951

0 commit comments

Comments
 (0)