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 multiprocessing | 9 import multiprocessing |
10 import os | 10 import os |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 'AndroidWebViewTest', | 69 'AndroidWebViewTest', |
70 'webview:android_webview/test/data/device_files'), | 70 'webview:android_webview/test/data/device_files'), |
71 ]) | 71 ]) |
72 | 72 |
73 VALID_TESTS = set(['chromedriver', 'gpu', 'ui', 'unit', 'webkit', | 73 VALID_TESTS = set(['chromedriver', 'gpu', 'ui', 'unit', 'webkit', |
74 'webkit_layout', 'webrtc']) | 74 'webkit_layout', 'webrtc']) |
75 | 75 |
76 RunCmd = bb_utils.RunCmd | 76 RunCmd = bb_utils.RunCmd |
77 | 77 |
78 | 78 |
| 79 def _GetRevision(options): |
| 80 """Get the SVN revision number. |
| 81 |
| 82 Args: |
| 83 options: options object. |
| 84 |
| 85 Returns: |
| 86 The revision number. |
| 87 """ |
| 88 revision = options.build_properties.get('got_revision') |
| 89 if not revision: |
| 90 revision = options.build_properties.get('revision', 'testing') |
| 91 return revision |
| 92 |
| 93 |
79 # multiprocessing map_async requires a top-level function for pickle library. | 94 # multiprocessing map_async requires a top-level function for pickle library. |
80 def RebootDeviceSafe(device): | 95 def RebootDeviceSafe(device): |
81 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" | 96 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" |
82 try: | 97 try: |
83 android_commands.AndroidCommands(device).Reboot(True) | 98 android_commands.AndroidCommands(device).Reboot(True) |
84 except errors.DeviceUnresponsiveError as e: | 99 except errors.DeviceUnresponsiveError as e: |
85 return e | 100 return e |
86 | 101 |
87 | 102 |
88 def RebootDevices(): | 103 def RebootDevices(): |
(...skipping 30 matching lines...) Expand all Loading... |
119 args.append('--release') | 134 args.append('--release') |
120 if options.asan: | 135 if options.asan: |
121 args.append('--tool=asan') | 136 args.append('--tool=asan') |
122 for suite in suites: | 137 for suite in suites: |
123 bb_annotations.PrintNamedStep(suite) | 138 bb_annotations.PrintNamedStep(suite) |
124 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args | 139 cmd = ['build/android/test_runner.py', 'gtest', '-s', suite] + args |
125 if suite == 'content_browsertests': | 140 if suite == 'content_browsertests': |
126 cmd.append('--num_retries=1') | 141 cmd.append('--num_retries=1') |
127 RunCmd(cmd) | 142 RunCmd(cmd) |
128 | 143 |
129 def RunChromeDriverTests(_): | 144 def RunChromeDriverTests(options): |
130 """Run all the steps for running chromedriver tests.""" | 145 """Run all the steps for running chromedriver tests.""" |
131 bb_annotations.PrintNamedStep('chromedriver_annotation') | 146 bb_annotations.PrintNamedStep('chromedriver_annotation') |
132 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', | 147 RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py', |
133 '--android-packages=%s,%s,%s' % | 148 '--android-packages=%s,%s,%s' % |
134 (constants.PACKAGE_INFO['chromium_test_shell'].package, | 149 (constants.PACKAGE_INFO['chromium_test_shell'].package, |
135 constants.PACKAGE_INFO['chrome_stable'].package, | 150 constants.PACKAGE_INFO['chrome_stable'].package, |
136 constants.PACKAGE_INFO['chrome_beta'].package)]) | 151 constants.PACKAGE_INFO['chrome_beta'].package), |
| 152 '--revision=%s' % _GetRevision(options), |
| 153 '--update_log']) |
137 | 154 |
138 def InstallApk(options, test, print_step=False): | 155 def InstallApk(options, test, print_step=False): |
139 """Install an apk to all phones. | 156 """Install an apk to all phones. |
140 | 157 |
141 Args: | 158 Args: |
142 options: options object | 159 options: options object |
143 test: An I_TEST namedtuple | 160 test: An I_TEST namedtuple |
144 print_step: Print a buildbot step | 161 print_step: Print a buildbot step |
145 """ | 162 """ |
146 if print_step: | 163 if print_step: |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 372 |
356 Args: | 373 Args: |
357 options: Command line options. | 374 options: Command line options. |
358 gs_base_dir: The Google Storage base directory (e.g. | 375 gs_base_dir: The Google Storage base directory (e.g. |
359 'chromium-code-coverage/java') | 376 'chromium-code-coverage/java') |
360 dir_to_upload: Absolute path to the directory to be uploaded. | 377 dir_to_upload: Absolute path to the directory to be uploaded. |
361 link_text: Link text to be displayed on the step. | 378 link_text: Link text to be displayed on the step. |
362 link_rel_path: Link path relative to |dir_to_upload|. | 379 link_rel_path: Link path relative to |dir_to_upload|. |
363 gs_url: Google storage URL. | 380 gs_url: Google storage URL. |
364 """ | 381 """ |
365 revision = options.build_properties.get('got_revision') | 382 revision = _GetRevision(options) |
366 if not revision: | |
367 revision = options.build_properties.get('revision', 'testing') | |
368 bot_id = options.build_properties.get('buildername', 'testing') | 383 bot_id = options.build_properties.get('buildername', 'testing') |
369 randhash = hashlib.sha1(str(random.random())).hexdigest() | 384 randhash = hashlib.sha1(str(random.random())).hexdigest() |
370 gs_path = '%s/%s/%s/%s' % (gs_base_dir, bot_id, revision, randhash) | 385 gs_path = '%s/%s/%s/%s' % (gs_base_dir, bot_id, revision, randhash) |
371 RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-R', dir_to_upload, 'gs://%s' % gs_path]) | 386 RunCmd([bb_utils.GSUTIL_PATH, 'cp', '-R', dir_to_upload, 'gs://%s' % gs_path]) |
372 bb_annotations.PrintLink(link_text, | 387 bb_annotations.PrintLink(link_text, |
373 '%s/%s/%s' % (gs_url, gs_path, link_rel_path)) | 388 '%s/%s/%s' % (gs_url, gs_path, link_rel_path)) |
374 | 389 |
375 | 390 |
376 def GenerateJavaCoverageReport(options): | 391 def GenerateJavaCoverageReport(options): |
377 """Generates an HTML coverage report using EMMA and uploads it.""" | 392 """Generates an HTML coverage report using EMMA and uploads it.""" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 498 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
484 if options.coverage_bucket: | 499 if options.coverage_bucket: |
485 setattr(options, 'coverage_dir', | 500 setattr(options, 'coverage_dir', |
486 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 501 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
487 | 502 |
488 MainTestWrapper(options) | 503 MainTestWrapper(options) |
489 | 504 |
490 | 505 |
491 if __name__ == '__main__': | 506 if __name__ == '__main__': |
492 sys.exit(main(sys.argv)) | 507 sys.exit(main(sys.argv)) |
OLD | NEW |