Revert "Revert "Merge to upstream r304942.""

This reverts commit 38a0d5af7e.

Test: make checkbuild
Test: ./run_tests.py
Test: ./run_tests.py --bitness 64
This commit is contained in:
Dan Albert
2018-01-17 14:21:02 -08:00
parent 38a0d5af7e
commit c79549b70e
1102 changed files with 19092 additions and 14798 deletions

View File

@@ -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.
@@ -196,7 +171,7 @@ class SSHExecutor(RemoteExecutor):
# Not sure how to do suffix on osx yet
dir_arg = '-d' if is_dir else ''
cmd = 'mktemp -q {} /tmp/libcxx.XXXXXXXXXX'.format(dir_arg)
temp_path, err, exitCode = self._execute_command_remote([cmd])
_, temp_path, err, exitCode = self._execute_command_remote([cmd])
temp_path = temp_path.strip()
if exitCode != 0:
raise RuntimeError(err)
@@ -219,4 +194,5 @@ class SSHExecutor(RemoteExecutor):
remote_cmd = ' '.join(env_cmd + cmd)
if remote_work_dir != '.':
remote_cmd = 'cd ' + remote_work_dir + ' && ' + remote_cmd
return self.local_run(ssh_cmd + [remote_cmd])
out, err, rc = self.local_run(ssh_cmd + [remote_cmd])
return (remote_cmd, out, err, rc)