Some fixes for Swarming bots
authorborenet <borenet@chromium.org>
Thu, 17 Mar 2016 16:01:33 +0000 (09:01 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 17 Mar 2016 16:01:33 +0000 (09:01 -0700)
BUG=skia:4763
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813443003

Review URL: https://codereview.chromium.org/1813443003

infra/bots/common.py
infra/bots/flavor/default_flavor.py
infra/bots/win_toolchain_utils.py

index b154ec4d6eb8812f7592ce6c1e8b47a1d05274a9..d4f317af4c845870fa897860adfef9ce622f1084 100644 (file)
@@ -7,6 +7,7 @@
 
 
 import contextlib
+import glob
 import math
 import os
 import psutil
@@ -33,8 +34,12 @@ CONFIG_RELEASE = 'Release'
 VALID_CONFIGS = (CONFIG_COVERAGE, CONFIG_DEBUG, CONFIG_RELEASE)
 
 BUILD_PRODUCTS_WHITELIST = [
-  'dm', 'dm.exe',
-  'nanobench', 'nanobench.exe',
+  'dm',
+  'dm.exe',
+  'nanobench',
+  'nanobench.exe',
+  '*.so',
+  '*.dll',
 ]
 
 GM_ACTUAL_FILENAME = 'actual-results.json'
@@ -256,11 +261,11 @@ class BotInfo(object):
       self.flavor.compile(t)
     dst = os.path.join(self.swarm_out_dir, 'out', self.configuration)
     os.makedirs(dst)
-    for f in BUILD_PRODUCTS_WHITELIST:
-      path = os.path.join(self.out_dir, self.configuration, f)
-      if os.path.exists(path):
-        print 'Copying build product %s' % path
-        shutil.copy(path, dst)
+    for pattern in BUILD_PRODUCTS_WHITELIST:
+      path = os.path.join(self.out_dir, self.configuration, pattern)
+      for f in glob.glob(path):
+          print 'Copying build product %s' % f
+          shutil.copy(f, dst)
     self.cleanup()
 
   def _run_once(self, fn, *args, **kwargs):
index 5933b6c3cf409139695036e707fc791bc1b6eb3b..5cf0eee85b2142e26160c89e7dbf2be7806909e9 100644 (file)
@@ -75,11 +75,13 @@ class DefaultFlavorUtils(object):
     """Runs a step as appropriate for this flavor."""
     path_to_app = os.path.join(self._bot_info.out_dir,
                                self._bot_info.configuration, cmd[0])
-    if (sys.platform == 'linux' and
+    if ('linux' in sys.platform and
         'x86_64' in self._bot_info.bot_name and
         not 'TSAN' in self._bot_info.bot_name):
       new_cmd = ['catchsegv', path_to_app]
     else:
+      if sys.platform == 'win32':
+        path_to_app += '.exe'
       new_cmd = [path_to_app]
     new_cmd.extend(cmd[1:])
     return self._bot_info.run(new_cmd, **kwargs)
index 43f62863cde3de8a457830d6339c50bc8bc47e4e..f8033e925bbdbd729199772d3adff95b38b35e05 100644 (file)
@@ -10,6 +10,8 @@
 
 
 import json
+import os
+import stat
 
 
 PLACEHOLDER = '<(TOOLCHAIN_BASE_DIR)'
@@ -36,6 +38,9 @@ def _replace(val, before, after):
 
 def _replace_in_file(filename, before, after):
   """Replace occurrences of one string with another within the file."""
+  # Make the file writeable, or the below won't work.
+  os.chmod(filename, stat.S_IWRITE)
+
   with open(filename) as f:
     contents = json.load(f)
   new_contents = _replace(contents, before, after)