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')] + property_args | |
109 args += ['--test-platform', 'android'] | |
110 if options.factory_properties.get('generate_gtest_json'): | |
111 args.append('--generate-json-file') | |
112 args += ['-o', 'gtest-results/%s' % suite, | |
113 '--annotate', 'gtest', | |
114 '--build-number', str(options.build_properties.get('buildnumber', | |
115 '')), | |
116 '--builder-name', options.build_properties.get('buildername', '')] | |
117 | |
118 if options.target == 'Release': | |
119 args += ['--target', 'Release'] | |
120 args += cmd | |
121 RunCmd(args, cwd=DIR_BUILD_ROOT) | |
122 | |
123 | |
124 def RunTestSuites(options, suites, suites_options=None): | 99 def RunTestSuites(options, suites, suites_options=None): |
125 """Manages an invocation of test_runner.py for gtests. | 100 """Manages an invocation of test_runner.py for gtests. |
126 | 101 |
127 Args: | 102 Args: |
128 options: options object. | 103 options: options object. |
129 suites: List of suite names to run. | 104 suites: List of suite names to run. |
130 suites_options: Command line options dictionary for particular suites. | 105 suites_options: Command line options dictionary for particular suites. |
131 For example, | 106 For example, |
132 {'content_browsertests', ['--num_retries=1', '--release']} | 107 {'content_browsertests', ['--num_retries=1', '--release']} |
133 will add the options only to content_browsertests. | 108 will add the options only to content_browsertests. |
134 """ | 109 """ |
135 | 110 |
136 if not suites_options: | 111 if not suites_options: |
137 suites_options = {} | 112 suites_options = {} |
138 | 113 |
139 args = ['--verbose'] | 114 args = ['--verbose'] |
140 if options.target == 'Release': | 115 if options.target == 'Release': |
141 args.append('--release') | 116 args.append('--release') |
142 if options.asan: | 117 if options.asan: |
143 args.append('--tool=asan') | 118 args.append('--tool=asan') |
144 if options.gtest_filter: | 119 if options.gtest_filter: |
145 args.append('--gtest-filter=%s' % options.gtest_filter) | 120 args.append('--gtest-filter=%s' % options.gtest_filter) |
146 | 121 |
147 for suite in suites: | 122 for suite in suites: |
148 bb_annotations.PrintNamedStep(suite) | 123 bb_annotations.PrintNamedStep(suite) |
149 cmd = [suite] + args | 124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args |
150 cmd += suites_options.get(suite, []) | 125 cmd += suites_options.get(suite, []) |
151 if suite == 'content_browsertests': | 126 if suite == 'content_browsertests': |
152 cmd.append('--num_retries=1') | 127 cmd.append('--num_retries=1') |
153 _RunTest(options, cmd, suite) | 128 RunCmd(cmd) |
154 | 129 |
155 | 130 |
156 def RunChromeDriverTests(options): | 131 def RunChromeDriverTests(options): |
157 """Run all the steps for running chromedriver tests.""" | 132 """Run all the steps for running chromedriver tests.""" |
158 bb_annotations.PrintNamedStep('chromedriver_annotation') | 133 bb_annotations.PrintNamedStep('chromedriver_annotation') |
159 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', | 134 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', |
160 '--android-packages=%s,%s,%s,%s' % | 135 '--android-packages=%s,%s,%s,%s' % |
161 ('chrome_shell', | 136 ('chrome_shell', |
162 'chrome_stable', | 137 'chrome_stable', |
163 'chrome_beta', | 138 'chrome_beta', |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 703 |
729 if options.coverage_bucket: | 704 if options.coverage_bucket: |
730 setattr(options, 'coverage_dir', | 705 setattr(options, 'coverage_dir', |
731 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 706 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
732 | 707 |
733 MainTestWrapper(options) | 708 MainTestWrapper(options) |
734 | 709 |
735 | 710 |
736 if __name__ == '__main__': | 711 if __name__ == '__main__': |
737 sys.exit(main(sys.argv)) | 712 sys.exit(main(sys.argv)) |
OLD | NEW |