| 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 multiprocessing | 10 import multiprocessing |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 523 |
| 524 def LogcatDump(options): | 524 def LogcatDump(options): |
| 525 # Print logcat, kill logcat monitor | 525 # Print logcat, kill logcat monitor |
| 526 bb_annotations.PrintNamedStep('logcat_dump') | 526 bb_annotations.PrintNamedStep('logcat_dump') |
| 527 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log') | 527 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log') |
| 528 RunCmd([SrcPath('build' , 'android', 'adb_logcat_printer.py'), | 528 RunCmd([SrcPath('build' , 'android', 'adb_logcat_printer.py'), |
| 529 '--output-path', logcat_file, LOGCAT_DIR]) | 529 '--output-path', logcat_file, LOGCAT_DIR]) |
| 530 RunCmd(['cat', logcat_file]) | 530 RunCmd(['cat', logcat_file]) |
| 531 | 531 |
| 532 | 532 |
| 533 def RunStackToolSteps(options): |
| 534 """Run stack tool steps. |
| 535 |
| 536 Stack tool is run for logcat dump, optionally for ASAN. |
| 537 """ |
| 538 bb_annotations.PrintNamedStep('Run stack tool with logcat dump') |
| 539 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log') |
| 540 RunCmd([os.path.join(CHROME_SRC_DIR, 'third_party', 'android_platform', |
| 541 'development', 'scripts', 'stack'), |
| 542 '--more-info', logcat_file]) |
| 543 if options.asan_symbolize: |
| 544 bb_annotations.PrintNamedStep('Run stack tool for ASAN') |
| 545 RunCmd([ |
| 546 os.path.join(CHROME_SRC_DIR, 'build', 'android', 'asan_symbolize.py'), |
| 547 '-l', logcat_file]) |
| 548 |
| 549 |
| 533 def GenerateTestReport(options): | 550 def GenerateTestReport(options): |
| 534 bb_annotations.PrintNamedStep('test_report') | 551 bb_annotations.PrintNamedStep('test_report') |
| 535 for report in glob.glob( | 552 for report in glob.glob( |
| 536 os.path.join(CHROME_OUT_DIR, options.target, 'test_logs', '*.log')): | 553 os.path.join(CHROME_OUT_DIR, options.target, 'test_logs', '*.log')): |
| 537 RunCmd(['cat', report]) | 554 RunCmd(['cat', report]) |
| 538 os.remove(report) | 555 os.remove(report) |
| 539 | 556 |
| 540 | 557 |
| 541 def MainTestWrapper(options): | 558 def MainTestWrapper(options): |
| 542 try: | 559 try: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 559 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, | 576 UploadHTML(options, '%s/java' % options.coverage_bucket, coverage_html, |
| 560 'Coverage Report') | 577 'Coverage Report') |
| 561 shutil.rmtree(coverage_html, ignore_errors=True) | 578 shutil.rmtree(coverage_html, ignore_errors=True) |
| 562 | 579 |
| 563 if options.experimental: | 580 if options.experimental: |
| 564 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) | 581 RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) |
| 565 | 582 |
| 566 finally: | 583 finally: |
| 567 # Run all post test steps | 584 # Run all post test steps |
| 568 LogcatDump(options) | 585 LogcatDump(options) |
| 586 if not options.disable_stack_tool: |
| 587 RunStackToolSteps(options) |
| 569 GenerateTestReport(options) | 588 GenerateTestReport(options) |
| 570 # KillHostHeartbeat() has logic to check if heartbeat process is running, | 589 # KillHostHeartbeat() has logic to check if heartbeat process is running, |
| 571 # and kills only if it finds the process is running on the host. | 590 # and kills only if it finds the process is running on the host. |
| 572 provision_devices.KillHostHeartbeat() | 591 provision_devices.KillHostHeartbeat() |
| 573 | 592 |
| 574 | 593 |
| 575 def GetDeviceStepsOptParser(): | 594 def GetDeviceStepsOptParser(): |
| 576 parser = bb_utils.GetParser() | 595 parser = bb_utils.GetParser() |
| 577 parser.add_option('--experimental', action='store_true', | 596 parser.add_option('--experimental', action='store_true', |
| 578 help='Run experiemental tests') | 597 help='Run experiemental tests') |
| (...skipping 16 matching lines...) Expand all Loading... |
| 595 parser.add_option( | 614 parser.add_option( |
| 596 '--flakiness-server', | 615 '--flakiness-server', |
| 597 help=('The flakiness dashboard server to which the results should be ' | 616 help=('The flakiness dashboard server to which the results should be ' |
| 598 'uploaded.')) | 617 'uploaded.')) |
| 599 parser.add_option( | 618 parser.add_option( |
| 600 '--auto-reconnect', action='store_true', | 619 '--auto-reconnect', action='store_true', |
| 601 help='Push script to device which restarts adbd on disconnections.') | 620 help='Push script to device which restarts adbd on disconnections.') |
| 602 parser.add_option( | 621 parser.add_option( |
| 603 '--logcat-dump-output', | 622 '--logcat-dump-output', |
| 604 help='The logcat dump output will be "tee"-ed into this file') | 623 help='The logcat dump output will be "tee"-ed into this file') |
| 605 | 624 parser.add_option('--disable-stack-tool', action='store_true', |
| 625 help='Do not run stack tool.') |
| 626 parser.add_option('--asan-symbolize', action='store_true', |
| 627 help='Run stack tool for ASAN') |
| 606 return parser | 628 return parser |
| 607 | 629 |
| 608 | 630 |
| 609 def main(argv): | 631 def main(argv): |
| 610 parser = GetDeviceStepsOptParser() | 632 parser = GetDeviceStepsOptParser() |
| 611 options, args = parser.parse_args(argv[1:]) | 633 options, args = parser.parse_args(argv[1:]) |
| 612 | 634 |
| 613 if args: | 635 if args: |
| 614 return sys.exit('Unused args %s' % args) | 636 return sys.exit('Unused args %s' % args) |
| 615 | 637 |
| 616 unknown_tests = set(options.test_filter) - VALID_TESTS | 638 unknown_tests = set(options.test_filter) - VALID_TESTS |
| 617 if unknown_tests: | 639 if unknown_tests: |
| 618 return sys.exit('Unknown tests %s' % list(unknown_tests)) | 640 return sys.exit('Unknown tests %s' % list(unknown_tests)) |
| 619 | 641 |
| 620 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 642 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
| 621 if options.coverage_bucket: | 643 if options.coverage_bucket: |
| 622 setattr(options, 'coverage_dir', | 644 setattr(options, 'coverage_dir', |
| 623 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 645 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 624 | 646 |
| 625 MainTestWrapper(options) | 647 MainTestWrapper(options) |
| 626 | 648 |
| 627 | 649 |
| 628 if __name__ == '__main__': | 650 if __name__ == '__main__': |
| 629 sys.exit(main(sys.argv)) | 651 sys.exit(main(sys.argv)) |
| OLD | NEW |