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 json |
10 import os | 10 import os |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 for test in INSTRUMENTATION_TESTS.itervalues(): | 491 for test in INSTRUMENTATION_TESTS.itervalues(): |
492 RunInstrumentationSuite(options, test) | 492 RunInstrumentationSuite(options, test) |
493 | 493 |
494 | 494 |
495 def RunWebkitTests(options): | 495 def RunWebkitTests(options): |
496 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) | 496 RunTestSuites(options, ['webkit_unit_tests', 'blink_heap_unittests']) |
497 RunWebkitLint() | 497 RunWebkitLint() |
498 | 498 |
499 | 499 |
500 def RunGPUTests(options): | 500 def RunGPUTests(options): |
| 501 exit_code = 0 |
501 revision = _GetRevision(options) | 502 revision = _GetRevision(options) |
502 builder_name = options.build_properties.get('buildername', 'noname') | 503 builder_name = options.build_properties.get('buildername', 'noname') |
503 | 504 |
504 bb_annotations.PrintNamedStep('pixel_tests') | 505 bb_annotations.PrintNamedStep('pixel_tests') |
505 RunCmd(['content/test/gpu/run_gpu_test.py', | 506 exit_code = RunCmd(['content/test/gpu/run_gpu_test.py', |
506 'pixel', '-v', | 507 'pixel', '-v', |
507 '--browser', | 508 '--browser', |
508 'android-content-shell', | 509 'android-content-shell', |
509 '--build-revision', | 510 '--build-revision', |
510 str(revision), | 511 str(revision), |
511 '--upload-refimg-to-cloud-storage', | 512 '--upload-refimg-to-cloud-storage', |
512 '--refimg-cloud-storage-bucket', | 513 '--refimg-cloud-storage-bucket', |
513 'chromium-gpu-archive/reference-images', | 514 'chromium-gpu-archive/reference-images', |
514 '--os-type', | 515 '--os-type', |
515 'android', | 516 'android', |
516 '--test-machine-name', | 517 '--test-machine-name', |
517 EscapeBuilderName(builder_name), | 518 EscapeBuilderName(builder_name), |
518 '--android-blacklist-file', | 519 '--android-blacklist-file', |
519 'out/bad_devices.json']) | 520 'out/bad_devices.json']) or exit_code |
520 | 521 |
521 bb_annotations.PrintNamedStep('webgl_conformance_tests') | 522 bb_annotations.PrintNamedStep('webgl_conformance_tests') |
522 RunCmd(['content/test/gpu/run_gpu_test.py', '-v', | 523 exit_code = RunCmd(['content/test/gpu/run_gpu_test.py', '-v', |
523 '--browser=android-content-shell', 'webgl_conformance', | 524 '--browser=android-content-shell', 'webgl_conformance', |
524 '--webgl-conformance-version=1.0.1', | 525 '--webgl-conformance-version=1.0.1', |
525 '--android-blacklist-file', | 526 '--android-blacklist-file', |
526 'out/bad_devices.json']) | 527 'out/bad_devices.json']) or exit_code |
527 | 528 |
528 bb_annotations.PrintNamedStep('android_webview_webgl_conformance_tests') | 529 bb_annotations.PrintNamedStep('android_webview_webgl_conformance_tests') |
529 RunCmd(['content/test/gpu/run_gpu_test.py', '-v', | 530 exit_code = RunCmd(['content/test/gpu/run_gpu_test.py', '-v', |
530 '--browser=android-webview-shell', 'webgl_conformance', | 531 '--browser=android-webview-shell', 'webgl_conformance', |
531 '--webgl-conformance-version=1.0.1', | 532 '--webgl-conformance-version=1.0.1', |
532 '--android-blacklist-file', | 533 '--android-blacklist-file', |
533 'out/bad_devices.json']) | 534 'out/bad_devices.json']) or exit_code |
534 | 535 |
535 bb_annotations.PrintNamedStep('gpu_rasterization_tests') | 536 bb_annotations.PrintNamedStep('gpu_rasterization_tests') |
536 RunCmd(['content/test/gpu/run_gpu_test.py', | 537 exit_code = RunCmd(['content/test/gpu/run_gpu_test.py', |
537 'gpu_rasterization', '-v', | 538 'gpu_rasterization', '-v', |
538 '--browser', | 539 '--browser', |
539 'android-content-shell', | 540 'android-content-shell', |
540 '--build-revision', | 541 '--build-revision', |
541 str(revision), | 542 str(revision), |
542 '--test-machine-name', | 543 '--test-machine-name', |
543 EscapeBuilderName(builder_name), | 544 EscapeBuilderName(builder_name), |
544 '--android-blacklist-file', | 545 '--android-blacklist-file', |
545 'out/bad_devices.json']) | 546 'out/bad_devices.json']) or exit_code |
| 547 |
| 548 return exit_code |
546 | 549 |
547 | 550 |
548 def RunPythonUnitTests(_options): | 551 def RunPythonUnitTests(_options): |
549 for suite in constants.PYTHON_UNIT_TEST_SUITES: | 552 for suite in constants.PYTHON_UNIT_TEST_SUITES: |
550 bb_annotations.PrintNamedStep(suite) | 553 bb_annotations.PrintNamedStep(suite) |
551 RunCmd(['build/android/test_runner.py', 'python', '-s', suite]) | 554 RunCmd(['build/android/test_runner.py', 'python', '-s', suite]) |
552 | 555 |
553 | 556 |
554 def GetTestStepCmds(): | 557 def GetTestStepCmds(): |
555 return [ | 558 return [ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 649 |
647 def GenerateTestReport(options): | 650 def GenerateTestReport(options): |
648 bb_annotations.PrintNamedStep('test_report') | 651 bb_annotations.PrintNamedStep('test_report') |
649 for report in glob.glob( | 652 for report in glob.glob( |
650 os.path.join(CHROME_OUT_DIR, options.target, 'test_logs', '*.log')): | 653 os.path.join(CHROME_OUT_DIR, options.target, 'test_logs', '*.log')): |
651 RunCmd(['cat', report]) | 654 RunCmd(['cat', report]) |
652 os.remove(report) | 655 os.remove(report) |
653 | 656 |
654 | 657 |
655 def MainTestWrapper(options): | 658 def MainTestWrapper(options): |
| 659 exit_code = 0 |
656 try: | 660 try: |
657 # Spawn logcat monitor | 661 # Spawn logcat monitor |
658 SpawnLogcatMonitor() | 662 SpawnLogcatMonitor() |
659 | 663 |
660 # Run all device setup steps | 664 # Run all device setup steps |
661 for _, cmd in GetDeviceSetupStepCmds(): | 665 for _, cmd in GetDeviceSetupStepCmds(): |
662 cmd(options) | 666 cmd(options) |
663 | 667 |
664 if options.install: | 668 if options.install: |
665 for i in options.install: | 669 for i in options.install: |
666 install_obj = INSTALLABLE_PACKAGES[i] | 670 install_obj = INSTALLABLE_PACKAGES[i] |
667 InstallApk(options, install_obj, print_step=True) | 671 InstallApk(options, install_obj, print_step=True) |
668 | 672 |
669 if options.test_filter: | 673 if options.test_filter: |
670 bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options) | 674 exit_code = bb_utils.RunSteps( |
| 675 options.test_filter, GetTestStepCmds(), options) or exit_code |
671 | 676 |
672 if options.coverage_bucket: | 677 if options.coverage_bucket: |
673 coverage_html = GenerateJavaCoverageReport(options) | 678 coverage_html = GenerateJavaCoverageReport(options) |
674 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, | 679 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, |
675 'Coverage Report') | 680 'Coverage Report') |
676 shutil.rmtree(coverage_html, ignore_errors=True) | 681 shutil.rmtree(coverage_html, ignore_errors=True) |
677 | 682 |
678 if options.experimental: | 683 if options.experimental: |
679 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) | 684 exit_code = RunTestSuites( |
| 685 options, gtest_config.EXPERIMENTAL_TEST_SUITES) or exit_code |
| 686 |
| 687 return exit_code |
680 | 688 |
681 finally: | 689 finally: |
682 # Run all post test steps | 690 # Run all post test steps |
683 LogcatDump(options) | 691 LogcatDump(options) |
684 if not options.disable_stack_tool: | 692 if not options.disable_stack_tool: |
685 RunStackToolSteps(options) | 693 RunStackToolSteps(options) |
686 GenerateTestReport(options) | 694 GenerateTestReport(options) |
687 # KillHostHeartbeat() has logic to check if heartbeat process is running, | 695 # KillHostHeartbeat() has logic to check if heartbeat process is running, |
688 # and kills only if it finds the process is running on the host. | 696 # and kills only if it finds the process is running on the host. |
689 provision_devices.KillHostHeartbeat() | 697 provision_devices.KillHostHeartbeat() |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 if options.chrome_output_dir: | 769 if options.chrome_output_dir: |
762 global CHROME_OUT_DIR | 770 global CHROME_OUT_DIR |
763 global LOGCAT_DIR | 771 global LOGCAT_DIR |
764 CHROME_OUT_DIR = options.chrome_output_dir | 772 CHROME_OUT_DIR = options.chrome_output_dir |
765 LOGCAT_DIR = os.path.join(CHROME_OUT_DIR, 'logcat') | 773 LOGCAT_DIR = os.path.join(CHROME_OUT_DIR, 'logcat') |
766 | 774 |
767 if options.coverage_bucket: | 775 if options.coverage_bucket: |
768 setattr(options, 'coverage_dir', | 776 setattr(options, 'coverage_dir', |
769 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 777 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
770 | 778 |
771 MainTestWrapper(options) | 779 return MainTestWrapper(options) |
772 | 780 |
773 | 781 |
774 if __name__ == '__main__': | 782 if __name__ == '__main__': |
775 sys.exit(main(sys.argv)) | 783 sys.exit(main(sys.argv)) |
OLD | NEW |