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

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

Issue 1185693002: Move builders.py and steps.py to chromium_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Address review comments. Created 5 years, 6 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 re 5 import re
6 6
7 from recipe_engine import recipe_api 7 from recipe_engine import recipe_api
8 from recipe_engine import util as recipe_util 8 from recipe_engine import util as recipe_util
9 9
10 from . import builders
11 from . import steps
12
13 class TestLauncherFilterFileInputPlaceholder(recipe_util.Placeholder): 10 class TestLauncherFilterFileInputPlaceholder(recipe_util.Placeholder):
14 def __init__(self, api, tests): 11 def __init__(self, api, tests):
15 self.raw = api.m.raw_io.input('\n'.join(tests)) 12 self.raw = api.m.raw_io.input('\n'.join(tests))
16 super(TestLauncherFilterFileInputPlaceholder, self).__init__() 13 super(TestLauncherFilterFileInputPlaceholder, self).__init__()
17 14
18 def render(self, test): 15 def render(self, test):
19 result = self.raw.render(test) 16 result = self.raw.render(test)
20 if not test.enabled: # pragma: no cover 17 if not test.enabled: # pragma: no cover
21 result[0] = '--test-launcher-filter-file=%s' % result[0] 18 result[0] = '--test-launcher-filter-file=%s' % result[0]
22 return result 19 return result
23 20
24 def result(self, presentation, test): 21 def result(self, presentation, test):
25 return self.raw.result(presentation, test) 22 return self.raw.result(presentation, test)
26 23
27 24
28 class ChromiumApi(recipe_api.RecipeApi): 25 class ChromiumApi(recipe_api.RecipeApi):
29 def __init__(self, *args, **kwargs): 26 def __init__(self, *args, **kwargs):
30 super(ChromiumApi, self).__init__(*args, **kwargs) 27 super(ChromiumApi, self).__init__(*args, **kwargs)
31 self._build_properties = None 28 self._build_properties = None
32 self._builders = {}
33 self.add_builders(builders.BUILDERS)
34 29
35 def get_config_defaults(self): 30 def get_config_defaults(self):
36 return { 31 return {
37 'HOST_PLATFORM': self.m.platform.name, 32 'HOST_PLATFORM': self.m.platform.name,
38 'HOST_ARCH': self.m.platform.arch, 33 'HOST_ARCH': self.m.platform.arch,
39 'HOST_BITS': self.m.platform.bits, 34 'HOST_BITS': self.m.platform.bits,
40 35
41 'TARGET_PLATFORM': self.m.platform.name, 36 'TARGET_PLATFORM': self.m.platform.name,
42 'TARGET_ARCH': self.m.platform.arch, 37 'TARGET_ARCH': self.m.platform.arch,
43 'TARGET_CROS_BOARD': None, 38 'TARGET_CROS_BOARD': None,
(...skipping 18 matching lines...) Expand all
62 if self.c.env.PATH: 57 if self.c.env.PATH:
63 ret['PATH'] = self.m.path.pathsep.join( 58 ret['PATH'] = self.m.path.pathsep.join(
64 map(str, self.c.env.PATH) + ['%(PATH)s']) 59 map(str, self.c.env.PATH) + ['%(PATH)s'])
65 if self.c.env.ADB_VENDOR_KEYS: 60 if self.c.env.ADB_VENDOR_KEYS:
66 ret['ADB_VENDOR_KEYS'] = self.c.env.ADB_VENDOR_KEYS 61 ret['ADB_VENDOR_KEYS'] = self.c.env.ADB_VENDOR_KEYS
67 if self.c.env.LLVM_FORCE_HEAD_REVISION: 62 if self.c.env.LLVM_FORCE_HEAD_REVISION:
68 ret['LLVM_FORCE_HEAD_REVISION'] = self.c.env.LLVM_FORCE_HEAD_REVISION 63 ret['LLVM_FORCE_HEAD_REVISION'] = self.c.env.LLVM_FORCE_HEAD_REVISION
69 return ret 64 return ret
70 65
71 @property 66 @property
72 def builders(self):
73 return self._builders
74
75 @property
76 def steps(self):
77 return steps
78
79 @property
80 def build_properties(self): 67 def build_properties(self):
81 return self._build_properties 68 return self._build_properties
82 69
83 @property 70 @property
84 def output_dir(self): 71 def output_dir(self):
85 """Return the path to the built executable directory.""" 72 """Return the path to the built executable directory."""
86 return self.c.build_dir.join(self.c.build_config_fs) 73 return self.c.build_dir.join(self.c.build_config_fs)
87 74
88 @property 75 @property
89 def version(self): 76 def version(self):
(...skipping 14 matching lines...) Expand all
104 ['cat', self.m.path['checkout'].join('chrome', 'VERSION')], 91 ['cat', self.m.path['checkout'].join('chrome', 'VERSION')],
105 stdout=self.m.raw_io.output('version'), 92 stdout=self.m.raw_io.output('version'),
106 step_test_data=( 93 step_test_data=(
107 lambda: self.m.raw_io.test_api.stream_output( 94 lambda: self.m.raw_io.test_api.stream_output(
108 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout 95 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout
109 return self.version 96 return self.version
110 97
111 def set_build_properties(self, props): 98 def set_build_properties(self, props):
112 self._build_properties = props 99 self._build_properties = props
113 100
114 def add_builders(self, builders):
115 """Adds builders to our builder map"""
116 self._builders.update(builders)
117
118 def configure_bot(self, builders_dict, additional_configs=None): 101 def configure_bot(self, builders_dict, additional_configs=None):
119 """Sets up the configurations and gclient to be ready for bot update. 102 """Sets up the configurations and gclient to be ready for bot update.
120 103
121 builders_dict is a dict of mastername -> 'builders' -> buildername -> 104 builders_dict is a dict of mastername -> 'builders' -> buildername ->
122 bot_config. 105 bot_config.
123 106
124 The current mastername and buildername are looked up from the 107 The current mastername and buildername are looked up from the
125 build properties; we then apply the configs specified in bot_config 108 build properties; we then apply the configs specified in bot_config
126 as appropriate. 109 as appropriate.
127 110
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 if self.m.platform.is_win: 698 if self.m.platform.is_win:
716 self.m.python( 699 self.m.python(
717 name='get_vs_toolchain_if_necessary', 700 name='get_vs_toolchain_if_necessary',
718 script=self.m.path['depot_tools'].join( 701 script=self.m.path['depot_tools'].join(
719 'win_toolchain', 'get_toolchain_if_necessary.py'), 702 'win_toolchain', 'get_toolchain_if_necessary.py'),
720 args=[ 703 args=[
721 '27eac9b2869ef6c89391f305a3f01285ea317867', 704 '27eac9b2869ef6c89391f305a3f01285ea317867',
722 '9d9a93134b3eabd003b85b4e7dea06c0eae150ed', 705 '9d9a93134b3eabd003b85b4e7dea06c0eae150ed',
723 ]) 706 ])
724 707
725 def get_common_args_for_scripts(self):
726 args = []
727
728 args.extend(['--build-config-fs', self.c.build_config_fs])
729
730 paths = {}
731 for path in ('build', 'checkout'):
732 paths[path] = self.m.path[path]
733 args.extend(['--paths', self.m.json.input(paths)])
734
735 properties = {}
736 # TODO(phajdan.jr): Remove buildnumber when no longer used.
737
738 mastername = self.m.properties.get('mastername')
739 buildername = self.m.properties.get('buildername')
740 master_dict = self.builders.get(mastername, {})
741 bot_config = master_dict.get('builders', {}).get(buildername, {})
742
743 for name in ('buildername', 'slavename', 'buildnumber', 'mastername'):
744 properties[name] = self.m.properties[name]
745
746 # Optional properties
747 for name in ('perf-id', 'results-url'):
748 if bot_config.get(name):
749 properties[name] = bot_config[name]
750
751 properties['target_platform'] = self.c.TARGET_PLATFORM
752
753 args.extend(['--properties', self.m.json.input(properties)])
754
755 return args
756
757 def get_compile_targets_for_scripts(self):
758 return self.m.python(
759 name='get compile targets for scripts',
760 script=self.m.path['checkout'].join(
761 'testing', 'scripts', 'get_compile_targets.py'),
762 args=[
763 '--output', self.m.json.output(),
764 '--',
765 ] + self.get_common_args_for_scripts(),
766 step_test_data=lambda: self.m.json.test_api.output({}))
767
768 def download_lto_plugin(self): 708 def download_lto_plugin(self):
769 return self.m.python( 709 return self.m.python(
770 name='download LTO plugin', 710 name='download LTO plugin',
771 script=self.m.path['checkout'].join( 711 script=self.m.path['checkout'].join(
772 'build', 'download_gold_plugin.py')) 712 'build', 'download_gold_plugin.py'))
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/example.py ('k') | scripts/slave/recipe_modules/chromium/builders.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698