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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 parser.add_argument( | 413 parser.add_argument( |
414 '--runtime-deps-path', | 414 '--runtime-deps-path', |
415 dest='runtime_deps_path', type=os.path.realpath, | 415 dest='runtime_deps_path', type=os.path.realpath, |
416 help='Runtime data dependency file from GN.') | 416 help='Runtime data dependency file from GN.') |
417 parser.add_argument( | 417 parser.add_argument( |
418 '--screenshot-directory', | 418 '--screenshot-directory', |
419 dest='screenshot_dir', type=os.path.realpath, | 419 dest='screenshot_dir', type=os.path.realpath, |
420 help='Capture screenshots of test failures') | 420 help='Capture screenshots of test failures') |
421 parser.add_argument( | 421 parser.add_argument( |
422 '--shared-prefs-file', | 422 '--shared-prefs-file', |
423 dest='shared_prefs_file', type=os.path.realpath, | 423 dest='shared_prefs_file', type=os.path.abspath, |
shenghuazhang
2017/07/25 20:44:45
Type realpath changes value "//home/..." to "/home
jbudorick
2017/07/25 21:07:46
I think you're on the right track here, but you ca
shenghuazhang
2017/07/25 21:28:10
Thanks for this suggestion! This should be much mo
| |
424 help='The relative path to a file containing JSON list of shared ' | 424 help='The relative path to a file containing JSON list of shared ' |
425 'preference files to edit and how to do so. Example list: ' | 425 'preference files to edit and how to do so. Example list: ' |
426 '[{' | 426 '[{' |
427 ' "package": "com.package.example",' | 427 ' "package": "com.package.example",' |
428 ' "filename": "ExampleSettings.xml",' | 428 ' "filename": "ExampleSettings.xml",' |
429 ' "set": {' | 429 ' "set": {' |
430 ' "boolean_key_in_xml": true,' | 430 ' "boolean_key_in_xml": true,' |
431 ' "string_key_in_xml": "string_value"' | 431 ' "string_key_in_xml": "string_value"' |
432 ' },' | 432 ' },' |
433 ' "remove": [' | 433 ' "remove": [' |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
960 parser.error('unrecognized arguments: %s' % ' '.join(unknown_args)) | 960 parser.error('unrecognized arguments: %s' % ' '.join(unknown_args)) |
961 | 961 |
962 # --replace-system-package has the potential to cause issues if | 962 # --replace-system-package has the potential to cause issues if |
963 # --enable-concurrent-adb is set, so disallow that combination | 963 # --enable-concurrent-adb is set, so disallow that combination |
964 if (hasattr(args, 'replace_system_package') and | 964 if (hasattr(args, 'replace_system_package') and |
965 hasattr(args, 'enable_concurrent_adb') and args.replace_system_package and | 965 hasattr(args, 'enable_concurrent_adb') and args.replace_system_package and |
966 args.enable_concurrent_adb): | 966 args.enable_concurrent_adb): |
967 parser.error('--replace-system-package and --enable-concurrent-adb cannot ' | 967 parser.error('--replace-system-package and --enable-concurrent-adb cannot ' |
968 'be used together') | 968 'be used together') |
969 | 969 |
970 if hasattr(args, 'shared_prefs_file') and args.shared_prefs_file: | |
971 if args.shared_prefs_file.startswith('//'): | |
972 args.shared_prefs_file = os.path.abspath( | |
973 os.path.join(host_paths.DIR_SOURCE_ROOT, | |
974 args.shared_prefs_file[2:].replace('/', os.sep))) | |
975 args.shared_prefs_file = os.path.realpath(args.shared_prefs_file) | |
976 | |
970 try: | 977 try: |
971 return RunTestsCommand(args) | 978 return RunTestsCommand(args) |
972 except base_error.BaseError as e: | 979 except base_error.BaseError as e: |
973 logging.exception('Error occurred.') | 980 logging.exception('Error occurred.') |
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 |