Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """ Check for regressions in bench data. """ | 6 """ Check for regressions in bench data. """ |
| 7 | 7 |
| 8 from build_step import BuildStep | 8 from build_step import BuildStep |
| 9 from config_private import AUTOGEN_SVN_BASEURL | |
| 10 from slave import slave_utils | |
| 9 from utils import shell_utils | 11 from utils import shell_utils |
| 10 | 12 |
| 11 import builder_name_schema | 13 import builder_name_schema |
| 12 import os | 14 import os |
| 15 import subprocess | |
| 13 import sys | 16 import sys |
| 14 | 17 |
| 15 | 18 |
| 16 class CheckForRegressions(BuildStep): | 19 class CheckForRegressions(BuildStep): |
| 17 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): | 20 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): |
| 18 super(CheckForRegressions, self).__init__( | 21 super(CheckForRegressions, self).__init__( |
| 19 timeout=timeout, | 22 timeout=timeout, |
| 20 no_output_timeout=no_output_timeout, | 23 no_output_timeout=no_output_timeout, |
| 21 **kwargs) | 24 **kwargs) |
| 22 | 25 |
| 23 def _RunInternal(self, representation): | 26 def _RunInternal(self, representation): |
| 27 # Reads expectations from skia-autogen svn repo using 'svn cat'. | |
| 28 expectations_filename = ('bench_expectations_' + | |
| 29 builder_name_schema.GetWaterfallBot(self.builder_name) + '.txt') | |
| 30 url = '%s/%s/%s' % (AUTOGEN_SVN_BASEURL, 'bench', expectations_filename) | |
| 31 | |
| 32 svn_binary = slave_utils.SubversionExe() | |
| 33 proc = subprocess.Popen([svn_binary, 'cat', url], | |
| 34 stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| 35 (stdout, stderr) = proc.communicate() | |
|
borenet
2014/03/14 12:06:46
Please use shell_utils.run() for this:
try:
out
benchen
2014/03/14 13:25:42
Done. Thanks for the suggestion.
On 2014/03/14 12:
| |
| 36 if proc.returncode is not 0: | |
| 37 print 'Skip due to missing expectations: %s' % url | |
| 38 return | |
| 39 | |
| 24 path_to_check_bench_regressions = os.path.join('bench', | 40 path_to_check_bench_regressions = os.path.join('bench', |
| 25 'check_bench_regressions.py') | 41 'check_bench_regressions.py') |
| 26 # TODO(borenet): We should move these expectations into expectations/bench. | 42 |
| 43 # Writes the expectations from svn repo to the local file. | |
| 27 path_to_bench_expectations = os.path.join( | 44 path_to_bench_expectations = os.path.join( |
| 28 'bench', | 45 self._perf_range_input_dir, expectations_filename) |
| 29 'bench_expectations_%s.txt' % builder_name_schema.GetWaterfallBot( | 46 os.makedirs(self._perf_range_input_dir) |
| 30 self._builder_name)) | 47 with open(path_to_bench_expectations, 'w') as file_handle: |
| 31 if not os.path.isfile(path_to_bench_expectations): | 48 file_handle.write(stdout) |
| 32 print 'Skip due to missing expectations: %s' % path_to_bench_expectations | 49 |
| 33 return | |
| 34 cmd = ['python', path_to_check_bench_regressions, | 50 cmd = ['python', path_to_check_bench_regressions, |
| 35 '-a', representation, | 51 '-a', representation, |
| 36 '-b', self._builder_name, | 52 '-b', self._builder_name, |
| 37 '-d', self._perf_data_dir, | 53 '-d', self._perf_data_dir, |
| 38 '-e', path_to_bench_expectations, | 54 '-e', path_to_bench_expectations, |
| 39 '-r', self._got_revision, | 55 '-r', self._got_revision, |
| 40 ] | 56 ] |
| 41 | 57 |
| 42 shell_utils.run(cmd) | 58 shell_utils.run(cmd) |
| 43 | 59 |
| 44 def _Run(self): | 60 def _Run(self): |
| 45 if self._perf_data_dir: | 61 if self._perf_data_dir: |
| 46 self._RunInternal('25th') | 62 self._RunInternal('25th') |
| 47 | 63 |
| 48 | 64 |
| 49 if '__main__' == __name__: | 65 if '__main__' == __name__: |
| 50 sys.exit(BuildStep.RunBuildStep(CheckForRegressions)) | 66 sys.exit(BuildStep.RunBuildStep(CheckForRegressions)) |
| OLD | NEW |