Clean up LIT failure output by not showing the entire environment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302713 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,36 +38,11 @@ class LocalExecutor(Executor):
|
||||
|
||||
def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
|
||||
cmd = cmd or [exe_path]
|
||||
env_cmd = []
|
||||
if env:
|
||||
env_cmd += ['env']
|
||||
env_cmd += ['%s=%s' % (k, v) for k, v in env.items()]
|
||||
if work_dir == '.':
|
||||
work_dir = os.getcwd()
|
||||
if not self.is_windows:
|
||||
out, err, rc = executeCommand(env_cmd + cmd, cwd=work_dir)
|
||||
else:
|
||||
out, err, rc = executeCommand(cmd, cwd=work_dir,
|
||||
env=self._build_windows_env(env))
|
||||
return (env_cmd + cmd, out, err, rc)
|
||||
out, err, rc = executeCommand(cmd, cwd=work_dir, env=env)
|
||||
return (cmd, out, err, rc)
|
||||
|
||||
def _build_windows_env(self, exec_env):
|
||||
# FIXME: Finding Windows DLL's at runtime requires modifying the
|
||||
# PATH environment variables. However we don't want to print out
|
||||
# the entire PATH as part of the diagnostic for every failing test.
|
||||
# Therefore this hack builds a new executable environment that
|
||||
# merges the current environment and the supplied environment while
|
||||
# still only printing the supplied environment in diagnostics.
|
||||
if not self.is_windows or exec_env is None:
|
||||
return None
|
||||
new_env = dict(os.environ)
|
||||
for key, value in exec_env.items():
|
||||
if key == 'PATH':
|
||||
assert value.strip() != '' and "expected non-empty path"
|
||||
new_env['PATH'] = "%s;%s" % (value, os.environ['PATH'])
|
||||
else:
|
||||
new_env[key] = value
|
||||
return new_env
|
||||
|
||||
class PrefixExecutor(Executor):
|
||||
"""Prefix an executor with some other command wrapper.
|
||||
|
||||
Reference in New Issue
Block a user