| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Set of utilities to add commands to a buildbot factory (BuildFactory). | 6 """Set of utilities to add commands to a buildbot factory (BuildFactory). |
| 7 | 7 |
| 8 All the utility functions to add steps to a build factory here are not | 8 All the utility functions to add steps to a build factory here are not |
| 9 project-specific. See the other *_commands.py for project-specific commands. | 9 project-specific. See the other *_commands.py for project-specific commands. |
| 10 """ | 10 """ |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 descriptionDone=descriptionDone, | 324 descriptionDone=descriptionDone, |
| 325 command=self.GetBuildCommand(clobber, | 325 command=self.GetBuildCommand(clobber, |
| 326 solution, | 326 solution, |
| 327 mode, | 327 mode, |
| 328 options)) | 328 options)) |
| 329 | 329 |
| 330 | 330 |
| 331 # Performance step utils. | 331 # Performance step utils. |
| 332 def _CreatePerformanceStepClass( | 332 def _CreatePerformanceStepClass( |
| 333 self, log_processor_class, report_link=None, output_dir=None, | 333 self, log_processor_class, report_link=None, output_dir=None, |
| 334 command_class=chromium_step.ProcessLogShellStep): | 334 perf_name=None, command_class=chromium_step.ProcessLogShellStep): |
| 335 """Returns ProcessLogShellStep class. | 335 """Returns ProcessLogShellStep class. |
| 336 | 336 |
| 337 Args: | 337 Args: |
| 338 log_processor_class: class that will be used to process logs. Normally | 338 log_processor_class: class that will be used to process logs. Normally |
| 339 should be a subclass of process_log.PerformanceLogProcessor. | 339 should be a subclass of process_log.PerformanceLogProcessor. |
| 340 report_link: URL that will be used as a link to results. If None, | 340 report_link: URL that will be used as a link to results. If None, |
| 341 result won't be written into file. | 341 result won't be written into file. |
| 342 output_dir: directory where the log processor will write the results. | 342 output_dir: directory where the log processor will write the results. |
| 343 command_class: command type to run for this step. Normally this will be | 343 command_class: command type to run for this step. Normally this will be |
| 344 chromium_step.ProcessLogShellStep. | 344 chromium_step.ProcessLogShellStep. |
| 345 """ | 345 """ |
| 346 # We create a log-processor class using | 346 # We create a log-processor class using |
| 347 # chromium_utils.InitializePartiallyWithArguments, which uses function | 347 # chromium_utils.InitializePartiallyWithArguments, which uses function |
| 348 # currying to create classes that have preset constructor arguments. | 348 # currying to create classes that have preset constructor arguments. |
| 349 # This serves two purposes: | 349 # This serves two purposes: |
| 350 # 1. Allows the step to instantiate its log processor without any | 350 # 1. Allows the step to instantiate its log processor without any |
| 351 # additional parameters; | 351 # additional parameters; |
| 352 # 2. Creates a unique log processor class for each individual step, so | 352 # 2. Creates a unique log processor class for each individual step, so |
| 353 # they can keep state that won't be shared between builds | 353 # they can keep state that won't be shared between builds |
| 354 log_processor_class = chromium_utils.InitializePartiallyWithArguments( | 354 log_processor_class = chromium_utils.InitializePartiallyWithArguments( |
| 355 log_processor_class, report_link=report_link, output_dir=output_dir) | 355 log_processor_class, report_link=report_link, output_dir=output_dir, |
| 356 perf_name=perf_name) |
| 356 # Similarly, we need to allow buildbot to create the step itself without | 357 # Similarly, we need to allow buildbot to create the step itself without |
| 357 # using additional parameters, so we create a step class that already | 358 # using additional parameters, so we create a step class that already |
| 358 # knows which log_processor to use. | 359 # knows which log_processor to use. |
| 359 return chromium_utils.InitializePartiallyWithArguments(command_class, | 360 return chromium_utils.InitializePartiallyWithArguments(command_class, |
| 360 log_processor_class) | 361 log_processor_class) |
| 361 | 362 |
| 362 def GetPerfTestCommand(self, perf_id, show_results, mappings, | 363 def GetPerfTestCommand(self, perf_id, show_results, mappings, |
| 363 log_processor_class, **kwargs): | 364 log_processor_class, **kwargs): |
| 364 """Selects the right build step for the specified perf test.""" | 365 """Selects the right build step for the specified perf test.""" |
| 365 report_link = None | 366 report_link = None |
| 366 output_dir = None | 367 output_dir = None |
| 368 perf_name = None |
| 367 if show_results and self._target in mappings: | 369 if show_results and self._target in mappings: |
| 368 mapping = mappings[self._target] | 370 mapping = mappings[self._target] |
| 369 dir_name = mapping.get(perf_id) | 371 dir_name = mapping.get(perf_id) |
| 370 if dir_name: | 372 if dir_name: |
| 373 perf_name = dir_name |
| 371 report_link = "%s/%s/%s" % (self.PERF_BASE_URL, dir_name, | 374 report_link = "%s/%s/%s" % (self.PERF_BASE_URL, dir_name, |
| 372 self.PERF_REPORT_URL_SUFFIX) | 375 self.PERF_REPORT_URL_SUFFIX) |
| 373 output_dir = '%s/%s/' % (self.PERF_OUTPUT_DIR, dir_name) | 376 output_dir = '%s/%s/' % (self.PERF_OUTPUT_DIR, dir_name) |
| 374 else: | 377 else: |
| 375 raise Exception, ('There is no mapping for identifier %s in %s' % | 378 raise Exception, ('There is no mapping for identifier %s in %s' % |
| 376 (perf_id, self._target)) | 379 (perf_id, self._target)) |
| 377 | 380 |
| 378 return self._CreatePerformanceStepClass(log_processor_class, | 381 return self._CreatePerformanceStepClass(log_processor_class, |
| 379 report_link=report_link, | 382 report_link=report_link, |
| 380 output_dir=output_dir) | 383 output_dir=output_dir, |
| 384 perf_name=perf_name) |
| OLD | NEW |