| 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:', 1)[0]) |
| 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 command.extend(swarm_test + '_run' for swarm_test in swarm_tests) |
| 138 |
| 139 self.setCommand(command) |
| 140 return shell.Compile.start(self) |
| 141 |
| 142 |
| 115 class FactoryCommands(object): | 143 class FactoryCommands(object): |
| 116 # Base URL for performance test results. | 144 # Base URL for performance test results. |
| 117 PERF_BASE_URL = config.Master.perf_base_url | 145 PERF_BASE_URL = config.Master.perf_base_url |
| 118 PERF_REPORT_URL_SUFFIX = config.Master.perf_report_url_suffix | 146 PERF_REPORT_URL_SUFFIX = config.Master.perf_report_url_suffix |
| 119 | 147 |
| 120 # Directory in which to save perf output data files. | 148 # Directory in which to save perf output data files. |
| 121 PERF_OUTPUT_DIR = config.Master.perf_output_dir | 149 PERF_OUTPUT_DIR = config.Master.perf_output_dir |
| 122 | 150 |
| 123 # Use this to prevent steps which cannot be run on the same | 151 # Use this to prevent steps which cannot be run on the same |
| 124 # slave from being done together (in the case where slaves are | 152 # 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 | 935 description: for the waterfall |
| 908 descriptionDone: for the waterfall | 936 descriptionDone: for the waterfall |
| 909 timeout: if no output is received in this many seconds, the compile step | 937 timeout: if no output is received in this many seconds, the compile step |
| 910 will be killed | 938 will be killed |
| 911 mode: if given, this will be passed as the --mode option to the compile | 939 mode: if given, this will be passed as the --mode option to the compile |
| 912 command | 940 command |
| 913 options: list of additional options to pass to the compile command | 941 options: list of additional options to pass to the compile command |
| 914 halfOnFailure: should stop the build if compile fails | 942 halfOnFailure: should stop the build if compile fails |
| 915 """ | 943 """ |
| 916 self._factory.addStep( | 944 self._factory.addStep( |
| 917 shell.Compile, | 945 CompileWithRequiredSwarmTargets, |
| 918 name='compile', | 946 name='compile', |
| 919 timeout=timeout, | 947 timeout=timeout, |
| 920 description=description, | 948 description=description, |
| 921 descriptionDone=descriptionDone, | 949 descriptionDone=descriptionDone, |
| 922 command=self.GetBuildCommand(clobber, solution, mode, options), | 950 command=self.GetBuildCommand(clobber, solution, mode, options), |
| 923 haltOnFailure=haltOnFailure, | 951 haltOnFailure=haltOnFailure, |
| 924 env=env) | 952 env=env) |
| 925 | 953 |
| 926 def _PerfStepMappings(self, show_results, perf_id, test_name): | 954 def _PerfStepMappings(self, show_results, perf_id, test_name): |
| 927 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" | 955 """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 | 1104 |
| 1077 def commandComplete(self, cmd): | 1105 def commandComplete(self, cmd): |
| 1078 out = cmd.logs['stdio'].getText() | 1106 out = cmd.logs['stdio'].getText() |
| 1079 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) | 1107 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) |
| 1080 for propname, value in build_properties: | 1108 for propname, value in build_properties: |
| 1081 # findall can return strings containing CR characters, remove with strip. | 1109 # findall can return strings containing CR characters, remove with strip. |
| 1082 self.build.setProperty(propname, value.strip(), 'Step') | 1110 self.build.setProperty(propname, value.strip(), 'Step') |
| 1083 | 1111 |
| 1084 def getText(self, cmd, results): | 1112 def getText(self, cmd, results): |
| 1085 return self.describe(True) + self.messages | 1113 return self.describe(True) + self.messages |
| OLD | NEW |