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 |
13 import sys | 15 import sys |
14 | 16 |
15 | 17 |
16 class CheckForRegressions(BuildStep): | 18 class CheckForRegressions(BuildStep): |
17 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): | 19 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): |
18 super(CheckForRegressions, self).__init__( | 20 super(CheckForRegressions, self).__init__( |
19 timeout=timeout, | 21 timeout=timeout, |
20 no_output_timeout=no_output_timeout, | 22 no_output_timeout=no_output_timeout, |
21 **kwargs) | 23 **kwargs) |
22 | 24 |
23 def _RunInternal(self, representation): | 25 def _RunInternal(self, representation): |
| 26 # Reads expectations from skia-autogen svn repo using 'svn cat'. |
| 27 expectations_filename = ('bench_expectations_' + |
| 28 builder_name_schema.GetWaterfallBot(self.builder_name) + '.txt') |
| 29 url = '/'.join([AUTOGEN_SVN_BASEURL, 'bench', expectations_filename]) |
| 30 |
| 31 svn_binary = slave_utils.SubversionExe() |
| 32 try: |
| 33 output = shell_utils.run([svn_binary, 'cat', url]) |
| 34 except shell_utils.CommandFailedException: |
| 35 print 'Skip due to missing expectations: %s' % url |
| 36 return |
| 37 |
24 path_to_check_bench_regressions = os.path.join('bench', | 38 path_to_check_bench_regressions = os.path.join('bench', |
25 'check_bench_regressions.py') | 39 'check_bench_regressions.py') |
26 # TODO(borenet): We should move these expectations into expectations/bench. | 40 |
| 41 # Writes the expectations from svn repo to the local file. |
27 path_to_bench_expectations = os.path.join( | 42 path_to_bench_expectations = os.path.join( |
28 'bench', | 43 self._perf_range_input_dir, expectations_filename) |
29 'bench_expectations_%s.txt' % builder_name_schema.GetWaterfallBot( | 44 os.makedirs(self._perf_range_input_dir) |
30 self._builder_name)) | 45 with open(path_to_bench_expectations, 'w') as file_handle: |
31 if not os.path.isfile(path_to_bench_expectations): | 46 file_handle.write(output) |
32 print 'Skip due to missing expectations: %s' % path_to_bench_expectations | 47 |
33 return | |
34 cmd = ['python', path_to_check_bench_regressions, | 48 cmd = ['python', path_to_check_bench_regressions, |
35 '-a', representation, | 49 '-a', representation, |
36 '-b', self._builder_name, | 50 '-b', self._builder_name, |
37 '-d', self._perf_data_dir, | 51 '-d', self._perf_data_dir, |
38 '-e', path_to_bench_expectations, | 52 '-e', path_to_bench_expectations, |
39 '-r', self._got_revision, | 53 '-r', self._got_revision, |
40 ] | 54 ] |
41 | 55 |
42 shell_utils.run(cmd) | 56 shell_utils.run(cmd) |
43 | 57 |
44 def _Run(self): | 58 def _Run(self): |
45 if self._perf_data_dir: | 59 if self._perf_data_dir: |
46 self._RunInternal('25th') | 60 self._RunInternal('25th') |
47 | 61 |
48 | 62 |
49 if '__main__' == __name__: | 63 if '__main__' == __name__: |
50 sys.exit(BuildStep.RunBuildStep(CheckForRegressions)) | 64 sys.exit(BuildStep.RunBuildStep(CheckForRegressions)) |
OLD | NEW |