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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 @contextlib.contextmanager | 746 @contextlib.contextmanager |
747 def upload_logcats_file(): | 747 def upload_logcats_file(): |
748 try: | 748 try: |
749 yield | 749 yield |
750 finally: | 750 finally: |
751 if not args.logcat_output_file: | 751 if not args.logcat_output_file: |
752 logging.critical('Cannot upload logcats file. ' | 752 logging.critical('Cannot upload logcats file. ' |
753 'File to save logcat is not specified.') | 753 'File to save logcat is not specified.') |
754 else: | 754 else: |
755 with open(args.logcat_output_file) as src: | 755 with open(args.logcat_output_file) as src: |
756 dst = logdog_helper.open_text('unified_logcats') | 756 dst = logdog_helper.open_text('unified_logcats') |
jbudorick
2017/03/28 01:09:21
hrm, should this be
with logdog_helper.text('un
mikecase (-- gone --)
2017/03/28 15:39:51
logdog_helper.text isnt a contextmanager. So that
jbudorick
2017/03/28 15:41:27
ah, my mistake. I was looking at the underlying cl
| |
757 if dst: | 757 if dst: |
758 shutil.copyfileobj(src, dst) | 758 shutil.copyfileobj(src, dst) |
759 dst.close() | |
760 logging.critical( | |
761 'Logcat: %s', logdog_helper.get_viewer_url('unified_logcats')) | |
762 | |
759 | 763 |
760 logcats_uploader = contextlib_ext.Optional( | 764 logcats_uploader = contextlib_ext.Optional( |
761 upload_logcats_file(), | 765 upload_logcats_file(), |
762 'upload_logcats_file' in args and args.upload_logcats_file) | 766 'upload_logcats_file' in args and args.upload_logcats_file) |
763 | 767 |
764 ### Set up test objects. | 768 ### Set up test objects. |
765 | 769 |
766 env = environment_factory.CreateEnvironment(args, infra_error) | 770 env = environment_factory.CreateEnvironment(args, infra_error) |
767 test_instance = test_instance_factory.CreateTestInstance(args, infra_error) | 771 test_instance = test_instance_factory.CreateTestInstance(args, infra_error) |
768 test_run = test_run_factory.CreateTestRun( | 772 test_run = test_run_factory.CreateTestRun( |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 if e.is_infra_error: | 916 if e.is_infra_error: |
913 return constants.INFRA_EXIT_CODE | 917 return constants.INFRA_EXIT_CODE |
914 return constants.ERROR_EXIT_CODE | 918 return constants.ERROR_EXIT_CODE |
915 except: # pylint: disable=W0702 | 919 except: # pylint: disable=W0702 |
916 logging.exception('Unrecognized error occurred.') | 920 logging.exception('Unrecognized error occurred.') |
917 return constants.ERROR_EXIT_CODE | 921 return constants.ERROR_EXIT_CODE |
918 | 922 |
919 | 923 |
920 if __name__ == '__main__': | 924 if __name__ == '__main__': |
921 sys.exit(main()) | 925 sys.exit(main()) |
OLD | NEW |