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 |
11 import random | 11 import random |
12 import re | 12 import re |
13 import shutil | 13 import shutil |
14 import sys | 14 import sys |
15 | 15 |
16 import bb_utils | 16 import bb_utils |
17 import bb_annotations | 17 import bb_annotations |
18 | 18 |
19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 19 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
20 import provision_devices | 20 import provision_devices |
21 from pylib import android_commands | 21 from pylib import android_commands |
22 from pylib import constants | 22 from pylib import constants |
23 from pylib.device import device_utils | 23 from pylib.device import device_utils |
24 from pylib.gtest import gtest_config | 24 from pylib.gtest import gtest_config |
25 | 25 |
26 CHROME_SRC_DIR = bb_utils.CHROME_SRC | 26 CHROME_SRC_DIR = bb_utils.CHROME_SRC |
27 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) | 27 DIR_BUILD_ROOT = os.path.dirname(CHROME_SRC_DIR) |
28 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR | 28 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR |
| 29 BK_SCRIPTS_DIR = 'third_party/WebKit/Tools/Scripts' |
29 | 30 |
30 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 31 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
31 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') | 32 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat') |
32 GS_URL = 'https://storage.googleapis.com' | 33 GS_URL = 'https://storage.googleapis.com' |
33 GS_AUTH_URL = 'https://storage.cloud.google.com' | 34 GS_AUTH_URL = 'https://storage.cloud.google.com' |
34 | 35 |
35 # Describes an instrumation test suite: | 36 # Describes an instrumation test suite: |
36 # test: Name of test we're running. | 37 # test: Name of test we're running. |
37 # apk: apk to be installed. | 38 # apk: apk to be installed. |
38 # apk_package: package for the apk to be installed. | 39 # apk_package: package for the apk to be installed. |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 # associated with it. | 280 # associated with it. |
280 args.append('--official-build') | 281 args.append('--official-build') |
281 | 282 |
282 RunCmd(['build/android/test_runner.py', 'instrumentation'] + args, | 283 RunCmd(['build/android/test_runner.py', 'instrumentation'] + args, |
283 flunk_on_failure=flunk_on_failure) | 284 flunk_on_failure=flunk_on_failure) |
284 | 285 |
285 | 286 |
286 def RunWebkitLint(target): | 287 def RunWebkitLint(target): |
287 """Lint WebKit's TestExpectation files.""" | 288 """Lint WebKit's TestExpectation files.""" |
288 bb_annotations.PrintNamedStep('webkit_lint') | 289 bb_annotations.PrintNamedStep('webkit_lint') |
289 RunCmd([SrcPath('webkit/tools/layout_tests/run_webkit_tests.py'), | 290 RunCmd([SrcPath(os.path.join(BK_SCRIPTS_DIR, 'lint-test-expectations')), |
290 '--lint-test-files', | |
291 '--chromium', | |
292 '--target', target]) | 291 '--target', target]) |
293 | 292 |
294 | 293 |
295 def RunWebkitLayoutTests(options): | 294 def RunWebkitLayoutTests(options): |
296 """Run layout tests on an actual device.""" | 295 """Run layout tests on an actual device.""" |
297 bb_annotations.PrintNamedStep('webkit_tests') | 296 bb_annotations.PrintNamedStep('webkit_tests') |
298 cmd_args = [ | 297 cmd_args = [ |
299 '--no-show-results', | 298 '--no-show-results', |
300 '--no-new-test-results', | 299 '--no-new-test-results', |
301 '--full-results-html', | 300 '--full-results-html', |
(...skipping 17 matching lines...) Expand all Loading... |
319 for f in options.factory_properties.get('additional_expectations', []): | 318 for f in options.factory_properties.get('additional_expectations', []): |
320 cmd_args.extend( | 319 cmd_args.extend( |
321 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) | 320 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) |
322 | 321 |
323 # TODO(dpranke): Remove this block after | 322 # TODO(dpranke): Remove this block after |
324 # https://codereview.chromium.org/12927002/ lands. | 323 # https://codereview.chromium.org/12927002/ lands. |
325 for f in options.factory_properties.get('additional_expectations_files', []): | 324 for f in options.factory_properties.get('additional_expectations_files', []): |
326 cmd_args.extend( | 325 cmd_args.extend( |
327 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) | 326 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)]) |
328 | 327 |
329 exit_code = RunCmd([SrcPath('webkit/tools/layout_tests/run_webkit_tests.py')] | 328 exit_code = RunCmd( |
330 + cmd_args) | 329 [SrcPath(os.path.join(BK_SCRIPTS_DIR, 'run-webkit-tests'))] + cmd_args) |
331 if exit_code == 255: # test_run_results.UNEXPECTED_ERROR_EXIT_STATUS | 330 if exit_code == 255: # test_run_results.UNEXPECTED_ERROR_EXIT_STATUS |
332 bb_annotations.PrintMsg('?? (crashed or hung)') | 331 bb_annotations.PrintMsg('?? (crashed or hung)') |
333 elif exit_code == 254: # test_run_results.NO_DEVICES_EXIT_STATUS | 332 elif exit_code == 254: # test_run_results.NO_DEVICES_EXIT_STATUS |
334 bb_annotations.PrintMsg('?? (no devices found)') | 333 bb_annotations.PrintMsg('?? (no devices found)') |
335 elif exit_code == 253: # test_run_results.NO_TESTS_EXIT_STATUS | 334 elif exit_code == 253: # test_run_results.NO_TESTS_EXIT_STATUS |
336 bb_annotations.PrintMsg('?? (no tests found)') | 335 bb_annotations.PrintMsg('?? (no tests found)') |
337 else: | 336 else: |
338 full_results_path = os.path.join('..', 'layout-test-results', | 337 full_results_path = os.path.join('..', 'layout-test-results', |
339 'full_results.json') | 338 'full_results.json') |
340 if os.path.exists(full_results_path): | 339 if os.path.exists(full_results_path): |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 733 |
735 if options.coverage_bucket: | 734 if options.coverage_bucket: |
736 setattr(options, 'coverage_dir', | 735 setattr(options, 'coverage_dir', |
737 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 736 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
738 | 737 |
739 MainTestWrapper(options) | 738 MainTestWrapper(options) |
740 | 739 |
741 | 740 |
742 if __name__ == '__main__': | 741 if __name__ == '__main__': |
743 sys.exit(main(sys.argv)) | 742 sys.exit(main(sys.argv)) |
OLD | NEW |