OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Set of utilities to add commands to a buildbot factory (BuildFactory). | 5 """Set of utilities to add commands to a buildbot factory (BuildFactory). |
6 | 6 |
7 All the utility functions to add steps to a build factory here are not | 7 All the utility functions to add steps to a build factory here are not |
8 project-specific. See the other *_commands.py for project-specific commands. | 8 project-specific. See the other *_commands.py for project-specific commands. |
9 """ | 9 """ |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 shell.ShellCommand.commandComplete(self, cmd) | 105 shell.ShellCommand.commandComplete(self, cmd) |
106 | 106 |
107 re_hash_mapping = re.compile(r'^([a-z_]+) ([0-9a-f]{40})$') | 107 re_hash_mapping = re.compile(r'^([a-z_]+) ([0-9a-f]{40})$') |
108 matches = ( | 108 matches = ( |
109 re_hash_mapping.match(l.strip()) for l in self.stdio_log.readlines()) | 109 re_hash_mapping.match(l.strip()) for l in self.stdio_log.readlines()) |
110 swarm_hashes = dict(x.groups() for x in matches if x) | 110 swarm_hashes = dict(x.groups() for x in matches if x) |
111 | 111 |
112 self.setProperty('swarm_hashes', swarm_hashes) | 112 self.setProperty('swarm_hashes', swarm_hashes) |
113 | 113 |
114 | 114 |
115 def GetSwarmTestsFromTestFilter(test_filters): | |
116 """Returns a list of all the tests in the list that should be run with | |
117 swarm.""" | |
118 swarm_tests = [] | |
119 for test_filter in test_filters: | |
120 if '_swarm:' in test_filter: | |
121 swarm_tests.append(test_filter.split('_swarm:')[0]) | |
M-A Ruel
2012/11/01 19:06:46
swarm_tests.append(test_filter.split('_swarm:', 1)
csharp
2012/11/01 19:30:09
Done.
| |
122 elif test_filter.endswith('_swarm'): | |
123 swarm_tests.append(test_filter[:-len('_swarm')]) | |
124 | |
125 return swarm_tests | |
126 | |
127 | |
128 class CompileWithRequiredSwarmTargets(shell.Compile): | |
129 def start(self): | |
130 try: | |
131 test_filters = self.getProperty('testfilter') | |
132 except KeyError: | |
133 test_filters = [] | |
134 | |
135 command = self.command | |
136 swarm_tests = GetSwarmTestsFromTestFilter(test_filters) | |
137 for swarm_test in swarm_tests: | |
M-A Ruel
2012/11/01 19:06:46
command.extend(i + '_run' for i in swarm_tests)
csharp
2012/11/01 19:30:09
Done.
| |
138 command.append(swarm_test + '_run') | |
139 | |
140 self.setCommand(command) | |
141 return shell.Compile.start(self) | |
142 | |
143 | |
115 class FactoryCommands(object): | 144 class FactoryCommands(object): |
116 # Base URL for performance test results. | 145 # Base URL for performance test results. |
117 PERF_BASE_URL = config.Master.perf_base_url | 146 PERF_BASE_URL = config.Master.perf_base_url |
118 PERF_REPORT_URL_SUFFIX = config.Master.perf_report_url_suffix | 147 PERF_REPORT_URL_SUFFIX = config.Master.perf_report_url_suffix |
119 | 148 |
120 # Directory in which to save perf output data files. | 149 # Directory in which to save perf output data files. |
121 PERF_OUTPUT_DIR = config.Master.perf_output_dir | 150 PERF_OUTPUT_DIR = config.Master.perf_output_dir |
122 | 151 |
123 # Use this to prevent steps which cannot be run on the same | 152 # Use this to prevent steps which cannot be run on the same |
124 # slave from being done together (in the case where slaves are | 153 # slave from being done together (in the case where slaves are |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 description: for the waterfall | 936 description: for the waterfall |
908 descriptionDone: for the waterfall | 937 descriptionDone: for the waterfall |
909 timeout: if no output is received in this many seconds, the compile step | 938 timeout: if no output is received in this many seconds, the compile step |
910 will be killed | 939 will be killed |
911 mode: if given, this will be passed as the --mode option to the compile | 940 mode: if given, this will be passed as the --mode option to the compile |
912 command | 941 command |
913 options: list of additional options to pass to the compile command | 942 options: list of additional options to pass to the compile command |
914 halfOnFailure: should stop the build if compile fails | 943 halfOnFailure: should stop the build if compile fails |
915 """ | 944 """ |
916 self._factory.addStep( | 945 self._factory.addStep( |
917 shell.Compile, | 946 CompileWithRequiredSwarmTargets, |
918 name='compile', | 947 name='compile', |
919 timeout=timeout, | 948 timeout=timeout, |
920 description=description, | 949 description=description, |
921 descriptionDone=descriptionDone, | 950 descriptionDone=descriptionDone, |
922 command=self.GetBuildCommand(clobber, solution, mode, options), | 951 command=self.GetBuildCommand(clobber, solution, mode, options), |
923 haltOnFailure=haltOnFailure, | 952 haltOnFailure=haltOnFailure, |
924 env=env) | 953 env=env) |
925 | 954 |
926 def _PerfStepMappings(self, show_results, perf_id, test_name): | 955 def _PerfStepMappings(self, show_results, perf_id, test_name): |
927 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" | 956 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 | 1105 |
1077 def commandComplete(self, cmd): | 1106 def commandComplete(self, cmd): |
1078 out = cmd.logs['stdio'].getText() | 1107 out = cmd.logs['stdio'].getText() |
1079 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) | 1108 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) |
1080 for propname, value in build_properties: | 1109 for propname, value in build_properties: |
1081 # findall can return strings containing CR characters, remove with strip. | 1110 # findall can return strings containing CR characters, remove with strip. |
1082 self.build.setProperty(propname, value.strip(), 'Step') | 1111 self.build.setProperty(propname, value.strip(), 'Step') |
1083 | 1112 |
1084 def getText(self, cmd, results): | 1113 def getText(self, cmd, results): |
1085 return self.describe(True) + self.messages | 1114 return self.describe(True) + self.messages |
OLD | NEW |