| 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 argparse | 5 import argparse |
| 6 import datetime | 6 import datetime |
| 7 import random | 7 import random |
| 8 import re | 8 import re |
| 9 import urllib | 9 import urllib |
| 10 | 10 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 env['CXX'] = self.c.gyp_env.CXX | 257 env['CXX'] = self.c.gyp_env.CXX |
| 258 if self.c.gyp_env.LINK: | 258 if self.c.gyp_env.LINK: |
| 259 env['LINK'] = self.c.gyp_env.LINK | 259 env['LINK'] = self.c.gyp_env.LINK |
| 260 if self.c.gyp_env.RANLIB: | 260 if self.c.gyp_env.RANLIB: |
| 261 env['RANLIB'] = self.c.gyp_env.RANLIB | 261 env['RANLIB'] = self.c.gyp_env.RANLIB |
| 262 # TODO(machenbach): Make this the default on windows. | 262 # TODO(machenbach): Make this the default on windows. |
| 263 if self.m.chromium.c.gyp_env.GYP_MSVS_VERSION: | 263 if self.m.chromium.c.gyp_env.GYP_MSVS_VERSION: |
| 264 env['GYP_MSVS_VERSION'] = self.m.chromium.c.gyp_env.GYP_MSVS_VERSION | 264 env['GYP_MSVS_VERSION'] = self.m.chromium.c.gyp_env.GYP_MSVS_VERSION |
| 265 self.m.chromium.runhooks(env=env, **kwargs) | 265 self.m.chromium.runhooks(env=env, **kwargs) |
| 266 | 266 |
| 267 @property |
| 268 def build_environment(self): |
| 269 if self.m.properties.get('parent_build_environment'): |
| 270 return self.m.properties['parent_build_environment'] |
| 271 if self.bot_type == 'tester': |
| 272 return None |
| 273 build_environment = dict( |
| 274 (k, v) for (k, v) in self.m.chromium.c.gyp_env.as_jsonish().iteritems() |
| 275 if k.startswith('GYP') and v is not None |
| 276 ) |
| 277 build_environment.update(self.c.gyp_env.as_jsonish()) |
| 278 if 'GYP_DEFINES' in build_environment: |
| 279 # Filter out gomadir. |
| 280 build_environment['GYP_DEFINES'] = ' '.join( |
| 281 d for d in build_environment['GYP_DEFINES'].split() |
| 282 if not d.startswith('gomadir') |
| 283 ) |
| 284 return build_environment |
| 285 |
| 267 def setup_mips_toolchain(self): | 286 def setup_mips_toolchain(self): |
| 268 mips_dir = self.m.path['slave_build'].join(MIPS_DIR, 'bin') | 287 mips_dir = self.m.path['slave_build'].join(MIPS_DIR, 'bin') |
| 269 if not self.m.path.exists(mips_dir): | 288 if not self.m.path.exists(mips_dir): |
| 270 self.m.gsutil.download_url( | 289 self.m.gsutil.download_url( |
| 271 'gs://chromium-v8/%s' % MIPS_TOOLCHAIN, | 290 'gs://chromium-v8/%s' % MIPS_TOOLCHAIN, |
| 272 self.m.path['slave_build'], | 291 self.m.path['slave_build'], |
| 273 name='bootstrapping mips toolchain') | 292 name='bootstrapping mips toolchain') |
| 274 self.m.step('unzipping', | 293 self.m.step('unzipping', |
| 275 ['tar', 'xf', MIPS_TOOLCHAIN], | 294 ['tar', 'xf', MIPS_TOOLCHAIN], |
| 276 cwd=self.m.path['slave_build']) | 295 cwd=self.m.path['slave_build']) |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 """Returns log lines for all results of a unique command.""" | 707 """Returns log lines for all results of a unique command.""" |
| 689 assert results | 708 assert results |
| 690 lines = [] | 709 lines = [] |
| 691 | 710 |
| 692 # Add common description for multiple runs. | 711 # Add common description for multiple runs. |
| 693 flaky_suffix = ' (flaky in a repeated run)' if flaky else '' | 712 flaky_suffix = ' (flaky in a repeated run)' if flaky else '' |
| 694 lines.append('Test: %s%s' % (results[0]['name'], flaky_suffix)) | 713 lines.append('Test: %s%s' % (results[0]['name'], flaky_suffix)) |
| 695 lines.append('Flags: %s' % ' '.join(results[0]['flags'])) | 714 lines.append('Flags: %s' % ' '.join(results[0]['flags'])) |
| 696 lines.append('Command: %s' % results[0]['command']) | 715 lines.append('Command: %s' % results[0]['command']) |
| 697 lines.append('') | 716 lines.append('') |
| 717 lines.append('Build environment:') |
| 718 build_environment = self.build_environment |
| 719 if build_environment is None: |
| 720 lines.append( |
| 721 'Not available. Please look up the builder\'s configuration.') |
| 722 else: |
| 723 for key in sorted(build_environment): |
| 724 lines.append(' %s: %s' % (key, build_environment[key])) |
| 725 lines.append('') |
| 698 | 726 |
| 699 # Add results for each run of a command. | 727 # Add results for each run of a command. |
| 700 for result in sorted(results, key=lambda r: int(r['run'])): | 728 for result in sorted(results, key=lambda r: int(r['run'])): |
| 701 lines.append('Run #%d' % int(result['run'])) | 729 lines.append('Run #%d' % int(result['run'])) |
| 702 lines.append('Exit code: %s' % result['exit_code']) | 730 lines.append('Exit code: %s' % result['exit_code']) |
| 703 lines.append('Result: %s' % result['result']) | 731 lines.append('Result: %s' % result['result']) |
| 704 if result.get('expected'): | 732 if result.get('expected'): |
| 705 lines.append('Expected outcomes: %s' % ", ".join(result['expected'])) | 733 lines.append('Expected outcomes: %s' % ", ".join(result['expected'])) |
| 706 lines.append('Duration: %s' % V8Api.format_duration(result['duration'])) | 734 lines.append('Duration: %s' % V8Api.format_duration(result['duration'])) |
| 707 lines.append('') | 735 lines.append('') |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 result = self.m.step('CQ integrity - used testfilter', cmd=None) | 939 result = self.m.step('CQ integrity - used testfilter', cmd=None) |
| 912 result.presentation.status = self.m.step.FAILURE | 940 result.presentation.status = self.m.step.FAILURE |
| 913 if self.extra_flags: | 941 if self.extra_flags: |
| 914 result = self.m.step('CQ integrity - used extra flags', cmd=None) | 942 result = self.m.step('CQ integrity - used extra flags', cmd=None) |
| 915 result.presentation.status = self.m.step.FAILURE | 943 result.presentation.status = self.m.step.FAILURE |
| 916 | 944 |
| 917 def maybe_trigger(self, **additional_properties): | 945 def maybe_trigger(self, **additional_properties): |
| 918 triggers = self.bot_config.get('triggers', []) | 946 triggers = self.bot_config.get('triggers', []) |
| 919 triggers_proxy = self.bot_config.get('triggers_proxy', False) | 947 triggers_proxy = self.bot_config.get('triggers_proxy', False) |
| 920 if triggers or triggers_proxy: | 948 if triggers or triggers_proxy: |
| 949 # Careful! Before adding new properties, note the following: |
| 950 # Triggered bots on CQ will either need new properties to be explicitly |
| 951 # whitelisted or their name should be prefixed with 'parent_'. |
| 921 properties = { | 952 properties = { |
| 922 'parent_got_revision': self.revision, | 953 'parent_got_revision': self.revision, |
| 923 'parent_got_revision_cp': self.revision_cp, | 954 'parent_got_revision_cp': self.revision_cp, |
| 924 } | 955 } |
| 925 if self.m.tryserver.is_tryserver: | 956 if self.m.tryserver.is_tryserver: |
| 926 properties.update( | 957 properties.update( |
| 927 category=self.m.properties.get('category', 'manual_ts'), | 958 category=self.m.properties.get('category', 'manual_ts'), |
| 928 issue=self.m.properties['issue'], | 959 issue=self.m.properties['issue'], |
| 929 master=str(self.m.properties['master']), | 960 master=str(self.m.properties['master']), |
| 930 patch_project=str(self.m.properties['patch_project']), | 961 patch_project=str(self.m.properties['patch_project']), |
| 931 patch_storage=str(self.m.properties['patch_storage']), | 962 patch_storage=str(self.m.properties['patch_storage']), |
| 932 patchset=str(self.m.properties['patchset']), | 963 patchset=str(self.m.properties['patchset']), |
| 933 reason=str(self.m.properties.get('reason', 'ManualTS')), | 964 reason=str(self.m.properties.get('reason', 'ManualTS')), |
| 934 requester=str(self.m.properties['requester']), | 965 requester=str(self.m.properties['requester']), |
| 935 # On tryservers, set revision to the same as on the current bot, | 966 # On tryservers, set revision to the same as on the current bot, |
| 936 # as CQ expects builders and testers to match the revision field. | 967 # as CQ expects builders and testers to match the revision field. |
| 937 revision=str(self.m.properties.get('revision', 'HEAD')), | 968 revision=str(self.m.properties.get('revision', 'HEAD')), |
| 938 rietveld=str(self.m.properties['rietveld']), | 969 rietveld=str(self.m.properties['rietveld']), |
| 939 ) | 970 ) |
| 940 else: | 971 else: |
| 941 # On non-tryservers, we can set the revision to whatever the | 972 # On non-tryservers, we can set the revision to whatever the |
| 942 # triggering builder checked out. | 973 # triggering builder checked out. |
| 943 properties['revision'] = self.revision | 974 properties['revision'] = self.revision |
| 944 | 975 |
| 945 # TODO(machenbach): Also set meaningful buildbucket tags of triggering | 976 # TODO(machenbach): Also set meaningful buildbucket tags of triggering |
| 946 # parent. | 977 # parent. |
| 947 | 978 |
| 979 # Pass build environment to testers if it doesn't exceed buildbot's |
| 980 # limits. |
| 981 # TODO(machenbach): Remove the check in the after-buildbot age. |
| 982 if len(self.m.json.dumps(self.build_environment)) < 1024: |
| 983 properties['parent_build_environment'] = self.build_environment |
| 984 |
| 948 swarm_hashes = self.m.isolate.isolated_tests | 985 swarm_hashes = self.m.isolate.isolated_tests |
| 949 if swarm_hashes: | 986 if swarm_hashes: |
| 950 properties['swarm_hashes'] = swarm_hashes | 987 properties['swarm_hashes'] = swarm_hashes |
| 951 properties.update(**additional_properties) | 988 properties.update(**additional_properties) |
| 952 self.m.trigger(*[{ | 989 self.m.trigger(*[{ |
| 953 'builder_name': builder_name, | 990 'builder_name': builder_name, |
| 954 'properties': properties, | 991 'properties': properties, |
| 955 } for builder_name in triggers]) | 992 } for builder_name in triggers]) |
| 956 | 993 |
| 957 if triggers_proxy: | 994 if triggers_proxy: |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 def report_culprits(self, culprit_range): | 1127 def report_culprits(self, culprit_range): |
| 1091 assert culprit_range | 1128 assert culprit_range |
| 1092 if len(culprit_range) > 1: | 1129 if len(culprit_range) > 1: |
| 1093 text = 'Suspecting multiple commits' | 1130 text = 'Suspecting multiple commits' |
| 1094 else: | 1131 else: |
| 1095 text = 'Suspecting %s' % culprit_range[0][:8] | 1132 text = 'Suspecting %s' % culprit_range[0][:8] |
| 1096 | 1133 |
| 1097 step_result = self.m.step(text, cmd=None) | 1134 step_result = self.m.step(text, cmd=None) |
| 1098 for culprit in culprit_range: | 1135 for culprit in culprit_range: |
| 1099 step_result.presentation.links[culprit[:8]] = COMMIT_TEMPLATE % culprit | 1136 step_result.presentation.links[culprit[:8]] = COMMIT_TEMPLATE % culprit |
| OLD | NEW |