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 multiprocessing | 8 import multiprocessing |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
11 import sys | 11 import sys |
12 | 12 |
13 import bb_utils | 13 import bb_utils |
14 import bb_annotations | 14 import bb_annotations |
15 | 15 |
16 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 16 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
17 import provision_devices | 17 import provision_devices |
18 from pylib import android_commands | 18 from pylib import android_commands |
19 from pylib import constants | 19 from pylib import constants |
20 from pylib.gtest import gtest_config | 20 from pylib.gtest import gtest_config |
21 | 21 |
22 sys.path.append(os.path.join( | 22 sys.path.append(os.path.join( |
23 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) | 23 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) |
24 import errors | 24 import errors |
25 | 25 |
26 | 26 |
27 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | |
27 CHROME_SRC = constants.DIR_SOURCE_ROOT | 28 CHROME_SRC = constants.DIR_SOURCE_ROOT |
28 LOGCAT_DIR = os.path.join(CHROME_SRC, 'out', 'logcat') | 29 LOGCAT_DIR = os.path.join(CHROME_SRC, 'out', 'logcat') |
29 | 30 |
30 # Describes an instrumation test suite: | 31 # Describes an instrumation test suite: |
31 # test: Name of test we're running. | 32 # test: Name of test we're running. |
32 # apk: apk to be installed. | 33 # apk: apk to be installed. |
33 # apk_package: package for the apk to be installed. | 34 # apk_package: package for the apk to be installed. |
34 # test_apk: apk to run tests on. | 35 # test_apk: apk to run tests on. |
35 # test_data: data folder in format destination:source. | 36 # test_data: data folder in format destination:source. |
36 # host_driven_root: The host-driven test root directory. | 37 # host_driven_root: The host-driven test root directory. |
(...skipping 26 matching lines...) Expand all Loading... | |
63 'AndroidWebViewTest', | 64 'AndroidWebViewTest', |
64 'webview:android_webview/test/data/device_files'), | 65 'webview:android_webview/test/data/device_files'), |
65 ]) | 66 ]) |
66 | 67 |
67 VALID_TESTS = set(['chromedriver', 'ui', 'unit', 'webkit', 'webkit_layout', | 68 VALID_TESTS = set(['chromedriver', 'ui', 'unit', 'webkit', 'webkit_layout', |
68 'webrtc']) | 69 'webrtc']) |
69 | 70 |
70 RunCmd = bb_utils.RunCmd | 71 RunCmd = bb_utils.RunCmd |
71 | 72 |
72 | 73 |
74 def SrcPath(*path): | |
75 return os.path.join(constants.DIR_SOURCE_ROOT, *path) | |
76 | |
77 | |
73 # multiprocessing map_async requires a top-level function for pickle library. | 78 # multiprocessing map_async requires a top-level function for pickle library. |
74 def RebootDeviceSafe(device): | 79 def RebootDeviceSafe(device): |
75 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" | 80 """Reboot a device, wait for it to start, and squelch timeout exceptions.""" |
76 try: | 81 try: |
77 android_commands.AndroidCommands(device).Reboot(True) | 82 android_commands.AndroidCommands(device).Reboot(True) |
78 except errors.DeviceUnresponsiveError as e: | 83 except errors.DeviceUnresponsiveError as e: |
79 return e | 84 return e |
80 | 85 |
81 | 86 |
82 def RebootDevices(): | 87 def RebootDevices(): |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) | 223 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) |
219 | 224 |
220 # TODO(dpranke): Remove this block after | 225 # TODO(dpranke): Remove this block after |
221 # https://codereview.chromium.org/12927002/ lands. | 226 # https://codereview.chromium.org/12927002/ lands. |
222 for f in options.factory_properties.get('additional_expectations_files', []): | 227 for f in options.factory_properties.get('additional_expectations_files', []): |
223 cmd_args.extend( | 228 cmd_args.extend( |
224 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) | 229 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) |
225 | 230 |
226 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args) | 231 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args) |
227 | 232 |
233 if options.factory_properties.get('archive_webkit_results', False): | |
234 bb_annotations.PrintNamedStep('archive_webkit_results') | |
235 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'archive_layout_test_results.py'), | |
236 '--results-dir', '..layout-test-results', | |
Dirk Pranke
2013/08/20 23:31:07
This path seems really wrong, but it matches line
| |
237 '--target', options.target, | |
238 '--build-dir', SrcPath('out'), | |
bulach
2013/08/21 09:06:14
please, use build/android/pylib/cmd_helper.py :: O
Isaac (away)
2013/08/21 10:10:14
Gosh, I'm not familiar with that. However, we are
Dirk Pranke
2013/08/28 19:45:47
Based on further conversation w/ Isaac, I'm going
| |
239 '--build-number', str(options.build_properties.get('buildnumber', '')), | |
240 '--builder-name', options.build_properties.get('buildername', '')]) | |
241 | |
228 | 242 |
229 def SpawnLogcatMonitor(): | 243 def SpawnLogcatMonitor(): |
230 shutil.rmtree(LOGCAT_DIR, ignore_errors=True) | 244 shutil.rmtree(LOGCAT_DIR, ignore_errors=True) |
231 bb_utils.SpawnCmd([ | 245 bb_utils.SpawnCmd([ |
232 os.path.join(CHROME_SRC, 'build', 'android', 'adb_logcat_monitor.py'), | 246 os.path.join(CHROME_SRC, 'build', 'android', 'adb_logcat_monitor.py'), |
233 LOGCAT_DIR]) | 247 LOGCAT_DIR]) |
234 | 248 |
235 # Wait for logcat_monitor to pull existing logcat | 249 # Wait for logcat_monitor to pull existing logcat |
236 RunCmd(['sleep', '5']) | 250 RunCmd(['sleep', '5']) |
237 | 251 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 if unknown_tests: | 393 if unknown_tests: |
380 return sys.exit('Unknown tests %s' % list(unknown_tests)) | 394 return sys.exit('Unknown tests %s' % list(unknown_tests)) |
381 | 395 |
382 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 396 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
383 | 397 |
384 MainTestWrapper(options) | 398 MainTestWrapper(options) |
385 | 399 |
386 | 400 |
387 if __name__ == '__main__': | 401 if __name__ == '__main__': |
388 sys.exit(main(sys.argv)) | 402 sys.exit(main(sys.argv)) |
OLD | NEW |