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

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

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if filesystem.exists(filesystem.join(self._base_path, relpath)): 150 if filesystem.exists(filesystem.join(self._base_path, relpath)):
151 paths.append(filesystem.normpath(relpath)) 151 paths.append(filesystem.normpath(relpath))
152 else: 152 else:
153 _log.warn('Path was not found:' + arg) 153 _log.warn('Path was not found:' + arg)
154 154
155 skipped_directories = set(['.svn', 'resources']) 155 skipped_directories = set(['.svn', 'resources'])
156 test_files = find_files.find(filesystem, self._base_path, paths, skipped _directories, _is_test_file) 156 test_files = find_files.find(filesystem, self._base_path, paths, skipped _directories, _is_test_file)
157 tests = [] 157 tests = []
158 for path in test_files: 158 for path in test_files:
159 relative_path = filesystem.relpath(path, self._base_path).replace('\ \', '/') 159 relative_path = filesystem.relpath(path, self._base_path).replace('\ \', '/')
160 if self._options.use_skipped_list and self._port.skips_perf_test(rel ative_path) and filesystem.normpath(relative_path) not in paths: 160 if self._options.use_skipped_list and self._port.skips_perf_test(
161 relative_path) and filesystem.normpath(relative_path) not in paths:
161 continue 162 continue
162 test = PerfTestFactory.create_perf_test(self._port, relative_path, p ath, 163 test = PerfTestFactory.create_perf_test(self._port, relative_path, p ath,
163 test_runner_count=self._opti ons.test_runner_count) 164 test_runner_count=self._opti ons.test_runner_count)
164 tests.append(test) 165 tests.append(test)
165 166
166 return tests 167 return tests
167 168
168 def _start_http_servers(self): 169 def _start_http_servers(self):
169 self._port.acquire_http_lock() 170 self._port.acquire_http_lock()
170 self._port.start_http_server(number_of_servers=2) 171 self._port.start_http_server(number_of_servers=2)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 if not self._host.filesystem.isfile(slave_config_json_path): 313 if not self._host.filesystem.isfile(slave_config_json_path):
313 _log.error("Missing slave configuration JSON file: %s" % slave_confi g_json_path) 314 _log.error("Missing slave configuration JSON file: %s" % slave_confi g_json_path)
314 return None 315 return None
315 316
316 try: 317 try:
317 slave_config_json = self._host.filesystem.open_text_file_for_reading (slave_config_json_path) 318 slave_config_json = self._host.filesystem.open_text_file_for_reading (slave_config_json_path)
318 slave_config = json.load(slave_config_json) 319 slave_config = json.load(slave_config_json)
319 for key in slave_config: 320 for key in slave_config:
320 contents['builder' + key.capitalize()] = slave_config[key] 321 contents['builder' + key.capitalize()] = slave_config[key]
321 return contents 322 return contents
322 except Exception, error: 323 except Exception as error:
323 _log.error("Failed to merge slave configuration JSON file %s: %s" % (slave_config_json_path, error)) 324 _log.error("Failed to merge slave configuration JSON file %s: %s" % (slave_config_json_path, error))
324 return None 325 return None
325 326
326 def _merge_outputs_if_needed(self, output_json_path, output): 327 def _merge_outputs_if_needed(self, output_json_path, output):
327 if self._options.reset_results or not self._host.filesystem.isfile(outpu t_json_path): 328 if self._options.reset_results or not self._host.filesystem.isfile(outpu t_json_path):
328 return [output] 329 return [output]
329 try: 330 try:
330 existing_outputs = json.loads(self._host.filesystem.read_text_file(o utput_json_path)) 331 existing_outputs = json.loads(self._host.filesystem.read_text_file(o utput_json_path))
331 return existing_outputs + [output] 332 return existing_outputs + [output]
332 except Exception, error: 333 except Exception as error:
333 _log.error("Failed to merge output JSON file %s: %s" % (output_json_ path, error)) 334 _log.error("Failed to merge output JSON file %s: %s" % (output_json_ path, error))
334 return None 335 return None
335 336
336 def _upload_json(self, test_results_server, json_path, host_path="/api/repor t", file_uploader=FileUploader): 337 def _upload_json(self, test_results_server, json_path, host_path="/api/repor t", file_uploader=FileUploader):
337 url = "https://%s%s" % (test_results_server, host_path) 338 url = "https://%s%s" % (test_results_server, host_path)
338 uploader = file_uploader(url, 120) 339 uploader = file_uploader(url, 120)
339 try: 340 try:
340 response = uploader.upload_single_text_file(self._host.filesystem, ' application/json', json_path) 341 response = uploader.upload_single_text_file(self._host.filesystem, ' application/json', json_path)
341 except Exception, error: 342 except Exception as error:
342 _log.error("Failed to upload JSON file to %s in 120s: %s" % (url, er ror)) 343 _log.error("Failed to upload JSON file to %s in 120s: %s" % (url, er ror))
343 return False 344 return False
344 345
345 response_body = [line.strip('\n') for line in response] 346 response_body = [line.strip('\n') for line in response]
346 if response_body != ['OK']: 347 if response_body != ['OK']:
347 try: 348 try:
348 parsed_response = json.loads('\n'.join(response_body)) 349 parsed_response = json.loads('\n'.join(response_body))
349 except: 350 except:
350 _log.error("Uploaded JSON to %s but got a bad response:" % url) 351 _log.error("Uploaded JSON to %s but got a bad response:" % url)
351 for line in response_body: 352 for line in response_body:
(...skipping 19 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698