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 json | 8 import json |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 args = ['--verbose'] | 86 args = ['--verbose'] |
| 87 if suite: | 87 if suite: |
| 88 args.extend(['-s', suite]) | 88 args.extend(['-s', suite]) |
| 89 if options.target == 'Release': | 89 if options.target == 'Release': |
| 90 args.append('--release') | 90 args.append('--release') |
| 91 if options.asan: | 91 if options.asan: |
| 92 args.append('--tool=asan') | 92 args.append('--tool=asan') |
| 93 RunCmd(['build/android/run_tests.py'] + args) | 93 RunCmd(['build/android/run_tests.py'] + args) |
| 94 | 94 |
| 95 | 95 |
| 96 def InstallApk(apk, apk_package, target): | 96 def InstallApk(options, test, print_step=False): |
| 97 args = ['--apk', apk, '--apk_package', apk_package] | 97 """Install an apk to all phones. |
| 98 if target == 'Release': | 98 |
| 99 Args: | |
| 100 options: options object | |
| 101 test: An I_TEST namedtuple | |
| 102 print_step: Print a buildbot step | |
| 103 """ | |
| 104 if print_step: | |
| 105 buildbot_report.PrintNamedStep('install_%s' % test.name.lower()) | |
| 106 args = ['--apk', test.apk, '--apk_package', test.apk_package] | |
| 107 if options.target == 'Release': | |
| 99 args.append('--release') | 108 args.append('--release') |
| 100 | 109 |
| 101 RunCmd(['build/android/adb_install_apk.py'] + args) | 110 RunCmd(['build/android/adb_install_apk.py'] + args) |
| 102 | 111 |
| 103 | 112 |
| 104 def RunInstrumentationSuite(options, test): | 113 def RunInstrumentationSuite(options, test): |
| 105 """Manages an invocation of run_instrumentaiton_tests.py. | 114 """Manages an invocation of run_instrumentaiton_tests.py. |
| 106 | 115 |
| 107 Args: | 116 Args: |
| 108 options: options object | 117 options: options object |
| 109 test: An I_TEST namedtuple | 118 test: An I_TEST namedtuple |
| 110 """ | 119 """ |
| 111 buildbot_report.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) | 120 buildbot_report.PrintNamedStep('%s_instrumentation_tests' % test.name.lower()) |
| 112 | 121 |
| 113 InstallApk(test.apk, test.apk_package, options.target) | 122 InstallApk(options, test) |
|
boliu
2013/01/09 21:13:42
from your cl description, wouldn't you want to set
Isaac (away)
2013/01/09 21:17:31
No, here it is installed as part of the instrument
boliu
2013/01/09 21:20:58
Oh oops, missed line 170.
| |
| 114 args = ['--test-apk', test.test_apk, '--test_data', test.test_data, '-vvv', | 123 args = ['--test-apk', test.test_apk, '--test_data', test.test_data, '-vvv', |
| 115 '-I'] | 124 '-I'] |
| 116 if options.target == 'Release': | 125 if options.target == 'Release': |
| 117 args.append('--release') | 126 args.append('--release') |
| 118 if options.asan: | 127 if options.asan: |
| 119 args.append('--tool=asan') | 128 args.append('--tool=asan') |
| 120 | 129 |
| 121 RunCmd(['build/android/run_instrumentation_tests.py'] + args) | 130 RunCmd(['build/android/run_instrumentation_tests.py'] + args) |
| 122 | 131 |
| 123 | 132 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 151 '--test-results-server', | 160 '--test-results-server', |
| 152 options.factory_properties.get('test_results_server', '')]) | 161 options.factory_properties.get('test_results_server', '')]) |
| 153 | 162 |
| 154 | 163 |
| 155 def MainTestWrapper(options): | 164 def MainTestWrapper(options): |
| 156 # Device check and alert emails | 165 # Device check and alert emails |
| 157 RunCmd(['build/android/device_status_check.py'], flunk_on_failure=False) | 166 RunCmd(['build/android/device_status_check.py'], flunk_on_failure=False) |
| 158 | 167 |
| 159 if options.install: | 168 if options.install: |
| 160 test_obj = INSTRUMENTATION_TESTS[options.install] | 169 test_obj = INSTRUMENTATION_TESTS[options.install] |
| 161 InstallApk(test_obj.apk, test_obj.apk_package, options.target) | 170 InstallApk(options, test_obj, print_step=True) |
| 162 | 171 |
| 163 if not options.test_filter: | 172 if not options.test_filter: |
| 164 return | 173 return |
| 165 | 174 |
| 166 # Spawn logcat monitor | 175 # Spawn logcat monitor |
| 167 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') | 176 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') |
| 168 shutil.rmtree(logcat_dir, ignore_errors=True) | 177 shutil.rmtree(logcat_dir, ignore_errors=True) |
| 169 if not TESTING: | 178 if not TESTING: |
| 170 subprocess.Popen( | 179 subprocess.Popen( |
| 171 ['build/android/adb_logcat_monitor.py', logcat_dir], cwd=CHROME_SRC) | 180 ['build/android/adb_logcat_monitor.py', logcat_dir], cwd=CHROME_SRC) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 if unknown_tests: | 244 if unknown_tests: |
| 236 return ParserError('Unknown tests %s' % list(unknown_tests)) | 245 return ParserError('Unknown tests %s' % list(unknown_tests)) |
| 237 | 246 |
| 238 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 247 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
| 239 | 248 |
| 240 MainTestWrapper(options) | 249 MainTestWrapper(options) |
| 241 | 250 |
| 242 | 251 |
| 243 if __name__ == '__main__': | 252 if __name__ == '__main__': |
| 244 sys.exit(main(sys.argv)) | 253 sys.exit(main(sys.argv)) |
| OLD | NEW |