Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 1527123002: Support swarming dimensions in src-side JSON buildbot files. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Added TODO. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/gpu/api.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 re 5 import re
6 import string 6 import string
7 7
8 8
9 class Test(object): 9 class Test(object):
10 """ 10 """
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 class SwarmingTest(Test): 485 class SwarmingTest(Test):
486 def __init__(self, name, dimensions=None, tags=None, target_name=None, 486 def __init__(self, name, dimensions=None, tags=None, target_name=None,
487 extra_suffix=None): 487 extra_suffix=None):
488 self._name = name 488 self._name = name
489 self._tasks = {} 489 self._tasks = {}
490 self._results = {} 490 self._results = {}
491 self._target_name = target_name 491 self._target_name = target_name
492 self._dimensions = dimensions 492 self._dimensions = dimensions
493 self._tags = tags 493 self._tags = tags
494 self._extra_suffix = extra_suffix 494 self._extra_suffix = extra_suffix
495 if dimensions and not extra_suffix:
496 self._extra_suffix = self._get_gpu_suffix(dimensions)
497
498 def _get_gpu_suffix(self, dimensions):
M-A Ruel 2015/12/16 01:37:08 Make it a @staticmethod
Ken Russell (switch to Gerrit) 2015/12/16 01:50:47 Done.
499 if not dimensions.get('gpu'):
500 return None
501 gpu_vendor_id = dimensions.get('gpu', '').split(':')[0].lower()
502 if gpu_vendor_id == '8086':
M-A Ruel 2015/12/16 01:37:08 I'd prefer a small dict vendor_ids = { '8086':
Ken Russell (switch to Gerrit) 2015/12/16 01:50:47 Done.
503 gpu_vendor = 'Intel'
504 elif gpu_vendor_id == '10de':
505 gpu_vendor = 'NVIDIA'
506 elif gpu_vendor_id == '1002':
507 gpu_vendor = 'ATI'
508 else:
509 gpu_vendor = '(%s)' % gpu_vendor_id
510
511 os = dimensions.get('os', '')
512 if os.startswith('Mac'):
513 if dimensions.get('hidpi', '') == '1':
514 os_name = 'Mac Retina'
515 else:
516 os_name = 'Mac'
517 elif os.startswith('Windows'):
518 os_name = 'Windows'
519 else:
520 os_name = 'Linux'
521
522 return 'on %s GPU on %s' % (gpu_vendor, os_name)
495 523
496 @property 524 @property
497 def name(self): 525 def name(self):
498 if self._extra_suffix: 526 if self._extra_suffix:
499 return '%s %s' % (self._name, self._extra_suffix) 527 return '%s %s' % (self._name, self._extra_suffix)
500 else: 528 else:
501 return self._name 529 return self._name
502 530
503 @property 531 @property
504 def target_name(self): 532 def target_name(self):
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 except (ValueError, KeyError) as e: 1089 except (ValueError, KeyError) as e:
1062 step_result.presentation.logs['invalid_results_exc'] = [str(e)] 1090 step_result.presentation.logs['invalid_results_exc'] = [str(e)]
1063 valid = False 1091 valid = False
1064 failures = None 1092 failures = None
1065 if valid: 1093 if valid:
1066 step_result.presentation.step_text += api.test_utils.format_step_text([ 1094 step_result.presentation.step_text += api.test_utils.format_step_text([
1067 ['failures:', failures] 1095 ['failures:', failures]
1068 ]) 1096 ])
1069 return valid, failures 1097 return valid, failures
1070 1098
1099
1100 # TODO(kbr): remove after http://crbug.com/570075 is fixed.
1101 def sanitize_swarming_dimension_sets(dimension_sets):
1102 if not dimension_sets:
1103 return None
1104 result = []
1105 for dimensions in dimension_sets:
1106 new_dimensions = {}
M-A Ruel 2015/12/16 01:37:08 return [ {str(k): str(v) for k, v in dimensions.
Ken Russell (switch to Gerrit) 2015/12/16 01:50:47 Done.
1107 for key, val in dimensions.iteritems():
1108 new_dimensions[str(key)] = str(val)
1109 result.append(new_dimensions)
1110 return result
1111
1112
1071 def generate_isolated_script(api, mastername, buildername, test_spec, 1113 def generate_isolated_script(api, mastername, buildername, test_spec,
1072 enable_swarming=False, 1114 enable_swarming=False,
1073 scripts_compile_targets=None): 1115 scripts_compile_targets=None):
1074 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []): 1116 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []):
1075 use_swarming = False 1117 use_swarming = False
1076 swarming_shards = 1 1118 swarming_shards = 1
1119 swarming_dimension_sets = None
1077 if enable_swarming: 1120 if enable_swarming:
1078 swarming_spec = spec.get('swarming', {}) 1121 swarming_spec = spec.get('swarming', {})
1079 if swarming_spec.get('can_use_on_swarming_builders', False): 1122 if swarming_spec.get('can_use_on_swarming_builders', False):
1080 use_swarming = True 1123 use_swarming = True
1081 swarming_shards = swarming_spec.get('shards', 1) 1124 swarming_shards = swarming_spec.get('shards', 1)
1125 swarming_dimension_sets = sanitize_swarming_dimension_sets(
1126 swarming_spec.get('dimension_sets'))
1082 name = str(spec['name']) 1127 name = str(spec['name'])
1083 args = args=spec.get('args', []) 1128 args = args=spec.get('args', [])
1084 target_name = spec['isolate_name'] 1129 target_name = spec['isolate_name']
1085 # This features is only needed for the cases in which the *_run compile 1130 # This features is only needed for the cases in which the *_run compile
1086 # target is needed to generate isolate files that contains dynamically libs. 1131 # target is needed to generate isolate files that contains dynamically libs.
1087 # TODO(nednguyen, kbr): Remove this once all the GYP builds are converted 1132 # TODO(nednguyen, kbr): Remove this once all the GYP builds are converted
1088 # to GN. 1133 # to GN.
1089 override_compile_targets = spec.get('override_compile_targets', None) 1134 override_compile_targets = spec.get('override_compile_targets', None)
1090 if use_swarming: 1135 if use_swarming:
1091 yield SwarmingIsolatedScriptTest( 1136 if swarming_dimension_sets:
1092 name=name, args=args, target_name=target_name, shards=swarming_shards, 1137 for dimensions in swarming_dimension_sets:
1093 override_compile_targets=override_compile_targets) 1138 # Yield potentially multiple invocations of the same test,
1139 # on different machine configurations.
1140 yield SwarmingIsolatedScriptTest(
1141 name=name, args=args, target_name=target_name,
1142 shards=swarming_shards, dimensions=dimensions,
1143 override_compile_targets=override_compile_targets)
1144 else:
1145 yield SwarmingIsolatedScriptTest(
1146 name=name, args=args, target_name=target_name,
1147 shards=swarming_shards,
1148 override_compile_targets=override_compile_targets)
1094 else: 1149 else:
1095 yield LocalIsolatedScriptTest( 1150 yield LocalIsolatedScriptTest(
1096 name=name, args=args, target_name=target_name, 1151 name=name, args=args, target_name=target_name,
1097 override_compile_targets=override_compile_targets) 1152 override_compile_targets=override_compile_targets)
1098 1153
1099 1154
1100 class GTestTest(Test): 1155 class GTestTest(Test):
1101 def __init__(self, name, args=None, target_name=None, enable_swarming=False, 1156 def __init__(self, name, args=None, target_name=None, enable_swarming=False,
1102 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, 1157 swarming_shards=1, swarming_dimensions=None, swarming_tags=None,
1103 swarming_extra_suffix=None, **runtest_kwargs): 1158 swarming_extra_suffix=None, **runtest_kwargs):
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 def run(self, api, suffix): 1694 def run(self, api, suffix):
1640 api.chromium_android.coverage_report(upload=False) 1695 api.chromium_android.coverage_report(upload=False)
1641 api.chromium_android.get_changed_lines_for_revision() 1696 api.chromium_android.get_changed_lines_for_revision()
1642 api.chromium_android.incremental_coverage_report() 1697 api.chromium_android.incremental_coverage_report()
1643 1698
1644 1699
1645 GOMA_TESTS = [ 1700 GOMA_TESTS = [
1646 GTestTest('base_unittests'), 1701 GTestTest('base_unittests'),
1647 GTestTest('content_unittests'), 1702 GTestTest('content_unittests'),
1648 ] 1703 ]
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/gpu/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698