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 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 '--no-xvfb', | |
|
jbudorick
2014/07/23 14:23:12
style nit: continuation lines should be indented 4
qyearsley
2014/07/23 18:56:38
Note: Passing --no-xvfb appears to have no effect
zty
2014/07/23 19:53:21
Acknowledged.
zty
2014/07/23 19:53:22
Acknowledged.
| |
| 110 '--test-type', | |
| 111 suite, | |
| 112 '--run-python-script' | |
| 113 ] + property_args | |
|
jbudorick
2014/07/23 14:23:12
style: this should be indented
| |
| 114 if options.factory_properties.get('generate_gtest_json'): | |
| 115 args.append('--generate-json-file') | |
| 116 | |
| 117 if options.target == 'Release': | |
| 118 args += ['--target', 'Release'] | |
| 119 args += cmd | |
| 120 RunCmd(args) | |
| 121 | |
| 122 | |
| 99 def RunTestSuites(options, suites, suites_options=None): | 123 def RunTestSuites(options, suites, suites_options=None): |
| 100 """Manages an invocation of test_runner.py for gtests. | 124 """Manages an invocation of test_runner.py for gtests. |
| 101 | 125 |
| 102 Args: | 126 Args: |
| 103 options: options object. | 127 options: options object. |
| 104 suites: List of suite names to run. | 128 suites: List of suite names to run. |
| 105 suites_options: Command line options dictionary for particular suites. | 129 suites_options: Command line options dictionary for particular suites. |
| 106 For example, | 130 For example, |
| 107 {'content_browsertests', ['--num_retries=1', '--release']} | 131 {'content_browsertests', ['--num_retries=1', '--release']} |
| 108 will add the options only to content_browsertests. | 132 will add the options only to content_browsertests. |
| 109 """ | 133 """ |
| 110 | 134 |
| 111 if not suites_options: | 135 if not suites_options: |
| 112 suites_options = {} | 136 suites_options = {} |
| 113 | 137 |
| 114 args = ['--verbose'] | 138 args = ['--verbose'] |
| 115 if options.target == 'Release': | 139 if options.target == 'Release': |
| 116 args.append('--release') | 140 args.append('--release') |
| 117 if options.asan: | 141 if options.asan: |
| 118 args.append('--tool=asan') | 142 args.append('--tool=asan') |
| 119 if options.gtest_filter: | 143 if options.gtest_filter: |
| 120 args.append('--gtest-filter=%s' % options.gtest_filter) | 144 args.append('--gtest-filter=%s' % options.gtest_filter) |
| 121 | 145 |
| 122 for suite in suites: | 146 for suite in suites: |
| 123 bb_annotations.PrintNamedStep(suite) | 147 bb_annotations.PrintNamedStep(suite) |
| 124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args | 148 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args |
|
jbudorick
2014/07/23 14:23:12
This seems to be partially duplicated in _MainAndr
zty
2014/07/23 19:53:22
Notice here we use --run-python-script, which make
| |
| 125 cmd += suites_options.get(suite, []) | 149 cmd += suites_options.get(suite, []) |
| 126 if suite == 'content_browsertests': | 150 if suite == 'content_browsertests': |
| 127 cmd.append('--num_retries=1') | 151 cmd.append('--num_retries=1') |
| 128 RunCmd(cmd) | 152 _RunTest(options, cmd, suite) |
| 129 | 153 |
| 130 | 154 |
| 131 def RunChromeDriverTests(options): | 155 def RunChromeDriverTests(options): |
| 132 """Run all the steps for running chromedriver tests.""" | 156 """Run all the steps for running chromedriver tests.""" |
| 133 bb_annotations.PrintNamedStep('chromedriver_annotation') | 157 bb_annotations.PrintNamedStep('chromedriver_annotation') |
| 134 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', | 158 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', |
| 135 '--android-packages=%s,%s,%s,%s' % | 159 '--android-packages=%s,%s,%s,%s' % |
| 136 ('chrome_shell', | 160 ('chrome_shell', |
| 137 'chrome_stable', | 161 'chrome_stable', |
| 138 'chrome_beta', | 162 'chrome_beta', |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 | 713 |
| 690 if options.coverage_bucket: | 714 if options.coverage_bucket: |
| 691 setattr(options, 'coverage_dir', | 715 setattr(options, 'coverage_dir', |
| 692 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 716 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
| 693 | 717 |
| 694 MainTestWrapper(options) | 718 MainTestWrapper(options) |
| 695 | 719 |
| 696 | 720 |
| 697 if __name__ == '__main__': | 721 if __name__ == '__main__': |
| 698 sys.exit(main(sys.argv)) | 722 sys.exit(main(sys.argv)) |
| OLD | NEW |