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 json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 print '<', ' '.join(map(pipes.quote, command)) | 75 print '<', ' '.join(map(pipes.quote, command)) |
76 if code != 0: | 76 if code != 0: |
77 print 'ERROR: non-zero status %d from %s' % (code, command) | 77 print 'ERROR: non-zero status %d from %s' % (code, command) |
78 if flunk_on_failure: | 78 if flunk_on_failure: |
79 buildbot_report.PrintError() | 79 buildbot_report.PrintError() |
80 else: | 80 else: |
81 buildbot_report.PrintWarning() | 81 buildbot_report.PrintWarning() |
82 return code | 82 return code |
83 | 83 |
84 | 84 |
85 def RunTestSuites(options, suite): | 85 def RunTestSuites(options, suites): |
86 """Manages an invocation of run_tests.py. | 86 """Manages an invocation of run_tests.py. |
87 | 87 |
88 Args: | 88 Args: |
89 options: options object. | 89 options: options object. |
90 suite: The suite to pass to run_tests or None to run default suites. | 90 suites: List of suites to run, or None to run default suites. |
91 """ | 91 """ |
92 args = ['--verbose'] | 92 args = ['--verbose'] |
93 if suite: | 93 |
94 args.extend(['-s', suite]) | 94 suites = suites or constants.DEFAULT_UNIT_TEST_SUITES |
95 if options.target == 'Release': | 95 if options.target == 'Release': |
96 args.append('--release') | 96 args.append('--release') |
97 if options.asan: | 97 if options.asan: |
98 args.append('--tool=asan') | 98 args.append('--tool=asan') |
99 RunCmd(['build/android/run_tests.py'] + args) | 99 for suite in suites: |
| 100 buildbot_report.PrintNamedStep(suite) |
| 101 RunCmd(['build/android/run_tests.py', '-s', suite] + args) |
100 | 102 |
101 | 103 |
102 def InstallApk(apk, apk_package, target): | 104 def InstallApk(apk, apk_package, target): |
103 args = ['--apk', apk, '--apk_package', apk_package] | 105 args = ['--apk', apk, '--apk_package', apk_package] |
104 if target == 'Release': | 106 if target == 'Release': |
105 args.append('--release') | 107 args.append('--release') |
106 | 108 |
107 RunCmd(['build/android/adb_install_apk.py'] + args) | 109 RunCmd(['build/android/adb_install_apk.py'] + args) |
108 | 110 |
109 | 111 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') | 175 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') |
174 shutil.rmtree(logcat_dir, ignore_errors=True) | 176 shutil.rmtree(logcat_dir, ignore_errors=True) |
175 SpawnCmd(['build/android/adb_logcat_monitor.py', logcat_dir]) | 177 SpawnCmd(['build/android/adb_logcat_monitor.py', logcat_dir]) |
176 | 178 |
177 if 'unit' in options.test_filter: | 179 if 'unit' in options.test_filter: |
178 RunTestSuites(options, None) | 180 RunTestSuites(options, None) |
179 if 'ui' in options.test_filter: | 181 if 'ui' in options.test_filter: |
180 for test in INSTRUMENTATION_TESTS.itervalues(): | 182 for test in INSTRUMENTATION_TESTS.itervalues(): |
181 RunInstrumentationSuite(options, test) | 183 RunInstrumentationSuite(options, test) |
182 if 'webkit' in options.test_filter: | 184 if 'webkit' in options.test_filter: |
183 RunTestSuites(options, 'webkit_unit_tests') | 185 RunTestSuites(options, ['webkit_unit_tests']) |
184 RunTestSuites(options, 'TestWebKitAPI') | 186 RunTestSuites(options, ['TestWebKitAPI']) |
185 RunWebkitLint(options.target) | 187 RunWebkitLint(options.target) |
186 if 'webkit_layout' in options.test_filter: | 188 if 'webkit_layout' in options.test_filter: |
187 RunWebkitLayoutTests(options) | 189 RunWebkitLayoutTests(options) |
188 | 190 |
189 if options.experimental: | 191 if options.experimental: |
190 RunTestSuites(options, 'sandbox_linux_unittests') | 192 RunTestSuites(options, ['sandbox_linux_unittests']) |
191 | 193 |
192 # Print logcat, kill logcat monitor | 194 # Print logcat, kill logcat monitor |
193 buildbot_report.PrintNamedStep('Logcat dump') | 195 buildbot_report.PrintNamedStep('logcat_dump') |
194 RunCmd(['build/android/adb_logcat_printer.py', logcat_dir]) | 196 RunCmd(['build/android/adb_logcat_printer.py', logcat_dir]) |
195 | 197 |
196 buildbot_report.PrintNamedStep('Test report') | 198 buildbot_report.PrintNamedStep('test_report') |
197 for report in glob.glob( | 199 for report in glob.glob( |
198 os.path.join(CHROME_SRC, 'out', options.target, 'test_logs', '*.log')): | 200 os.path.join(CHROME_SRC, 'out', options.target, 'test_logs', '*.log')): |
199 subprocess.Popen(['cat', report]).wait() | 201 subprocess.Popen(['cat', report]).wait() |
200 os.remove(report) | 202 os.remove(report) |
201 | 203 |
202 | 204 |
203 def main(argv): | 205 def main(argv): |
204 parser = optparse.OptionParser() | 206 parser = optparse.OptionParser() |
205 | 207 |
206 def convert_json(option, _, value, parser): | 208 def convert_json(option, _, value, parser): |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if unknown_tests: | 241 if unknown_tests: |
240 return ParserError('Unknown tests %s' % list(unknown_tests)) | 242 return ParserError('Unknown tests %s' % list(unknown_tests)) |
241 | 243 |
242 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 244 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
243 | 245 |
244 MainTestWrapper(options) | 246 MainTestWrapper(options) |
245 | 247 |
246 | 248 |
247 if __name__ == '__main__': | 249 if __name__ == '__main__': |
248 sys.exit(main(sys.argv)) | 250 sys.exit(main(sys.argv)) |
OLD | NEW |