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

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: Addressed review feedback from maruel. 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
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 @staticmethod
499 def _get_gpu_suffix(dimensions):
500 if not dimensions.get('gpu'):
501 return None
502 gpu_vendor_id = dimensions.get('gpu', '').split(':')[0].lower()
503 vendor_ids = {
504 '8086': 'Intel',
505 '10de': 'NVIDIA',
Sergiy Byelozyorov 2015/12/16 14:44:54 nit: nVidia
Ken Russell (switch to Gerrit) 2015/12/16 18:28:20 I'm leaving this as is to avoid changing tons of e
506 '1002': 'ATI',
507 }
508 gpu_vendor = vendor_ids.get(gpu_vendor_id) or '(%s)' % gpu_vendor_id
509
510 os = dimensions.get('os', '')
511 if os.startswith('Mac'):
512 if dimensions.get('hidpi', '') == '1':
513 os_name = 'Mac Retina'
514 else:
515 os_name = 'Mac'
516 elif os.startswith('Windows'):
517 os_name = 'Windows'
518 else:
Paweł Hajdan Jr. 2015/12/16 14:48:35 Can we check for Linux explicitly and say "unknown
Ken Russell (switch to Gerrit) 2015/12/16 18:28:20 Probably, but this is the way the old logic worked
519 os_name = 'Linux'
520
521 return 'on %s GPU on %s' % (gpu_vendor, os_name)
495 522
496 @property 523 @property
497 def name(self): 524 def name(self):
498 if self._extra_suffix: 525 if self._extra_suffix:
499 return '%s %s' % (self._name, self._extra_suffix) 526 return '%s %s' % (self._name, self._extra_suffix)
500 else: 527 else:
501 return self._name 528 return self._name
502 529
503 @property 530 @property
504 def target_name(self): 531 def target_name(self):
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 except (ValueError, KeyError) as e: 1088 except (ValueError, KeyError) as e:
1062 step_result.presentation.logs['invalid_results_exc'] = [str(e)] 1089 step_result.presentation.logs['invalid_results_exc'] = [str(e)]
1063 valid = False 1090 valid = False
1064 failures = None 1091 failures = None
1065 if valid: 1092 if valid:
1066 step_result.presentation.step_text += api.test_utils.format_step_text([ 1093 step_result.presentation.step_text += api.test_utils.format_step_text([
1067 ['failures:', failures] 1094 ['failures:', failures]
1068 ]) 1095 ])
1069 return valid, failures 1096 return valid, failures
1070 1097
1098
1099 # TODO(kbr): remove after http://crbug.com/570075 is fixed.
1100 def sanitize_swarming_dimension_sets(dimension_sets):
1101 if not dimension_sets:
1102 return None
1103 return [
1104 { str(k): str(v) for k, v in dimensions.iteritems() }
1105 for dimensions in dimension_sets
1106 ]
1107
1108
1071 def generate_isolated_script(api, mastername, buildername, test_spec, 1109 def generate_isolated_script(api, mastername, buildername, test_spec,
1072 enable_swarming=False, 1110 enable_swarming=False,
1073 scripts_compile_targets=None): 1111 scripts_compile_targets=None):
1074 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []): 1112 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []):
1075 use_swarming = False 1113 use_swarming = False
1076 swarming_shards = 1 1114 swarming_shards = 1
1115 swarming_dimension_sets = None
1077 if enable_swarming: 1116 if enable_swarming:
1078 swarming_spec = spec.get('swarming', {}) 1117 swarming_spec = spec.get('swarming', {})
1079 if swarming_spec.get('can_use_on_swarming_builders', False): 1118 if swarming_spec.get('can_use_on_swarming_builders', False):
1080 use_swarming = True 1119 use_swarming = True
1081 swarming_shards = swarming_spec.get('shards', 1) 1120 swarming_shards = swarming_spec.get('shards', 1)
1121 swarming_dimension_sets = sanitize_swarming_dimension_sets(
1122 swarming_spec.get('dimension_sets'))
1082 name = str(spec['name']) 1123 name = str(spec['name'])
1083 args = args=spec.get('args', []) 1124 args = args=spec.get('args', [])
1084 target_name = spec['isolate_name'] 1125 target_name = spec['isolate_name']
1085 # This features is only needed for the cases in which the *_run compile 1126 # 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. 1127 # target is needed to generate isolate files that contains dynamically libs.
1087 # TODO(nednguyen, kbr): Remove this once all the GYP builds are converted 1128 # TODO(nednguyen, kbr): Remove this once all the GYP builds are converted
1088 # to GN. 1129 # to GN.
1089 override_compile_targets = spec.get('override_compile_targets', None) 1130 override_compile_targets = spec.get('override_compile_targets', None)
1090 if use_swarming: 1131 if use_swarming:
1091 yield SwarmingIsolatedScriptTest( 1132 if swarming_dimension_sets:
1092 name=name, args=args, target_name=target_name, shards=swarming_shards, 1133 for dimensions in swarming_dimension_sets:
1093 override_compile_targets=override_compile_targets) 1134 # Yield potentially multiple invocations of the same test,
1135 # on different machine configurations.
1136 yield SwarmingIsolatedScriptTest(
1137 name=name, args=args, target_name=target_name,
1138 shards=swarming_shards, dimensions=dimensions,
1139 override_compile_targets=override_compile_targets)
1140 else:
1141 yield SwarmingIsolatedScriptTest(
1142 name=name, args=args, target_name=target_name,
1143 shards=swarming_shards,
1144 override_compile_targets=override_compile_targets)
1094 else: 1145 else:
1095 yield LocalIsolatedScriptTest( 1146 yield LocalIsolatedScriptTest(
1096 name=name, args=args, target_name=target_name, 1147 name=name, args=args, target_name=target_name,
1097 override_compile_targets=override_compile_targets) 1148 override_compile_targets=override_compile_targets)
1098 1149
1099 1150
1100 class GTestTest(Test): 1151 class GTestTest(Test):
1101 def __init__(self, name, args=None, target_name=None, enable_swarming=False, 1152 def __init__(self, name, args=None, target_name=None, enable_swarming=False,
1102 swarming_shards=1, swarming_dimensions=None, swarming_tags=None, 1153 swarming_shards=1, swarming_dimensions=None, swarming_tags=None,
1103 swarming_extra_suffix=None, **runtest_kwargs): 1154 swarming_extra_suffix=None, **runtest_kwargs):
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 def run(self, api, suffix): 1690 def run(self, api, suffix):
1640 api.chromium_android.coverage_report(upload=False) 1691 api.chromium_android.coverage_report(upload=False)
1641 api.chromium_android.get_changed_lines_for_revision() 1692 api.chromium_android.get_changed_lines_for_revision()
1642 api.chromium_android.incremental_coverage_report() 1693 api.chromium_android.incremental_coverage_report()
1643 1694
1644 1695
1645 GOMA_TESTS = [ 1696 GOMA_TESTS = [
1646 GTestTest('base_unittests'), 1697 GTestTest('base_unittests'),
1647 GTestTest('content_unittests'), 1698 GTestTest('content_unittests'),
1648 ] 1699 ]
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/gpu/api.py » ('j') | scripts/slave/recipes/chromium.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698