[libcxx-commits] [libcxx] fd667b8 - [libcxx] [test] Run `chmod +x` on executables when testing via SSH
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 25 09:47:52 PDT 2019
Author: Louis Dionne
Date: 2019-10-25T09:47:46-07:00
New Revision: fd667b860e9d0fc3714980e26e8c0ed719c19677
URL: https://github.com/llvm/llvm-project/commit/fd667b860e9d0fc3714980e26e8c0ed719c19677
DIFF: https://github.com/llvm/llvm-project/commit/fd667b860e9d0fc3714980e26e8c0ed719c19677.diff
LOG: [libcxx] [test] Run `chmod +x` on executables when testing via SSH
When running libc++ tests on a remote machine via SSH, we can encounter
a 'Permission denied' error.
Fix this with plain old 'chmod +x <executable>'.
Thanks to Sergej Jaskiewicz for the patch.
Differential Revision: https://reviews.llvm.org/D69170
Added:
Modified:
libcxx/utils/libcxx/test/executor.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/executor.py b/libcxx/utils/libcxx/test/executor.py
index 5bb5525d047c..4581ce7a19be 100644
--- a/libcxx/utils/libcxx/test/executor.py
+++ b/libcxx/utils/libcxx/test/executor.py
@@ -135,10 +135,18 @@ def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
srcs.extend(file_deps)
dsts.extend(dev_paths)
self.copy_in(srcs, dsts)
+
+ # When testing executables that were cross-compiled on Windows for
+ # Linux, we may need to explicitly set the execution permission to
+ # avoid the 'Permission denied' error:
+ chmod_cmd = ['chmod', '+x', target_exe_path]
+
# TODO(jroelofs): capture the copy_in and delete_remote commands,
# and conjugate them with '&&'s around the first tuple element
# returned here:
- return self._execute_command_remote(cmd, target_cwd, env)
+ return self._execute_command_remote(chmod_cmd + ['&&'] + cmd,
+ target_cwd,
+ env)
finally:
if target_cwd:
self.delete_remote(target_cwd)
@@ -187,10 +195,14 @@ def _execute_command_remote(self, cmd, remote_work_dir='.', env=None):
remote = self.user_prefix + self.host
ssh_cmd = [self.ssh_command, '-oBatchMode=yes', remote]
if env:
- env_cmd = ['env'] + ['%s="%s"' % (k, v) for k, v in env.items()]
+ export_cmd = \
+ ['export'] + ['"%s"="%s"' % (k, v) for k, v in env.items()]
else:
- env_cmd = []
- remote_cmd = ' '.join(env_cmd + cmd)
+ export_cmd = []
+
+ remote_cmd = ' '.join(cmd)
+ if export_cmd:
+ remote_cmd = ' '.join(export_cmd) + ' && ' + remote_cmd
if remote_work_dir != '.':
remote_cmd = 'cd ' + remote_work_dir + ' && ' + remote_cmd
out, err, rc = self.local_run(ssh_cmd + [remote_cmd])
More information about the libcxx-commits
mailing list