| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 from pylib.utils import logdog_helper | 43 from pylib.utils import logdog_helper |
| 44 from pylib.utils import logging_utils | 44 from pylib.utils import logging_utils |
| 45 | 45 |
| 46 from py_utils import contextlib_ext | 46 from py_utils import contextlib_ext |
| 47 | 47 |
| 48 | 48 |
| 49 _DEVIL_STATIC_CONFIG_FILE = os.path.abspath(os.path.join( | 49 _DEVIL_STATIC_CONFIG_FILE = os.path.abspath(os.path.join( |
| 50 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'devil_config.json')) | 50 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'devil_config.json')) |
| 51 | 51 |
| 52 | 52 |
| 53 def _RealPath(arg): |
| 54 if arg.startswith('//'): |
| 55 arg = os.path.abspath(os.path.join(host_paths.DIR_SOURCE_ROOT, |
| 56 arg[2:].replace('/', os.sep))) |
| 57 return os.path.realpath(arg) |
| 58 |
| 59 |
| 53 def AddTestLauncherOptions(parser): | 60 def AddTestLauncherOptions(parser): |
| 54 """Adds arguments mirroring //base/test/launcher. | 61 """Adds arguments mirroring //base/test/launcher. |
| 55 | 62 |
| 56 Args: | 63 Args: |
| 57 parser: The parser to which arguments should be added. | 64 parser: The parser to which arguments should be added. |
| 58 Returns: | 65 Returns: |
| 59 The given parser. | 66 The given parser. |
| 60 """ | 67 """ |
| 61 parser.add_argument( | 68 parser.add_argument( |
| 62 '--test-launcher-retry-limit', | 69 '--test-launcher-retry-limit', |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 parser.add_argument( | 420 parser.add_argument( |
| 414 '--runtime-deps-path', | 421 '--runtime-deps-path', |
| 415 dest='runtime_deps_path', type=os.path.realpath, | 422 dest='runtime_deps_path', type=os.path.realpath, |
| 416 help='Runtime data dependency file from GN.') | 423 help='Runtime data dependency file from GN.') |
| 417 parser.add_argument( | 424 parser.add_argument( |
| 418 '--screenshot-directory', | 425 '--screenshot-directory', |
| 419 dest='screenshot_dir', type=os.path.realpath, | 426 dest='screenshot_dir', type=os.path.realpath, |
| 420 help='Capture screenshots of test failures') | 427 help='Capture screenshots of test failures') |
| 421 parser.add_argument( | 428 parser.add_argument( |
| 422 '--shared-prefs-file', | 429 '--shared-prefs-file', |
| 423 dest='shared_prefs_file', type=os.path.realpath, | 430 dest='shared_prefs_file', type=_RealPath, |
| 424 help='The relative path to a file containing JSON list of shared ' | 431 help='The relative path to a file containing JSON list of shared ' |
| 425 'preference files to edit and how to do so. Example list: ' | 432 'preference files to edit and how to do so. Example list: ' |
| 426 '[{' | 433 '[{' |
| 427 ' "package": "com.package.example",' | 434 ' "package": "com.package.example",' |
| 428 ' "filename": "ExampleSettings.xml",' | 435 ' "filename": "ExampleSettings.xml",' |
| 429 ' "set": {' | 436 ' "set": {' |
| 430 ' "boolean_key_in_xml": true,' | 437 ' "boolean_key_in_xml": true,' |
| 431 ' "string_key_in_xml": "string_value"' | 438 ' "string_key_in_xml": "string_value"' |
| 432 ' },' | 439 ' },' |
| 433 ' "remove": [' | 440 ' "remove": [' |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 if e.is_infra_error: | 981 if e.is_infra_error: |
| 975 return constants.INFRA_EXIT_CODE | 982 return constants.INFRA_EXIT_CODE |
| 976 return constants.ERROR_EXIT_CODE | 983 return constants.ERROR_EXIT_CODE |
| 977 except: # pylint: disable=W0702 | 984 except: # pylint: disable=W0702 |
| 978 logging.exception('Unrecognized error occurred.') | 985 logging.exception('Unrecognized error occurred.') |
| 979 return constants.ERROR_EXIT_CODE | 986 return constants.ERROR_EXIT_CODE |
| 980 | 987 |
| 981 | 988 |
| 982 if __name__ == '__main__': | 989 if __name__ == '__main__': |
| 983 sys.exit(main()) | 990 sys.exit(main()) |
| OLD | NEW |