Skip to content
Snippets Groups Projects
Commit cb4bfb34 authored by Daniel Dunbar's avatar Daniel Dunbar
Browse files

[lit] Fix internal shell's argv[0] handling.

 - At least on OS X, it is important for correct behavior of /bin/[ that argv[0]
   is passed as written, and not as the full executable path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189559 91177308-0d34-0410-b5e6-96231b3b80d8
parent 4ac723b5
No related branches found
No related tags found
No related merge requests found
......@@ -131,8 +131,8 @@ def executeShCmd(cmd, cfg, cwd, results):
# Resolve the executable path ourselves.
args = list(j.args)
args[0] = lit.util.which(args[0], cfg.environment['PATH'])
if not args[0]:
executable = lit.util.which(args[0], cfg.environment['PATH'])
if not executable:
raise InternalShellError(j, '%r: command not found' % j.args[0])
# Replace uses of /dev/null with temporary files.
......@@ -145,6 +145,7 @@ def executeShCmd(cmd, cfg, cwd, results):
args[i] = f.name
procs.append(subprocess.Popen(args, cwd=cwd,
executable = executable,
stdin = stdin,
stdout = stdout,
stderr = stderr,
......
......@@ -7,6 +7,7 @@
# CHECK: -- Testing:
# CHECK: PASS: shtest-format :: argv0.txt
# CHECK: FAIL: shtest-format :: external_shell/fail.txt
# CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED ***
# CHECK: Command Output (stdout):
......@@ -68,7 +69,7 @@
# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
# CHECK: shtest-format :: fail.txt
# CHECK: Expected Passes : 3
# CHECK: Expected Passes : 4
# CHECK: Expected Failures : 3
# CHECK: Unsupported Tests : 2
# CHECK: Unresolved Tests : 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment