Chromium Code Reviews| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 # (or at least make the difference clear). | 242 # (or at least make the difference clear). |
| 243 self.m.archive.zip_and_upload_build( | 243 self.m.archive.zip_and_upload_build( |
| 244 'zip_build', | 244 'zip_build', |
| 245 target=self.m.chromium.c.BUILD_CONFIG, | 245 target=self.m.chromium.c.BUILD_CONFIG, |
| 246 # We send None as the path so that zip_build.py gets it from factory | 246 # We send None as the path so that zip_build.py gets it from factory |
| 247 # properties. | 247 # properties. |
| 248 build_url=None, | 248 build_url=None, |
| 249 src_dir=self.m.path['slave_build'].join('src'), | 249 src_dir=self.m.path['slave_build'].join('src'), |
| 250 exclude_files='lib.target,gen,android_webview,jingle_unittests') | 250 exclude_files='lib.target,gen,android_webview,jingle_unittests') |
| 251 | 251 |
| 252 def spawn_logcat_monitor(self): | |
| 253 self.m.step( | |
| 254 'spawn_logcat_monitor', | |
| 255 [self.m.path['build'].join('scripts', 'slave', 'daemonizer.py'), | |
| 256 '--', self.c.cr_build_android.join('adb_logcat_monitor.py'), | |
| 257 self.m.chromium.c.build_dir.join('logcat')], | |
| 258 env=self.m.chromium.get_env(), | |
| 259 infra_step=True) | |
| 260 | |
| 261 def spawn_device_monitor(self): | 252 def spawn_device_monitor(self): |
| 262 script = self.m.path['build'].join('scripts', 'slave', 'daemonizer.py') | 253 script = self.m.path['build'].join('scripts', 'slave', 'daemonizer.py') |
| 263 args = [ | 254 args = [ |
| 264 '--action', 'restart', | 255 '--action', 'restart', |
| 265 '--pid-file-path', '/tmp/device_monitor.pid', | 256 '--pid-file-path', '/tmp/device_monitor.pid', |
| 266 '--', self.resource('spawn_device_monitor.py'), | 257 '--', self.resource('spawn_device_monitor.py'), |
| 267 self.m.adb.adb_path(), | 258 self.m.adb.adb_path(), |
| 268 json.dumps(self._devices), | 259 json.dumps(self._devices), |
| 269 self.m.properties['mastername'], | 260 self.m.properties['mastername'], |
| 270 self.m.properties['buildername'], | 261 self.m.properties['buildername'], |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 '--n', count, | 689 '--n', count, |
| 699 'shutdown', | 690 'shutdown', |
| 700 ] | 691 ] |
| 701 self.m.python( | 692 self.m.python( |
| 702 'shutdown_instances', | 693 'shutdown_instances', |
| 703 self.resource('gce_manager.py'), | 694 self.resource('gce_manager.py'), |
| 704 args, | 695 args, |
| 705 infra_step=True, | 696 infra_step=True, |
| 706 ) | 697 ) |
| 707 | 698 |
| 708 def logcat_dump(self, gs_bucket=None): | 699 def spawn_logcat_monitor(self, logcat_dir=None): |
| 700 if not logcat_dir: | |
| 701 logcat_dir = self.c.default_logcat_dir | |
| 702 | |
| 703 self.m.step( | |
| 704 'spawn_logcat_monitor', | |
| 705 [self.m.path['build'].join('scripts', 'slave', 'daemonizer.py'), | |
| 706 '--', self.c.cr_build_android.join('adb_logcat_monitor.py'), | |
| 707 logcat_dir], | |
| 708 env=self.m.chromium.get_env(), | |
| 709 infra_step=True) | |
| 710 | |
| 711 def logcat_dump(self, output_logcat_file, logcat_dir=None, gs_bucket=None): | |
| 712 if not logcat_dir: | |
| 713 logcat_dir = self.c.default_logcat_dir | |
| 714 | |
| 709 if gs_bucket: | 715 if gs_bucket: |
| 710 log_path = self.m.chromium.output_dir.join('full_log') | |
| 711 self.m.python( | 716 self.m.python( |
| 712 'logcat_dump', | 717 'logcat_dump', |
| 713 self.m.path['checkout'].join('build', 'android', | 718 self.m.path['checkout'].join('build', 'android', |
| 714 'adb_logcat_printer.py'), | 719 'adb_logcat_printer.py'), |
| 715 [ '--output-path', log_path, | 720 ['--output-path', output_logcat_file, logcat_dir], |
| 716 self.m.path['checkout'].join('out', 'logcat') ], | |
| 717 infra_step=True) | 721 infra_step=True) |
| 718 self.m.gsutil.upload( | 722 self.m.gsutil.upload( |
| 719 log_path, | 723 output_logcat_file, |
| 720 gs_bucket, | 724 gs_bucket, |
| 721 'logcat_dumps/%s/%s' % (self.m.properties['buildername'], | 725 'logcat_dumps/%s/%s' % (self.m.properties['buildername'], |
| 722 self.m.properties['buildnumber']), | 726 self.m.properties['buildnumber']), |
| 723 link_name='logcat dump', | 727 link_name='logcat dump', |
| 724 version='4.7') | 728 version='4.7') |
| 725 else: | 729 else: |
| 726 self.m.python( | 730 self.m.python( |
| 727 'logcat_dump', | 731 'logcat_dump', |
| 728 self.m.path['build'].join('scripts', 'slave', 'tee.py'), | 732 self.m.path['build'].join('scripts', 'slave', 'tee.py'), |
| 729 [self.m.chromium.output_dir.join('full_log'), | 733 [output_logcat_file, |
| 730 '--', | 734 '--', |
| 731 self.m.path['checkout'].join('build', 'android', | 735 self.m.path['checkout'].join('build', 'android', |
| 732 'adb_logcat_printer.py'), | 736 'adb_logcat_printer.py'), |
| 733 self.m.path['checkout'].join('out', 'logcat')], | 737 logcat_dir], |
| 734 infra_step=True, | 738 infra_step=True) |
| 735 ) | |
| 736 | 739 |
| 737 def stack_tool_steps(self): | 740 @contextlib.contextmanager |
| 738 log_file = self.m.path['checkout'].join('out', | 741 def logcat(self, step_name): |
| 739 self.m.chromium.c.BUILD_CONFIG, | 742 """Context manager for recording logcat. |
| 740 'full_log') | 743 |
| 744 Args: | |
| 745 step_name: Name of the outer step. Any steps ran inside this context | |
| 746 manager will be nested inside. | |
| 747 """ | |
| 748 with self.m.step.nest(step_name): | |
| 749 logcat_dir = self.m.path.mkdtemp('logcat') | |
| 750 self.spawn_logcat_monitor(logcat_dir) | |
| 751 yield | |
| 752 self.logcat_dump(logcat_dir=logcat_dir, | |
| 753 output_logcat_file=self.m.raw_io.output('logcat'), | |
| 754 gs_bucket=None) | |
| 755 | |
| 756 def stack_tool_steps(self, logcat_file): | |
| 741 target_arch = self.m.chromium.c.gyp_env.GYP_DEFINES['target_arch'] | 757 target_arch = self.m.chromium.c.gyp_env.GYP_DEFINES['target_arch'] |
| 742 # gyp converts ia32 to x86, bot needs to do the same | 758 # gyp converts ia32 to x86, bot needs to do the same |
| 743 target_arch = {'ia32': 'x86'}.get(target_arch) or target_arch | 759 target_arch = {'ia32': 'x86'}.get(target_arch) or target_arch |
| 744 self.m.step( | 760 self.m.step( |
| 745 'stack_tool_with_logcat_dump', | 761 'stack_tool_with_logcat_dump', |
| 746 [self.m.path['checkout'].join('third_party', 'android_platform', | 762 [self.m.path['checkout'].join('third_party', 'android_platform', |
| 747 'development', 'scripts', 'stack'), | 763 'development', 'scripts', 'stack'), |
| 748 '--arch', target_arch, '--more-info', log_file], | 764 '--arch', target_arch, '--more-info', logcat_file], |
| 749 env=self.m.chromium.get_env(), | 765 env=self.m.chromium.get_env(), |
| 750 infra_step=True) | 766 infra_step=True) |
| 751 self.m.step( | 767 self.m.step( |
| 752 'stack_tool_for_tombstones', | 768 'stack_tool_for_tombstones', |
| 753 [self.m.path['checkout'].join('build', 'android', 'tombstones.py'), | 769 [self.m.path['checkout'].join('build', 'android', 'tombstones.py'), |
| 754 '-a', '-s', '-w'], env=self.get_env(), | 770 '-a', '-s', '-w'], env=self.get_env(), |
| 755 infra_step=True) | 771 infra_step=True) |
| 756 if self.c.asan_symbolize: | 772 if self.c.asan_symbolize: |
| 757 self.m.step( | 773 self.m.step( |
| 758 'stack_tool_for_asan', | 774 'stack_tool_for_asan', |
| 759 [self.m.path['checkout'].join('build', | 775 [self.m.path['checkout'].join('build', |
| 760 'android', | 776 'android', |
| 761 'asan_symbolize.py'), | 777 'asan_symbolize.py'), |
| 762 '-l', log_file], env=self.m.chromium.get_env(), | 778 '-l', logcat_file], env=self.m.chromium.get_env(), |
| 763 infra_step=True) | 779 infra_step=True) |
| 764 | 780 |
| 765 def test_report(self): | 781 def test_report(self): |
| 766 self.m.python.inline( | 782 self.m.python.inline( |
| 767 'test_report', | 783 'test_report', |
| 768 """ | 784 """ |
| 769 import glob, os, sys | 785 import glob, os, sys |
| 770 for report in glob.glob(sys.argv[1]): | 786 for report in glob.glob(sys.argv[1]): |
| 771 with open(report, 'r') as f: | 787 with open(report, 'r') as f: |
| 772 for l in f.readlines(): | 788 for l in f.readlines(): |
| 773 print l | 789 print l |
| 774 os.remove(report) | 790 os.remove(report) |
| 775 """, | 791 """, |
| 776 args=[self.m.path['checkout'].join('out', | 792 args=[self.m.path['checkout'].join('out', |
| 777 self.m.chromium.c.BUILD_CONFIG, | 793 self.m.chromium.c.BUILD_CONFIG, |
| 778 'test_logs', | 794 'test_logs', |
| 779 '*.log')], | 795 '*.log')], |
| 780 ) | 796 ) |
| 781 | 797 |
| 782 def common_tests_setup_steps(self, perf_setup=False): | 798 def common_tests_setup_steps(self, perf_setup=False): |
| 783 if self.c.gce_setup: | 799 if self.c.gce_setup: |
| 784 self.launch_gce_instances() | 800 self.launch_gce_instances() |
| 785 self.spawn_logcat_monitor() | 801 self.spawn_logcat_monitor() |
| 786 else: | 802 else: |
| 787 self.spawn_logcat_monitor() | 803 self.spawn_logcat_monitor() |
|
jbudorick
2015/11/30 19:30:43
I'm not sure that we want this one any more.
| |
| 788 self.authorize_adb_devices() | 804 self.authorize_adb_devices() |
| 789 self.device_status_check() | 805 self.device_status_check() |
| 790 if perf_setup: | 806 if perf_setup: |
| 791 kwargs = { | 807 kwargs = { |
| 792 'min_battery_level': 95, | 808 'min_battery_level': 95, |
| 793 'disable_network': True, | 809 'disable_network': True, |
| 794 'disable_java_debug': True, | 810 'disable_java_debug': True, |
| 795 'max_battery_temp': 350} | 811 'max_battery_temp': 350} |
| 796 else: | 812 else: |
| 797 kwargs = {} | 813 kwargs = {} |
| 798 self.provision_devices(**kwargs) | 814 self.provision_devices(**kwargs) |
| 799 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: | 815 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: |
| 800 self.asan_device_setup() | 816 self.asan_device_setup() |
| 801 | 817 |
| 802 self.spawn_device_monitor() | 818 self.spawn_device_monitor() |
| 803 | 819 |
| 804 def common_tests_final_steps(self, logcat_gs_bucket=None): | 820 def common_tests_final_steps(self, logcat_gs_bucket=None): |
| 805 if not self.c.gce_setup: | 821 if not self.c.gce_setup: |
| 806 self.shutdown_device_monitor() | 822 self.shutdown_device_monitor() |
| 807 self.logcat_dump(gs_bucket=logcat_gs_bucket) | 823 logcat_file = self.m.chromium.output_dir.join('full_log') |
| 808 self.stack_tool_steps() | 824 self.logcat_dump(output_logcat_file=logcat_file, |
| 825 gs_bucket=logcat_gs_bucket) | |
| 826 self.stack_tool_steps(logcat_file=logcat_file) | |
| 809 if self.c.gce_setup: | 827 if self.c.gce_setup: |
| 810 self.shutdown_gce_instances() | 828 self.shutdown_gce_instances() |
| 811 self.test_report() | 829 self.test_report() |
| 812 | 830 |
| 813 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): | 831 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): |
| 814 self.m.step('prepare bisect perf regression', | 832 self.m.step('prepare bisect perf regression', |
| 815 [self.m.path['checkout'].join('tools', | 833 [self.m.path['checkout'].join('tools', |
| 816 'prepare-bisect-perf-regression.py'), | 834 'prepare-bisect-perf-regression.py'), |
| 817 '-w', self.m.path['slave_build']]) | 835 '-w', self.m.path['slave_build']]) |
| 818 | 836 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1077 def test_runner(self, step_name, args=None, **kwargs): | 1095 def test_runner(self, step_name, args=None, **kwargs): |
| 1078 """Wrapper for the python testrunner script. | 1096 """Wrapper for the python testrunner script. |
| 1079 | 1097 |
| 1080 Args: | 1098 Args: |
| 1081 step_name: Name of the step. | 1099 step_name: Name of the step. |
| 1082 args: Testrunner arguments. | 1100 args: Testrunner arguments. |
| 1083 """ | 1101 """ |
| 1084 with self.handle_exit_codes(): | 1102 with self.handle_exit_codes(): |
| 1085 return self.m.python( | 1103 return self.m.python( |
| 1086 step_name, self.c.test_runner, args, **kwargs) | 1104 step_name, self.c.test_runner, args, **kwargs) |
| OLD | NEW |