OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import contextlib | 5 import contextlib |
6 import datetime | 6 import datetime |
7 import json | 7 import json |
8 import os | 8 import os |
9 import re | 9 import re |
10 import urllib | 10 import urllib |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 source=archive, | 654 source=archive, |
655 bucket=upload_archives_to_bucket, | 655 bucket=upload_archives_to_bucket, |
656 dest=dest, | 656 dest=dest, |
657 link_name='output_dir.zip') | 657 link_name='output_dir.zip') |
658 | 658 |
659 if failures: | 659 if failures: |
660 raise self.m.step.StepFailure('sharded perf tests failed %s' % failures) | 660 raise self.m.step.StepFailure('sharded perf tests failed %s' % failures) |
661 | 661 |
662 def run_instrumentation_suite(self, | 662 def run_instrumentation_suite(self, |
663 name, | 663 name, |
664 test_apk, | 664 test_apk=None, |
665 apk_under_test=None, | 665 apk_under_test=None, |
666 additional_apks=None, | 666 additional_apks=None, |
667 isolate_file_path=None, | 667 isolate_file_path=None, |
668 flakiness_dashboard=None, | 668 flakiness_dashboard=None, |
669 annotation=None, except_annotation=None, | 669 annotation=None, except_annotation=None, |
670 screenshot=False, verbose=False, tool=None, | 670 screenshot=False, verbose=False, tool=None, |
671 apk_package=None, host_driven_root=None, | 671 apk_package=None, |
672 official_build=False, json_results_file=None, | 672 host_driven_root=None, # unused? |
| 673 official_build=False, |
| 674 json_results_file=None, |
673 timeout_scale=None, strict_mode=None, | 675 timeout_scale=None, strict_mode=None, |
674 suffix=None, num_retries=None, | 676 suffix=None, num_retries=None, |
675 device_flags=None, **kwargs): | 677 device_flags=None, |
| 678 wrapper_script_suite_name=None, |
| 679 **kwargs): |
676 if apk_under_test: | 680 if apk_under_test: |
677 # TODO(jbudorick): Remove this once the test runner handles installation | 681 # TODO(jbudorick): Remove this once the test runner handles installation |
678 # of the APK under test. | 682 # of the APK under test. |
679 self.adb_install_apk(apk_under_test) | 683 self.adb_install_apk(apk_under_test) |
680 | 684 |
681 logcat_output_file = self.m.raw_io.output() | 685 logcat_output_file = self.m.raw_io.output() |
682 args = [ | 686 args = [ |
683 '--test-apk', test_apk, | |
684 '--blacklist-file', self.blacklist_file, | 687 '--blacklist-file', self.blacklist_file, |
685 '--logcat-output-file', logcat_output_file, | 688 '--logcat-output-file', logcat_output_file, |
686 ] | 689 ] |
687 if apk_under_test: | |
688 args.extend(['--apk-under-test', apk_under_test]) | |
689 for a in additional_apks or []: | |
690 args.extend(['--additional-apk', a]) | |
691 if isolate_file_path: | |
692 args.extend(['--isolate-file-path', isolate_file_path]) | |
693 if tool: | 690 if tool: |
694 args.append('--tool=%s' % tool) | 691 args.append('--tool=%s' % tool) |
695 if flakiness_dashboard: | 692 if flakiness_dashboard: |
696 args.extend(['--flakiness-dashboard-server', flakiness_dashboard]) | 693 args.extend(['--flakiness-dashboard-server', flakiness_dashboard]) |
697 if annotation: | 694 if annotation: |
698 args.extend(['-A', annotation]) | 695 args.extend(['-A', annotation]) |
699 if except_annotation: | 696 if except_annotation: |
700 args.extend(['-E', except_annotation]) | 697 args.extend(['-E', except_annotation]) |
701 if screenshot: | 698 if screenshot: |
702 args.append('--screenshot') | 699 args.append('--screenshot') |
703 if verbose: | 700 if verbose: |
704 args.append('--verbose') | 701 args.append('--verbose') |
705 if self.m.chromium.c.BUILD_CONFIG == 'Release': | |
706 args.append('--release') | |
707 if self.c.coverage or self.c.incremental_coverage: | 702 if self.c.coverage or self.c.incremental_coverage: |
708 args.extend(['--coverage-dir', self.coverage_dir]) | 703 args.extend(['--coverage-dir', self.coverage_dir]) |
709 if host_driven_root: | 704 if host_driven_root: |
710 args.extend(['--host-driven-root', host_driven_root]) | 705 args.extend(['--host-driven-root', host_driven_root]) |
711 if official_build: | |
712 args.extend(['--official-build']) | |
713 if json_results_file: | 706 if json_results_file: |
714 args.extend(['--json-results-file', json_results_file]) | 707 args.extend(['--json-results-file', json_results_file]) |
715 if timeout_scale: | 708 if timeout_scale: |
716 args.extend(['--timeout-scale', timeout_scale]) | 709 args.extend(['--timeout-scale', timeout_scale]) |
717 if strict_mode: | 710 if strict_mode: |
718 args.extend(['--strict-mode', strict_mode]) | 711 args.extend(['--strict-mode', strict_mode]) |
719 if num_retries is not None: | 712 if num_retries is not None: |
720 args.extend(['--num-retries', str(num_retries)]) | 713 args.extend(['--num-retries', str(num_retries)]) |
721 if device_flags: | 714 if device_flags: |
722 args.extend(['--device-flags', device_flags]) | 715 args.extend(['--device-flags', device_flags]) |
723 | 716 |
| 717 if not wrapper_script_suite_name: |
| 718 args.insert(0, 'instrumentation') |
| 719 args.extend(['--test-apk', test_apk]) |
| 720 if apk_under_test: |
| 721 args.extend(['--apk-under-test', apk_under_test]) |
| 722 for a in additional_apks or []: |
| 723 args.extend(['--additional-apk', a]) |
| 724 if isolate_file_path: |
| 725 args.extend(['--isolate-file-path', isolate_file_path]) |
| 726 if self.m.chromium.c.BUILD_CONFIG == 'Release': |
| 727 args.append('--release') |
| 728 if official_build: |
| 729 args.extend(['--official-build']) |
| 730 |
724 step_result = self.test_runner( | 731 step_result = self.test_runner( |
725 'Instrumentation test %s%s' % (annotation or name, | 732 'Instrumentation test %s%s' % (annotation or name, |
726 ' (%s)' % suffix if suffix else ''), | 733 ' (%s)' % suffix if suffix else ''), |
727 args=['instrumentation'] + args, | 734 args=args, |
| 735 wrapper_script_suite_name=wrapper_script_suite_name, |
728 **kwargs) | 736 **kwargs) |
729 if step_result.raw_io.output: | 737 if step_result.raw_io.output: |
730 step_result.presentation.logs['logcat'] = ( | 738 step_result.presentation.logs['logcat'] = ( |
731 step_result.raw_io.output.splitlines()) | 739 step_result.raw_io.output.splitlines()) |
732 return step_result | 740 return step_result |
733 | 741 |
734 def launch_gce_instances(self, snapshot='clean-17-l-phone-image-no-popups', | 742 def launch_gce_instances(self, snapshot='clean-17-l-phone-image-no-popups', |
735 count=6): | 743 count=6): |
736 args = [ | 744 args = [ |
737 self.m.properties['slavename'], | 745 self.m.properties['slavename'], |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 i.result.presentation.status = self.m.step.EXCEPTION | 1246 i.result.presentation.status = self.m.step.EXCEPTION |
1239 raise i | 1247 raise i |
1240 elif (f.result.retcode == EXIT_CODES['warning']): | 1248 elif (f.result.retcode == EXIT_CODES['warning']): |
1241 w = self.m.step.StepWarning(f.name or f.reason, result=f.result) | 1249 w = self.m.step.StepWarning(f.name or f.reason, result=f.result) |
1242 w.result.presentation.status = self.m.step.WARNING | 1250 w.result.presentation.status = self.m.step.WARNING |
1243 raise w | 1251 raise w |
1244 elif (f.result.retcode == EXIT_CODES['error']): | 1252 elif (f.result.retcode == EXIT_CODES['error']): |
1245 f.result.presentation.status = self.m.step.FAILURE | 1253 f.result.presentation.status = self.m.step.FAILURE |
1246 raise | 1254 raise |
1247 | 1255 |
1248 def test_runner(self, step_name, args=None, **kwargs): | 1256 def test_runner(self, step_name, args=None, wrapper_script_suite_name=None, **
kwargs): |
1249 """Wrapper for the python testrunner script. | 1257 """Wrapper for the python testrunner script. |
1250 | 1258 |
1251 Args: | 1259 Args: |
1252 step_name: Name of the step. | 1260 step_name: Name of the step. |
1253 args: Testrunner arguments. | 1261 args: Testrunner arguments. |
1254 """ | 1262 """ |
1255 with self.handle_exit_codes(): | 1263 with self.handle_exit_codes(): |
1256 return self.m.python( | 1264 script = self.c.test_runner |
1257 step_name, self.c.test_runner, args, **kwargs) | 1265 if wrapper_script_suite_name: |
| 1266 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
| 1267 wrapper_script_suite_name) |
| 1268 return self.m.python(step_name, script, args, **kwargs) |
OLD | NEW |