diff options
author | borenet <borenet@chromium.org> | 2016-03-16 07:27:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-16 07:27:05 -0700 |
commit | 523fa2a332d9c621bb871337893270a2bde31ea1 (patch) | |
tree | 4efbb7f264c1da5d6df8cf6c492c8b780a47c7ab /infra | |
parent | 8749cfa2ca92665648b657b8dfeee5a3236538c9 (diff) |
Fix compile on Windows swarming bot
BUG=skia:4763
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1791513002
Review URL: https://codereview.chromium.org/1791513002
Diffstat (limited to 'infra')
-rw-r--r-- | infra/bots/common.py | 24 | ||||
-rw-r--r-- | infra/bots/flavor/default_flavor.py | 16 | ||||
-rw-r--r-- | infra/bots/skia_repo.isolate | 3 |
3 files changed, 39 insertions, 4 deletions
diff --git a/infra/bots/common.py b/infra/bots/common.py index 5900090daf..b154ec4d6e 100644 --- a/infra/bots/common.py +++ b/infra/bots/common.py @@ -9,6 +9,7 @@ import contextlib import math import os +import psutil import shutil import socket import subprocess @@ -157,15 +158,24 @@ class BotInfo(object): self.swarm_out_dir = swarm_out_dir os.chdir(self.skia_dir) self.build_dir = os.path.abspath(os.path.join(self.skia_dir, os.pardir)) + self.infrabots_dir = os.path.join(self.skia_dir, 'infra', 'bots') + self.home_dir = os.path.expanduser('~') + self.spec = self.get_bot_spec(bot_name) self.bot_cfg = self.spec['builder_cfg'] self.out_dir = os.path.join(os.pardir, 'out') self.configuration = self.spec['configuration'] self.default_env = { + 'CHROME_HEADLESS': '1', 'SKIA_OUT': self.out_dir, 'BUILDTYPE': self.configuration, 'PATH': os.environ['PATH'], } + if 'Win' in self.bot_cfg['os']: + self.default_env['SystemRoot'] = 'C:\\Windows' + self.default_env['TEMP'] = os.path.join( + self.home_dir, 'AppData', 'Local', 'Temp') + self.default_env['TMP'] = self.default_env['TEMP'] self.default_env.update(self.spec['env']) self.build_targets = [str(t) for t in self.spec['build_targets']] self.is_trybot = self.bot_cfg['is_trybot'] @@ -251,6 +261,7 @@ class BotInfo(object): if os.path.exists(path): print 'Copying build product %s' % path shutil.copy(path, dst) + self.cleanup() def _run_once(self, fn, *args, **kwargs): if not fn.__name__ in self._already_ran: @@ -383,7 +394,7 @@ class BotInfo(object): preAbandonGpuContext.append('--preAbandonGpuContext') self.flavor.run(preAbandonGpuContext) - self.flavor.cleanup_steps() + self.cleanup() def perf_steps(self, got_revision, master_name, slave_name, build_number, issue=None, patchset=None): @@ -462,4 +473,15 @@ class BotInfo(object): self.flavor.copy_directory_contents_to_host( self.device_dirs.perf_data_dir, self.perf_data_dir) + self.cleanup() + + def cleanup(self): + if sys.platform == 'win32': + # Kill mspdbsrv.exe, which tends to hang around after the build finishes. + for p in psutil.process_iter(): + try: + if p.name == 'mspdbsrv.exe': + p.kill() + except psutil._error.AccessDenied: + pass self.flavor.cleanup_steps() diff --git a/infra/bots/flavor/default_flavor.py b/infra/bots/flavor/default_flavor.py index 3603f043aa..5933b6c3cf 100644 --- a/infra/bots/flavor/default_flavor.py +++ b/infra/bots/flavor/default_flavor.py @@ -69,7 +69,7 @@ class DefaultFlavorUtils(object): """ def __init__(self, bot_info, *args, **kwargs): self._bot_info = bot_info - self.chrome_path = os.path.join(os.path.expanduser('~'), 'src') + self.chrome_path = os.path.join(self._bot_info.build_dir, 'src') def run(self, cmd, **kwargs): """Runs a step as appropriate for this flavor.""" @@ -84,14 +84,26 @@ class DefaultFlavorUtils(object): new_cmd.extend(cmd[1:]) return self._bot_info.run(new_cmd, **kwargs) + def bootstrap_win_toolchain(self): + """Run bootstrapping script for the Windows toolchain.""" + bootstrap_script = os.path.join(self._bot_info.infrabots_dir, + 'bootstrap_win_toolchain_json.py') + win_toolchain_json = os.path.join( + self._bot_info.build_dir, 'src', 'build', 'win_toolchain.json') + self._bot_info.run([ + 'python', bootstrap_script, + '--win_toolchain_json', win_toolchain_json, + '--depot_tools_parent_dir', self._bot_info.build_dir]) def compile(self, target): """Build the given target.""" # The CHROME_PATH environment variable is needed for bots that use # toolchains downloaded by Chrome. - env = {'CHROME_PATH': self.chrome_path} + env = {} if sys.platform == 'win32': make_cmd = ['python', 'make.py'] + env['CHROME_PATH'] = self.chrome_path + self._bot_info._run_once(self.bootstrap_win_toolchain) else: make_cmd = ['make'] cmd = make_cmd + [target] diff --git a/infra/bots/skia_repo.isolate b/infra/bots/skia_repo.isolate index 7410388b3f..f07a60b65a 100644 --- a/infra/bots/skia_repo.isolate +++ b/infra/bots/skia_repo.isolate @@ -1,7 +1,8 @@ { 'variables': { 'files': [ - '../../', + '../../../.gclient', + '../../../skia/', ], }, } |