| OLD | NEW |
| 1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 _DEFAULT_JSON_FILENAME = 'PerformanceTestsResults.json' | 56 _DEFAULT_JSON_FILENAME = 'PerformanceTestsResults.json' |
| 57 | 57 |
| 58 def __init__(self, args=None, port=None): | 58 def __init__(self, args=None, port=None): |
| 59 self._options, self._args = PerfTestsRunner._parse_args(args) | 59 self._options, self._args = PerfTestsRunner._parse_args(args) |
| 60 if port: | 60 if port: |
| 61 self._port = port | 61 self._port = port |
| 62 self._host = self._port.host | 62 self._host = self._port.host |
| 63 else: | 63 else: |
| 64 self._host = Host() | 64 self._host = Host() |
| 65 self._port = self._host.port_factory.get(self._options.platform, sel
f._options) | 65 self._port = self._host.port_factory.get(self._options.platform, sel
f._options) |
| 66 self._host.initialize_scm() |
| 66 self._webkit_base_dir_len = len(self._port.webkit_base()) | 67 self._webkit_base_dir_len = len(self._port.webkit_base()) |
| 67 self._base_path = self._port.perf_tests_dir() | 68 self._base_path = self._port.perf_tests_dir() |
| 68 self._timestamp = time.time() | 69 self._timestamp = time.time() |
| 69 self._utc_timestamp = datetime.datetime.utcnow() | 70 self._utc_timestamp = datetime.datetime.utcnow() |
| 70 | 71 |
| 71 @staticmethod | 72 @staticmethod |
| 72 def _parse_args(args=None): | 73 def _parse_args(args=None): |
| 73 def _expand_path(option, opt_str, value, parser): | 74 def _expand_path(option, opt_str, value, parser): |
| 74 path = os.path.expandvars(os.path.expanduser(value)) | 75 path = os.path.expandvars(os.path.expanduser(value)) |
| 75 setattr(parser.values, option.dest, path) | 76 setattr(parser.values, option.dest, path) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 255 |
| 255 absolute_path_to_trunk = filesystem.dirname(self._port.perf_tests_dir()) | 256 absolute_path_to_trunk = filesystem.dirname(self._port.perf_tests_dir()) |
| 256 results_page = template.replace('%AbsolutePathToWebKitTrunk%', absolute_
path_to_trunk) | 257 results_page = template.replace('%AbsolutePathToWebKitTrunk%', absolute_
path_to_trunk) |
| 257 results_page = results_page.replace('%PeformanceTestsResultsJSON%', json
_output) | 258 results_page = results_page.replace('%PeformanceTestsResultsJSON%', json
_output) |
| 258 | 259 |
| 259 filesystem.write_text_file(self._results_page_path(), results_page) | 260 filesystem.write_text_file(self._results_page_path(), results_page) |
| 260 | 261 |
| 261 def _generate_results_dict(self, timestamp, description, platform, builder_n
ame, build_number): | 262 def _generate_results_dict(self, timestamp, description, platform, builder_n
ame, build_number): |
| 262 revisions = {} | 263 revisions = {} |
| 263 path = self._port.repository_path() | 264 path = self._port.repository_path() |
| 264 git = self._host.scm(path=path) | 265 git = self._host.scm_for_path(path) |
| 265 revision = str(git.commit_position(path)) | 266 revision = str(git.commit_position(path)) |
| 266 revisions['chromium'] = {'revision': revision, 'timestamp': git.timestam
p_of_revision(path, revision)} | 267 revisions['chromium'] = {'revision': revision, 'timestamp': git.timestam
p_of_revision(path, revision)} |
| 267 | 268 |
| 268 meta_info = { | 269 meta_info = { |
| 269 'description': description, | 270 'description': description, |
| 270 'buildTime': self._datetime_in_ES5_compatible_iso_format(self._utc_t
imestamp), | 271 'buildTime': self._datetime_in_ES5_compatible_iso_format(self._utc_t
imestamp), |
| 271 'platform': platform, | 272 'platform': platform, |
| 272 'revisions': revisions, | 273 'revisions': revisions, |
| 273 'builderName': builder_name, | 274 'builderName': builder_name, |
| 274 'buildNumber': int(build_number) if build_number else None} | 275 'buildNumber': int(build_number) if build_number else None} |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 if metrics: | 372 if metrics: |
| 372 self._results.append((test, metrics)) | 373 self._results.append((test, metrics)) |
| 373 else: | 374 else: |
| 374 failures += 1 | 375 failures += 1 |
| 375 _log.error('FAILED') | 376 _log.error('FAILED') |
| 376 | 377 |
| 377 _log.info('Finished: %f s', time.time() - start_time) | 378 _log.info('Finished: %f s', time.time() - start_time) |
| 378 _log.info('') | 379 _log.info('') |
| 379 | 380 |
| 380 return failures | 381 return failures |
| OLD | NEW |