Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/api.py

Issue 2105873004: chromium_tests: set cwd to directory containing checkout for tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | scripts/slave/recipes/chromium.expected/full_chromium_fyi_Linux_remote_run_Tester.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import contextlib 6 import contextlib
7 import copy 7 import copy
8 import itertools 8 import itertools
9 import json 9 import json
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 }) 43 })
44 44
45 45
46 class ChromiumTestsApi(recipe_api.RecipeApi): 46 class ChromiumTestsApi(recipe_api.RecipeApi):
47 def __init__(self, *args, **kwargs): 47 def __init__(self, *args, **kwargs):
48 super(ChromiumTestsApi, self).__init__(*args, **kwargs) 48 super(ChromiumTestsApi, self).__init__(*args, **kwargs)
49 self._builders = {} 49 self._builders = {}
50 self.add_builders(builders.BUILDERS) 50 self.add_builders(builders.BUILDERS)
51 self._precommit_mode = False 51 self._precommit_mode = False
52 52
53 # Keep track of working directory (which contains the checkout).
54 # None means "default value".
55 self._working_dir = None
56
53 @property 57 @property
54 def builders(self): 58 def builders(self):
55 return self._builders 59 return self._builders
56 60
57 @property 61 @property
58 def steps(self): 62 def steps(self):
59 return steps 63 return steps
60 64
61 @property 65 @property
62 def trybots(self): 66 def trybots(self):
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 builder_cache = self.m.path['builder_cache'] 163 builder_cache = self.m.path['builder_cache']
160 except KeyError: # no-op if builder cache is not set up. 164 except KeyError: # no-op if builder cache is not set up.
161 pass 165 pass
162 else: 166 else:
163 sanitized_buildername = ''.join( 167 sanitized_buildername = ''.join(
164 c if c.isalnum() else '_' for c in self.m.properties['buildername']) 168 c if c.isalnum() else '_' for c in self.m.properties['buildername'])
165 checkout_path = builder_cache.join( 169 checkout_path = builder_cache.join(
166 bot_config.get('checkout_dir', sanitized_buildername)) 170 bot_config.get('checkout_dir', sanitized_buildername))
167 self.m.shutil.makedirs('checkout path', checkout_path) 171 self.m.shutil.makedirs('checkout path', checkout_path)
168 kwargs['cwd'] = checkout_path 172 kwargs['cwd'] = checkout_path
173 self._working_dir = checkout_path
169 174
170 # Bot Update re-uses the gclient configs. 175 # Bot Update re-uses the gclient configs.
171 update_step = self.m.bot_update.ensure_checkout( 176 update_step = self.m.bot_update.ensure_checkout(
172 patch_root=bot_config.get('patch_root'), 177 patch_root=bot_config.get('patch_root'),
173 root_solution_revision=root_solution_revision, 178 root_solution_revision=root_solution_revision,
174 clobber=bot_config.get('clobber', False), 179 clobber=bot_config.get('clobber', False),
175 force=force, **kwargs) 180 force=force, **kwargs)
176 assert update_step.json.output['did_run'] 181 assert update_step.json.output['did_run']
177 # HACK(dnj): Remove after 'crbug.com/398105' has landed 182 # HACK(dnj): Remove after 'crbug.com/398105' has landed
178 self.m.chromium.set_build_properties(update_step.json.output['properties']) 183 self.m.chromium.set_build_properties(update_step.json.output['properties'])
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 517
513 def _make_legacy_build_url(self, master_config, mastername): 518 def _make_legacy_build_url(self, master_config, mastername):
514 return self.m.archive.legacy_download_url( 519 return self.m.archive.legacy_download_url(
515 master_config.get('build_gs_bucket'), 520 master_config.get('build_gs_bucket'),
516 extra_url_components=( 521 extra_url_components=(
517 None if mastername.startswith('chromium.perf') 522 None if mastername.startswith('chromium.perf')
518 else self.m.properties['mastername'])) 523 else self.m.properties['mastername']))
519 524
520 @contextlib.contextmanager 525 @contextlib.contextmanager
521 def wrap_chromium_tests(self, bot_config, tests=None): 526 def wrap_chromium_tests(self, bot_config, tests=None):
522 with self.m.step.context({'env': self.m.chromium.get_env()}): 527 context = {'env': self.m.chromium.get_env()}
528 # TODO(phajdan.jr): Enable globally after confirming it works.
529 if bot_config.matches_any_bot_id(
530 lambda bot_id: 'remote_run' in bot_id['buildername'] or
531 'remote_run' in bot_id.get('tester', '')):
532 context['cwd'] = self._working_dir
533 with self.m.step.context(context):
523 bot_type = bot_config.get('bot_type', 'builder_tester') 534 bot_type = bot_config.get('bot_type', 'builder_tester')
524 535
525 if bot_type in ('tester', 'builder_tester'): 536 if bot_type in ('tester', 'builder_tester'):
526 isolated_targets = [ 537 isolated_targets = [
527 t.isolate_target(self.m) for t in tests if t.uses_swarming] 538 t.isolate_target(self.m) for t in tests if t.uses_swarming]
528 if isolated_targets: 539 if isolated_targets:
529 self.m.isolate.find_isolated_tests(self.m.chromium.output_dir) 540 self.m.isolate.find_isolated_tests(self.m.chromium.output_dir)
530 541
531 if bot_type == 'tester': 542 if bot_type == 'tester':
532 if (self.m.chromium.c.TARGET_PLATFORM == 'android' and 543 if (self.m.chromium.c.TARGET_PLATFORM == 'android' and
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 def get_compile_targets_for_scripts(self): 840 def get_compile_targets_for_scripts(self):
830 return self.m.python( 841 return self.m.python(
831 name='get compile targets for scripts', 842 name='get compile targets for scripts',
832 script=self.m.path['checkout'].join( 843 script=self.m.path['checkout'].join(
833 'testing', 'scripts', 'get_compile_targets.py'), 844 'testing', 'scripts', 'get_compile_targets.py'),
834 args=[ 845 args=[
835 '--output', self.m.json.output(), 846 '--output', self.m.json.output(),
836 '--', 847 '--',
837 ] + self.get_common_args_for_scripts(), 848 ] + self.get_common_args_for_scripts(),
838 step_test_data=lambda: self.m.json.test_api.output({})) 849 step_test_data=lambda: self.m.json.test_api.output({}))
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipes/chromium.expected/full_chromium_fyi_Linux_remote_run_Tester.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698