import contextlib
+import glob
import math
import os
import psutil
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'
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):
"""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)
import json
+import os
+import stat
PLACEHOLDER = '<(TOOLCHAIN_BASE_DIR)'
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)