Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 import collections | 6 import collections |
| 7 import glob | 7 import glob |
| 8 import hashlib | 8 import hashlib |
| 9 import json | |
| 9 import multiprocessing | 10 import multiprocessing |
| 10 import os | 11 import os |
| 11 import random | 12 import random |
| 12 import re | 13 import re |
| 13 import shutil | 14 import shutil |
| 14 import sys | 15 import sys |
| 15 | 16 |
| 16 import bb_utils | 17 import bb_utils |
| 17 import bb_annotations | 18 import bb_annotations |
| 18 | 19 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 for f in options.factory_properties.get('additional_expectations', []): | 251 for f in options.factory_properties.get('additional_expectations', []): |
| 251 cmd_args.extend( | 252 cmd_args.extend( |
| 252 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) | 253 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) |
| 253 | 254 |
| 254 # TODO(dpranke): Remove this block after | 255 # TODO(dpranke): Remove this block after |
| 255 # https://codereview.chromium.org/12927002/ lands. | 256 # https://codereview.chromium.org/12927002/ lands. |
| 256 for f in options.factory_properties.get('additional_expectations_files', []): | 257 for f in options.factory_properties.get('additional_expectations_files', []): |
| 257 cmd_args.extend( | 258 cmd_args.extend( |
| 258 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) | 259 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) |
| 259 | 260 |
| 260 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args) | 261 exit_code = RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + |
| 262 cmd_args) | |
| 263 if exit_code == 254: # AKA -1, internal error. | |
| 264 bb_annotations.PrintMsg("?? (crashed or hung)") | |
| 265 else: | |
| 266 full_results_path = os.path.join('..', 'layout-test-results', | |
| 267 'full_results.json') | |
| 268 if os.path.exists(full_results_path): | |
| 269 full_results = json.load(open(full_results_path)) | |
| 270 unexpected_failures, unexpected_flakes, unexpected_passes = \ | |
|
Isaac (away)
2013/10/09 18:27:59
Extend lines using parens, not backslash, per goog
| |
| 271 _ParseLayoutTestResults(full_results) | |
| 272 if unexpected_failures: | |
| 273 _PrintDashboardLink("failed", unexpected_failures, | |
| 274 max_tests=25) | |
| 275 elif unexpected_passes: | |
| 276 _PrintDashboardLink("unexpected passes", unexpected_passes, | |
| 277 max_tests=10) | |
| 278 if unexpected_flakes: | |
| 279 _PrintDashboardLink("unexpected flakes", unexpected_flakes, | |
| 280 max_tests=10) | |
| 281 else: | |
| 282 bb_annotations.PrintMsg("?? (results missing)") | |
| 283 | |
| 261 | 284 |
| 262 if options.factory_properties.get('archive_webkit_results', False): | 285 if options.factory_properties.get('archive_webkit_results', False): |
| 263 bb_annotations.PrintNamedStep('archive_webkit_results') | 286 bb_annotations.PrintNamedStep('archive_webkit_results') |
| 264 base = 'https://storage.googleapis.com/chromium-layout-test-archives' | 287 base = 'https://storage.googleapis.com/chromium-layout-test-archives' |
| 265 builder_name = options.build_properties.get('buildername', '') | 288 builder_name = options.build_properties.get('buildername', '') |
| 266 build_number = str(options.build_properties.get('buildnumber', '')) | 289 build_number = str(options.build_properties.get('buildnumber', '')) |
| 267 bb_annotations.PrintLink('results', | 290 bb_annotations.PrintLink('results', |
| 268 '%s/%s/%s/layout-test-results/results.html' % ( | 291 '%s/%s/%s/layout-test-results/results.html' % ( |
| 269 base, EscapeBuilderName(builder_name), build_number)) | 292 base, EscapeBuilderName(builder_name), build_number)) |
| 270 bb_annotations.PrintLink('(zip)', '%s/%s/%s/layout-test-results.zip' % ( | 293 bb_annotations.PrintLink('(zip)', '%s/%s/%s/layout-test-results.zip' % ( |
| 271 base, EscapeBuilderName(builder_name), build_number)) | 294 base, EscapeBuilderName(builder_name), build_number)) |
| 272 gs_bucket = 'gs://chromium-layout-test-archives' | 295 gs_bucket = 'gs://chromium-layout-test-archives' |
| 273 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'chromium', | 296 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'chromium', |
| 274 'archive_layout_test_results.py'), | 297 'archive_layout_test_results.py'), |
| 275 '--results-dir', '../../layout-test-results', | 298 '--results-dir', '../../layout-test-results', |
| 276 '--build-dir', CHROME_OUT_DIR, | 299 '--build-dir', CHROME_OUT_DIR, |
| 277 '--build-number', build_number, | 300 '--build-number', build_number, |
| 278 '--builder-name', builder_name, | 301 '--builder-name', builder_name, |
| 279 '--gs-bucket', gs_bucket]) | 302 '--gs-bucket', gs_bucket]) |
| 280 | 303 |
| 281 | 304 |
| 305 def _ParseLayoutTestResults(results): | |
| 306 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results | |
| 307 tests = _ConvertTrieToFlatPaths(results['tests']) | |
| 308 failures = {} | |
| 309 flakes = {} | |
| 310 passes = {} | |
| 311 for (test, result) in tests.iteritems(): | |
| 312 if result.get('is_unexpected'): | |
| 313 actual_result = result['actual'] | |
| 314 if ' PASS' in actual_result: | |
| 315 flakes[test] = actual_result | |
| 316 elif actual_result == 'PASS': | |
| 317 passes[test] = result | |
| 318 else: | |
| 319 failures[test] = actual_result | |
| 320 | |
| 321 return (passes, failures, flakes) | |
| 322 | |
| 323 | |
| 324 def _ConvertTrieToFlatPaths(trie, prefix=None): | |
| 325 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results | |
| 326 result = {} | |
| 327 for name, data in trie.iteritems(): | |
| 328 if prefix: | |
| 329 name = prefix + "/" + name | |
| 330 | |
| 331 if len(data) and not "actual" in data and not "expected" in data: | |
| 332 result.update(_ConvertTrieToFlatPaths(data, name)) | |
| 333 else: | |
| 334 result[name] = data | |
| 335 | |
| 336 return result | |
| 337 | |
| 338 | |
| 339 def _PrintDashboardLink(link_text, tests, max_tests): | |
| 340 if len(tests) > max_tests: | |
| 341 test_list_text = ' '.join(tests[:max_tests]) + ' and more' | |
| 342 else: | |
| 343 test_list_text = ' '.join(tests) | |
| 344 | |
| 345 DASHBOARD_BASE = ("http://test-results.appspot.com" | |
| 346 "/dashboards/flakiness_dashboard.html#" | |
| 347 "master=ChromiumWebkit&tests=") | |
| 348 | |
| 349 bb_annotations.PrintLink('%d %s: %s' % | |
| 350 (len(tests), link_text, test_list_text), | |
| 351 DASHBOARD_BASE + ','.join(tests)) | |
| 352 | |
| 353 | |
| 282 def EscapeBuilderName(builder_name): | 354 def EscapeBuilderName(builder_name): |
| 283 return re.sub('[ ()]', '_', builder_name) | 355 return re.sub('[ ()]', '_', builder_name) |
| 284 | 356 |
| 285 | 357 |
| 286 def SpawnLogcatMonitor(): | 358 def SpawnLogcatMonitor(): |
| 287 shutil.rmtree(LOGCAT_DIR, ignore_errors=True) | 359 shutil.rmtree(LOGCAT_DIR, ignore_errors=True) |
| 288 bb_utils.SpawnCmd([ | 360 bb_utils.SpawnCmd([ |
| 289 os.path.join(CHROME_SRC_DIR, 'build', 'android', 'adb_logcat_monitor.py'), | 361 os.path.join(CHROME_SRC_DIR, 'build', 'android', 'adb_logcat_monitor.py'), |
| 290 LOGCAT_DIR]) | 362 LOGCAT_DIR]) |
| 291 | 363 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 563 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
| 492 if options.coverage_bucket: | 564 if options.coverage_bucket: |
| 493 setattr(options, 'coverage_dir', | 565 setattr(options, 'coverage_dir', |
| 494 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 566 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 495 | 567 |
| 496 MainTestWrapper(options) | 568 MainTestWrapper(options) |
| 497 | 569 |
| 498 | 570 |
| 499 if __name__ == '__main__': | 571 if __name__ == '__main__': |
| 500 sys.exit(main(sys.argv)) | 572 sys.exit(main(sys.argv)) |
| OLD | NEW |