| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 default='', | 208 default='', |
| 209 help='Additional arguments to pass to the test.') | 209 help='Additional arguments to pass to the test.') |
| 210 group.add_argument('-t', dest='timeout', type=int, default=60, | 210 group.add_argument('-t', dest='timeout', type=int, default=60, |
| 211 help='Timeout to wait for each test ' | 211 help='Timeout to wait for each test ' |
| 212 '(default: %(default)s).') | 212 '(default: %(default)s).') |
| 213 group.add_argument('--isolate_file_path', | 213 group.add_argument('--isolate_file_path', |
| 214 '--isolate-file-path', | 214 '--isolate-file-path', |
| 215 dest='isolate_file_path', | 215 dest='isolate_file_path', |
| 216 help='.isolate file path to override the default ' | 216 help='.isolate file path to override the default ' |
| 217 'path') | 217 'path') |
| 218 group.add_argument('--app-data-file', action='append', dest='app_data_files', |
| 219 help='A file path relative to the app data directory ' |
| 220 'that should be saved to the host.') |
| 221 group.add_argument('--app-data-file-dir', |
| 222 help='Host directory to which app data files will be' |
| 223 ' saved. Used with --app-data-file.') |
| 218 | 224 |
| 219 filter_group = group.add_mutually_exclusive_group() | 225 filter_group = group.add_mutually_exclusive_group() |
| 220 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter', | 226 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter', |
| 221 dest='test_filter', | 227 dest='test_filter', |
| 222 help='googletest-style filter string.') | 228 help='googletest-style filter string.') |
| 223 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file', | 229 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file', |
| 224 help='Path to file that contains googletest-style ' | 230 help='Path to file that contains googletest-style ' |
| 225 'filter strings. (Lines will be joined with ' | 231 'filter strings. (Lines will be joined with ' |
| 226 '":" to create a single filter string.)') | 232 '":" to create a single filter string.)') |
| 227 | 233 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 for suite_name in args.suite_name: | 639 for suite_name in args.suite_name: |
| 634 # TODO(jbudorick): Either deprecate multi-suite or move its handling down | 640 # TODO(jbudorick): Either deprecate multi-suite or move its handling down |
| 635 # into the gtest code. | 641 # into the gtest code. |
| 636 gtest_options = gtest_test_options.GTestOptions( | 642 gtest_options = gtest_test_options.GTestOptions( |
| 637 args.tool, | 643 args.tool, |
| 638 args.test_filter, | 644 args.test_filter, |
| 639 args.run_disabled, | 645 args.run_disabled, |
| 640 args.test_arguments, | 646 args.test_arguments, |
| 641 args.timeout, | 647 args.timeout, |
| 642 args.isolate_file_path, | 648 args.isolate_file_path, |
| 643 suite_name) | 649 suite_name, |
| 650 args.app_data_files, |
| 651 args.app_data_file_dir) |
| 644 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) | 652 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) |
| 645 | 653 |
| 646 results, test_exit_code = test_dispatcher.RunTests( | 654 results, test_exit_code = test_dispatcher.RunTests( |
| 647 tests, runner_factory, devices, shard=True, test_timeout=None, | 655 tests, runner_factory, devices, shard=True, test_timeout=None, |
| 648 num_retries=args.num_retries) | 656 num_retries=args.num_retries) |
| 649 | 657 |
| 650 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: | 658 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: |
| 651 exit_code = test_exit_code | 659 exit_code = test_exit_code |
| 652 | 660 |
| 653 report_results.LogFull( | 661 report_results.LogFull( |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 if e.is_infra_error: | 1035 if e.is_infra_error: |
| 1028 return constants.INFRA_EXIT_CODE | 1036 return constants.INFRA_EXIT_CODE |
| 1029 return constants.ERROR_EXIT_CODE | 1037 return constants.ERROR_EXIT_CODE |
| 1030 except: # pylint: disable=W0702 | 1038 except: # pylint: disable=W0702 |
| 1031 logging.exception('Unrecognized error occurred.') | 1039 logging.exception('Unrecognized error occurred.') |
| 1032 return constants.ERROR_EXIT_CODE | 1040 return constants.ERROR_EXIT_CODE |
| 1033 | 1041 |
| 1034 | 1042 |
| 1035 if __name__ == '__main__': | 1043 if __name__ == '__main__': |
| 1036 sys.exit(main()) | 1044 sys.exit(main()) |
| OLD | NEW |