| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 Returns: | 90 Returns: |
| 91 The revision number. | 91 The revision number. |
| 92 """ | 92 """ |
| 93 revision = options.build_properties.get('got_revision') | 93 revision = options.build_properties.get('got_revision') |
| 94 if not revision: | 94 if not revision: |
| 95 revision = options.build_properties.get('revision', 'testing') | 95 revision = options.build_properties.get('revision', 'testing') |
| 96 return revision | 96 return revision |
| 97 | 97 |
| 98 | 98 |
| 99 def _RunTest(options, cmd, suite): | |
| 100 """Run test command with runtest.py. | |
| 101 | |
| 102 Args: | |
| 103 options: options object. | |
| 104 cmd: the command to run. | |
| 105 suite: test name. | |
| 106 """ | |
| 107 property_args = bb_utils.EncodeProperties(options) | |
| 108 args = [os.path.join(SLAVE_SCRIPTS_DIR, 'runtest.py'), | |
| 109 '--test-type', | |
| 110 suite, | |
| 111 '--run-python-script' | |
| 112 ] + property_args | |
| 113 if options.factory_properties.get('generate_gtest_json'): | |
| 114 args.append('--generate-json-file') | |
| 115 | |
| 116 if options.target == 'Release': | |
| 117 args += ['--target', 'Release'] | |
| 118 args += cmd | |
| 119 RunCmd(args) | |
| 120 | |
| 121 | |
| 122 def RunTestSuites(options, suites, suites_options=None): | 99 def RunTestSuites(options, suites, suites_options=None): |
| 123 """Manages an invocation of test_runner.py for gtests. | 100 """Manages an invocation of test_runner.py for gtests. |
| 124 | 101 |
| 125 Args: | 102 Args: |
| 126 options: options object. | 103 options: options object. |
| 127 suites: List of suite names to run. | 104 suites: List of suite names to run. |
| 128 suites_options: Command line options dictionary for particular suites. | 105 suites_options: Command line options dictionary for particular suites. |
| 129 For example, | 106 For example, |
| 130 {'content_browsertests', ['--num_retries=1', '--release']} | 107 {'content_browsertests', ['--num_retries=1', '--release']} |
| 131 will add the options only to content_browsertests. | 108 will add the options only to content_browsertests. |
| 132 """ | 109 """ |
| 133 | 110 |
| 134 if not suites_options: | 111 if not suites_options: |
| 135 suites_options = {} | 112 suites_options = {} |
| 136 | 113 |
| 137 args = ['--verbose'] | 114 args = ['--verbose'] |
| 138 if options.target == 'Release': | 115 if options.target == 'Release': |
| 139 args.append('--release') | 116 args.append('--release') |
| 140 if options.asan: | 117 if options.asan: |
| 141 args.append('--tool=asan') | 118 args.append('--tool=asan') |
| 142 if options.gtest_filter: | 119 if options.gtest_filter: |
| 143 args.append('--gtest-filter=%s' % options.gtest_filter) | 120 args.append('--gtest-filter=%s' % options.gtest_filter) |
| 144 | 121 |
| 145 for suite in suites: | 122 for suite in suites: |
| 146 bb_annotations.PrintNamedStep(suite) | 123 bb_annotations.PrintNamedStep(suite) |
| 147 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args | 124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args |
| 148 cmd += suites_options.get(suite, []) | 125 cmd += suites_options.get(suite, []) |
| 149 if suite == 'content_browsertests': | 126 if suite == 'content_browsertests': |
| 150 cmd.append('--num_retries=1') | 127 cmd.append('--num_retries=1') |
| 151 _RunTest(options, cmd, suite) | 128 RunCmd(cmd) |
| 152 | 129 |
| 153 | 130 |
| 154 def RunChromeDriverTests(options): | 131 def RunChromeDriverTests(options): |
| 155 """Run all the steps for running chromedriver tests.""" | 132 """Run all the steps for running chromedriver tests.""" |
| 156 bb_annotations.PrintNamedStep('chromedriver_annotation') | 133 bb_annotations.PrintNamedStep('chromedriver_annotation') |
| 157 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', | 134 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', |
| 158 '--android-packages=%s,%s,%s,%s' % | 135 '--android-packages=%s,%s,%s,%s' % |
| 159 ('chrome_shell', | 136 ('chrome_shell', |
| 160 'chrome_stable', | 137 'chrome_stable', |
| 161 'chrome_beta', | 138 'chrome_beta', |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 689 |
| 713 if options.coverage_bucket: | 690 if options.coverage_bucket: |
| 714 setattr(options, 'coverage_dir', | 691 setattr(options, 'coverage_dir', |
| 715 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 692 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 716 | 693 |
| 717 MainTestWrapper(options) | 694 MainTestWrapper(options) |
| 718 | 695 |
| 719 | 696 |
| 720 if __name__ == '__main__': | 697 if __name__ == '__main__': |
| 721 sys.exit(main(sys.argv)) | 698 sys.exit(main(sys.argv)) |
| OLD | NEW |