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

Unified Diff: testing/variations/PRESUBMIT.py

Issue 2296493002: Merge all Field Trial Testing Configuration Together (Closed)
Patch Set: Review Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: testing/variations/PRESUBMIT.py
diff --git a/testing/variations/PRESUBMIT.py b/testing/variations/PRESUBMIT.py
index 6b0f8644e0b9e83141d5c84c44dfaf923e05aae4..0b36d5d84d844d0acb40849bd68fe81cc86c737c 100644
--- a/testing/variations/PRESUBMIT.py
+++ b/testing/variations/PRESUBMIT.py
@@ -44,45 +44,62 @@ def ValidateData(json_data, file_path, message_type):
if not isinstance(json_data, dict):
return [message_type(
'Malformed config file %s: Expecting dict' % file_path)]
- for (study, groups) in json_data.iteritems():
- if not isinstance(study, unicode):
+ for (trial, group_configs) in json_data.iteritems():
+ if not isinstance(trial, unicode):
return [message_type(
- 'Malformed config file %s: Expecting keys to be string, got %s'
- % (file_path, type(study)))]
- if not isinstance(groups, list):
+ 'Malformed config file %s: Expecting keys to be string, got %s' %
+ (file_path, type(trial)))]
+ if not isinstance(group_configs, list):
return [message_type(
- 'Malformed config file %s: Expecting list for study %s'
- % (file_path, study))]
- for group in groups:
- if not isinstance(group, dict):
+ 'Malformed config file %s: Expecting list for trial %s' % (file_path,
+ trial))]
+ for group_config in group_configs:
+ if not isinstance(group_config, dict):
+ return [message_type('Malformed config file %s: Expecting dict for '
+ 'group config in Trial[%s]' % (file_path, trial))]
+ if not 'groups' in group_config:
return [message_type(
- 'Malformed config file %s: Expecting dict for group in '
- 'Study[%s]' % (file_path, study))]
- if not 'group_name' in group or not isinstance(group['group_name'],
- unicode):
- return [message_type(
- 'Malformed config file %s: Missing valid group_name for group'
- ' in Study[%s]' % (file_path, study))]
- if 'params' in group:
- params = group['params']
- if not isinstance(params, dict):
+ 'Malformed config file %s: Missing valid groups for group config '
+ 'in Trial[%s]' % (file_path, trial))]
+ if not isinstance(group_config['groups'], list):
+ return [message_type('Malformed config file %s: Expecting list for '
+ 'groups in Trial[%s]' % (file_path, trial))]
Alexei Svitkine (slow) 2016/08/31 20:17:27 Nit: There's a bunch of repetition in these messag
robliao 2016/09/01 21:49:07 Done.
+ for group in group_config['groups']:
+ if not 'group_name' in group or not isinstance(group['group_name'],
+ unicode):
return [message_type(
- 'Malformed config file %s: Invalid params for Group[%s]'
- ' in Study[%s]' % (file_path, group['group_name'],
- study))]
- for (key, value) in params.iteritems():
- if not isinstance(key, unicode) or not isinstance(value,
- unicode):
+ 'Malformed config file %s: Missing valid group_name for group in '
+ 'Trial[%s]' % (file_path, trial))]
+ if 'params' in group:
+ params = group['params']
+ if not isinstance(params, dict):
return [message_type(
- 'Malformed config file %s: Invalid params for Group[%s]'
- ' in Study[%s]' % (file_path, group['group_name'],
- study))]
- for key in group.keys():
- if key not in VALID_GROUP_KEYS:
- return [message_type(
- 'Malformed config file %s: Key[%s] in Group[%s] in Study[%s] '
- 'is not a valid key.' % (
- file_path, key, group['group_name'], study))]
+ 'Malformed config file %s: Invalid params for Group[%s] in '
+ 'Trial[%s]' % (file_path, group['group_name'], trial))]
+ for (key, value) in params.iteritems():
+ if not isinstance(key, unicode) or not isinstance(value, unicode):
+ return [message_type('Malformed config file %s: Invalid params '
+ 'for Group[%s] in Study[%s]' % (file_path,
+ group['group_name'], trial))]
+ for key in group.keys():
+ if key not in VALID_GROUP_KEYS:
+ return [message_type(
+ 'Malformed config file %s: Key[%s] in Group[%s] in Trial[%s] '
+ 'is not a valid key.' % (file_path, key,
+ group['group_name'], trial))]
+ if not 'platforms' in group_config:
+ return [message_type('Malformed config file %s: Missing valid '
+ 'platforms for group config in Trial[%s]' % (file_path, trial))]
+ if not isinstance(group_config['platforms'], list):
+ return [message_type('Malformed config file %s: Expecting list for '
+ 'platforms in Trial[%s]' % (file_path, trial))]
+ supported_platforms = ['android', 'chromeos', 'ios', 'linux', 'mac',
+ 'win']
+ unsupported_platforms = list(set(group_config['platforms']).difference(
+ supported_platforms))
+ if unsupported_platforms:
+ return [message_type('Malformed config file %s: Unsupported platforms '
+ '%s in Trial[%s]' % (file_path, unsupported_platforms, trial))]
return []

Powered by Google App Engine
This is Rietveld 408576698