[PATCH] Copy data files to the remote runner.

Dan Albert danalbert at google.com
Tue Mar 10 13:38:00 PDT 2015


Make determining file dependencies the caller's responsibility.


http://reviews.llvm.org/D8118

Files:
  test/libcxx/test/executor.py
  test/libcxx/test/format.py

Index: test/libcxx/test/executor.py
===================================================================
--- test/libcxx/test/executor.py
+++ test/libcxx/test/executor.py
@@ -6,7 +6,7 @@
 
 
 class Executor(object):
-    def run(self, exe_path, cmd, local_cwd, env=None):
+    def run(self, exe_path, cmd, local_cwd, file_deps=None, env=None):
         """Execute a command.
             Be very careful not to change shared state in this function.
             Executor objects are shared between python processes in `lit -jN`.
@@ -25,7 +25,7 @@
     def __init__(self):
         super(LocalExecutor, self).__init__()
 
-    def run(self, exe_path, cmd=None, work_dir='.', env=None):
+    def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
         cmd = cmd or [exe_path]
         env_cmd = []
         if env:
@@ -48,10 +48,10 @@
         self.commandPrefix = commandPrefix
         self.chain = chain
 
-    def run(self, exe_path, cmd=None, work_dir='.', env=None):
+    def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
         cmd = cmd or [exe_path]
         return self.chain.run(exe_path, self.commandPrefix + cmd, work_dir,
-                              env=env)
+                              file_deps, env=env)
 
 
 class PostfixExecutor(Executor):
@@ -62,9 +62,10 @@
         self.commandPostfix = commandPostfix
         self.chain = chain
 
-    def run(self, exe_path, cmd=None, work_dir='.', env=None):
+    def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
         cmd = cmd or [exe_path]
-        return self.chain.run(cmd + self.commandPostfix, work_dir, env=env)
+        return self.chain.run(cmd + self.commandPostfix, work_dir, file_deps,
+                              env=env)
 
 
 
@@ -107,24 +108,25 @@
             # TODO: Log failure to delete?
             pass
 
-    def run(self, exe_path, cmd=None, work_dir='.', env=None):
+    def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
         target_exe_path = None
         target_cwd = None
         try:
-            target_exe_path = self.remote_temp_file()
             target_cwd = self.remote_temp_dir()
+            target_exe_path = os.path.join(target_cwd, 'libcxx_test')
             if cmd:
                 # Replace exe_path with target_exe_path.
                 cmd = [c if c != exe_path else target_exe_path for c in cmd]
             else:
                 cmd = [target_exe_path]
+
             self.copy_in([exe_path], [target_exe_path])
+            for file_dep in file_deps:
+                file_basename = os.path.basename(file_dep)
+                dev_path = os.path.join(target_cwd, file_basename)
+                self._copy_in_file(file_dep, dev_path)
             return self._execute_command_remote(cmd, target_cwd, env)
-        except:
-            raise
         finally:
-            if target_exe_path:
-                self.delete_remote(target_exe_path)
             if target_cwd:
                 self.delete_remote(target_cwd)
 
Index: test/libcxx/test/format.py
===================================================================
--- test/libcxx/test/format.py
+++ test/libcxx/test/format.py
@@ -115,8 +115,10 @@
             env = None
             if self.exec_env:
                 env = self.exec_env
+            data_files = [os.path.join(local_cwd, f)
+                          for f in os.listdir(local_cwd) if f.endswith('.dat')]
             out, err, rc = self.executor.run(exec_path, [exec_path],
-                                             local_cwd, env)
+                                             local_cwd, data_files, env)
             if rc != 0:
                 report = libcxx.util.makeReport(cmd, out, err, rc)
                 report = "Compiled With: %s\n%s" % (compile_cmd, report)

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8118.21628.patch
Type: text/x-patch
Size: 3839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150310/3c101d41/attachment.bin>


More information about the cfe-commits mailing list