Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py

Issue 2663623003: Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Remove second paragraph in comment about awesome windows git hack Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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()
67 self._webkit_base_dir_len = len(self._port.webkit_base()) 66 self._webkit_base_dir_len = len(self._port.webkit_base())
68 self._base_path = self._port.perf_tests_dir() 67 self._base_path = self._port.perf_tests_dir()
69 self._timestamp = time.time() 68 self._timestamp = time.time()
70 self._utc_timestamp = datetime.datetime.utcnow() 69 self._utc_timestamp = datetime.datetime.utcnow()
71 70
72 @staticmethod 71 @staticmethod
73 def _parse_args(args=None): 72 def _parse_args(args=None):
74 def _expand_path(option, opt_str, value, parser): 73 def _expand_path(option, opt_str, value, parser):
75 path = os.path.expandvars(os.path.expanduser(value)) 74 path = os.path.expandvars(os.path.expanduser(value))
76 setattr(parser.values, option.dest, path) 75 setattr(parser.values, option.dest, path)
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 254
256 absolute_path_to_trunk = filesystem.dirname(self._port.perf_tests_dir()) 255 absolute_path_to_trunk = filesystem.dirname(self._port.perf_tests_dir())
257 results_page = template.replace('%AbsolutePathToWebKitTrunk%', absolute_ path_to_trunk) 256 results_page = template.replace('%AbsolutePathToWebKitTrunk%', absolute_ path_to_trunk)
258 results_page = results_page.replace('%PeformanceTestsResultsJSON%', json _output) 257 results_page = results_page.replace('%PeformanceTestsResultsJSON%', json _output)
259 258
260 filesystem.write_text_file(self._results_page_path(), results_page) 259 filesystem.write_text_file(self._results_page_path(), results_page)
261 260
262 def _generate_results_dict(self, timestamp, description, platform, builder_n ame, build_number): 261 def _generate_results_dict(self, timestamp, description, platform, builder_n ame, build_number):
263 revisions = {} 262 revisions = {}
264 path = self._port.repository_path() 263 path = self._port.repository_path()
265 git = self._host.scm_for_path(path) 264 git = self._host.scm(path=path)
266 revision = str(git.commit_position(path)) 265 revision = str(git.commit_position(path))
267 revisions['chromium'] = {'revision': revision, 'timestamp': git.timestam p_of_revision(path, revision)} 266 revisions['chromium'] = {'revision': revision, 'timestamp': git.timestam p_of_revision(path, revision)}
268 267
269 meta_info = { 268 meta_info = {
270 'description': description, 269 'description': description,
271 'buildTime': self._datetime_in_ES5_compatible_iso_format(self._utc_t imestamp), 270 'buildTime': self._datetime_in_ES5_compatible_iso_format(self._utc_t imestamp),
272 'platform': platform, 271 'platform': platform,
273 'revisions': revisions, 272 'revisions': revisions,
274 'builderName': builder_name, 273 'builderName': builder_name,
275 'buildNumber': int(build_number) if build_number else None} 274 'buildNumber': int(build_number) if build_number else None}
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if metrics: 371 if metrics:
373 self._results.append((test, metrics)) 372 self._results.append((test, metrics))
374 else: 373 else:
375 failures += 1 374 failures += 1
376 _log.error('FAILED') 375 _log.error('FAILED')
377 376
378 _log.info('Finished: %f s', time.time() - start_time) 377 _log.info('Finished: %f s', time.time() - start_time)
379 _log.info('') 378 _log.info('')
380 379
381 return failures 380 return failures
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698