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